Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b05ef9c authored by Ryan Mitchell's avatar Ryan Mitchell Committed by Android (Google) Code Review
Browse files

Merge "Sort inputs to compile and link"

parents 4d7b7663 f22ed8dc
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);
    }

+7 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ std::unique_ptr<FileCollection> FileCollection::Create(const android::StringPiec
    return nullptr;
  }

  std::vector<std::string> sorted_files;
  while (struct dirent *entry = readdir(d.get())) {
    std::string prefix_path = root.to_string();
    file::AppendPath(&prefix_path, entry->d_name);
@@ -105,8 +106,13 @@ std::unique_ptr<FileCollection> FileCollection::Create(const android::StringPiec
        continue;
      }

      collection->InsertFile(full_path);
      sorted_files.push_back(full_path);
    }
  }

  std::sort(sorted_files.begin(), sorted_files.end());
  for (const std::string& full_path : sorted_files) {
    collection->InsertFile(full_path);
  }

  return collection;