Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Unified Diff: tools/gn/ninja_target_writer.cc

Issue 1494883002: GN: Makes GN output deterministic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/gn/ninja_target_writer.cc
diff --git a/tools/gn/ninja_target_writer.cc b/tools/gn/ninja_target_writer.cc
index 76413076685207938ec73c2bd9d192ae0efa8f16..86bf3f57be6ebfffb28bb0bcfca32e52f224be0b 100644
--- a/tools/gn/ninja_target_writer.cc
+++ b/tools/gn/ninja_target_writer.cc
@@ -17,6 +17,7 @@
#include "tools/gn/ninja_group_target_writer.h"
#include "tools/gn/ninja_utils.h"
#include "tools/gn/output_file.h"
+#include "tools/gn/pointer_set.h"
#include "tools/gn/scheduler.h"
#include "tools/gn/string_utils.h"
#include "tools/gn/substitution_writer.h"
@@ -207,14 +208,13 @@ OutputFile NinjaTargetWriter::WriteInputDepsStampAndGetDep(
}
// The different souces of input deps may duplicate some targets, so uniquify
- // them (ordering doesn't matter for this case).
- std::set<const Target*> unique_deps;
+ // them. Note that the order matters, or the output is non-deterministic.
+ PointerSet<const Target> unique_deps;
// Hard dependencies that are direct or indirect dependencies.
- const std::set<const Target*>& hard_deps = target_->recursive_hard_deps();
- for (const auto& dep : hard_deps)
- unique_deps.insert(dep);
+ const PointerSet<const Target>& hard_deps = target_->recursive_hard_deps();
+ unique_deps.insert(hard_deps.begin(), hard_deps.end());
// Extra hard dependencies passed in.
unique_deps.insert(extra_hard_deps.begin(), extra_hard_deps.end());

Powered by Google App Engine
This is Rietveld 408576698