summaryrefslogtreecommitdiff
path: root/tools/aapt2/cmd/Compile.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2019-02-20 08:05:31 -0800
committerRyan Mitchell <rtmitchell@google.com>2019-02-26 17:40:30 +0000
commitf22ed8dc0ec107cb0e80eb25c7de4094c7f5301e (patch)
treecfbd2d0f979450690cedae268be10116e160107c /tools/aapt2/cmd/Compile.cpp
parent32981ff4d406cd44c5e57814088028fecb9bf72f (diff)
Sort inputs to compile and link
This change sorts the input files of compile and link and also traverses directories in sorted order in FileCollection::Create. This change attempts to fix non-determinism issues with aapt2. Bug: 122518436 Test: builds Change-Id: I615b8d7f1117e3850366760f16672f0cf5b02070
Diffstat (limited to 'tools/aapt2/cmd/Compile.cpp')
-rw-r--r--tools/aapt2/cmd/Compile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp
index 0512bdc5bf72..bec6c6973613 100644
--- a/tools/aapt2/cmd/Compile.cpp
+++ b/tools/aapt2/cmd/Compile.cpp
@@ -769,7 +769,10 @@ int CompileCommand::Action(const std::vector<std::string>& args) {
auto collection = util::make_unique<io::FileCollection>();
// Collect data from the path for each input file.
- for (const std::string& arg : args) {
+ std::vector<std::string> sorted_args = args;
+ std::sort(sorted_args.begin(), sorted_args.end());
+
+ for (const std::string& arg : sorted_args) {
collection->InsertFile(arg);
}