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

Unified Diff: tools/gn/ninja_target_writer.cc

Issue 350743004: Allow dependencies of toolchains in GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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
« no previous file with comments | « tools/gn/ninja_copy_target_writer_unittest.cc ('k') | tools/gn/ninja_target_writer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_target_writer.cc
diff --git a/tools/gn/ninja_target_writer.cc b/tools/gn/ninja_target_writer.cc
index 2383251c68b7ce5a3b69be67f7f92aea84f730be..df0412bcfab52174f3a35e69a8edae7064892e75 100644
--- a/tools/gn/ninja_target_writer.cc
+++ b/tools/gn/ninja_target_writer.cc
@@ -86,17 +86,19 @@ std::string NinjaTargetWriter::WriteInputDepsStampAndGetDep(
const std::vector<const Target*>& extra_hard_deps) const {
// For an action (where we run a script only once) the sources are the same
// as the source prereqs.
- bool list_sources_as_input_deps = target_->output_type() == Target::ACTION;
+ bool list_sources_as_input_deps = (target_->output_type() == Target::ACTION);
// Actions get implicit dependencies on the script itself.
- bool add_script_source_as_dep = target_->output_type() == Target::ACTION ||
- target_->output_type() == Target::ACTION_FOREACH;
+ bool add_script_source_as_dep =
+ (target_->output_type() == Target::ACTION) ||
+ (target_->output_type() == Target::ACTION_FOREACH);
if (!add_script_source_as_dep &&
extra_hard_deps.empty() &&
target_->inputs().empty() &&
target_->recursive_hard_deps().empty() &&
- (!list_sources_as_input_deps || target_->sources().empty()))
+ (!list_sources_as_input_deps || target_->sources().empty()) &&
+ toolchain_->deps().empty())
return std::string(); // No input/hard deps.
// One potential optimization is if there are few input dependencies (or
@@ -145,6 +147,17 @@ std::string NinjaTargetWriter::WriteInputDepsStampAndGetDep(
path_output_.WriteFile(out_, helper_.GetTargetOutputFile(*i));
}
+ // Toolchain dependencies. These must be resolved before doing anything.
+ // This just writs all toolchain deps for simplicity. If we find that
+ // toolchains often have more than one dependency, we could consider writing
+ // a toolchain-specific stamp file and only include the stamp here.
+ const LabelTargetVector& toolchain_deps = toolchain_->deps();
+ for (size_t i = 0; i < toolchain_deps.size(); i++) {
+ out_ << " ";
+ path_output_.WriteFile(out_,
+ helper_.GetTargetOutputFile(toolchain_deps[i].ptr));
+ }
+
// Extra hard deps passed in.
for (size_t i = 0; i < extra_hard_deps.size(); i++) {
out_ << " ";
« no previous file with comments | « tools/gn/ninja_copy_target_writer_unittest.cc ('k') | tools/gn/ninja_target_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698