diff options
author | Adam Lesinski <adamlesinski@google.com> | 2017-12-20 14:01:14 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2017-12-28 08:17:43 -0800 |
commit | e6aa6d14212eee2261bec5b226bf673fd8985845 (patch) | |
tree | 0b13f8dc86d06837617ed57d32d5640ec6c654de /tools/aapt2/cmd/Compile.cpp | |
parent | f3630cbe8ab567772e7722d7e8172a9da679dbf5 (diff) |
AAPT2: Keep file enumeration consistent across platforms
Filesystem directory enumeration is platform dependent, so
sort the files lexicographically according to source path before
consuming them in the compile command.
Bug: 70680618
Test: manual
Change-Id: I6706dea2eb40cbaff8a586994dd1013976e4ced4
Diffstat (limited to 'tools/aapt2/cmd/Compile.cpp')
-rw-r--r-- | tools/aapt2/cmd/Compile.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp index 7c1e96e88fee..3bec082fc57a 100644 --- a/tools/aapt2/cmd/Compile.cpp +++ b/tools/aapt2/cmd/Compile.cpp @@ -186,6 +186,12 @@ static bool LoadInputFilesFromDir(IAaptContext* context, const CompileOptions& o out_path_data->push_back(std::move(path_data.value())); } } + + // File-system directory enumeration order is platform-dependent. Sort the result to remove any + // inconsistencies between platforms. + std::sort( + out_path_data->begin(), out_path_data->end(), + [](const ResourcePathData& a, const ResourcePathData& b) { return a.source < b.source; }); return true; } |