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

Unified Diff: tools/gn/ninja_target_writer.cc

Issue 505353002: Reduce input dependencies in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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_target_writer.h ('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 5ff6e0f8084f70fe6f2086f73598459e372fe1ea..75582a170b2e61e7cc112f7e19487c3278352e77 100644
--- a/tools/gn/ninja_target_writer.cc
+++ b/tools/gn/ninja_target_writer.cc
@@ -16,6 +16,7 @@
#include "tools/gn/ninja_copy_target_writer.h"
#include "tools/gn/ninja_group_target_writer.h"
#include "tools/gn/ninja_utils.h"
+#include "tools/gn/output_file.h"
#include "tools/gn/scheduler.h"
#include "tools/gn/string_utils.h"
#include "tools/gn/substitution_writer.h"
@@ -142,7 +143,7 @@ void NinjaTargetWriter::WriteSharedVars(const SubstitutionBits& bits) {
out_ << std::endl;
}
-std::string NinjaTargetWriter::WriteInputDepsStampAndGetDep(
+OutputFile NinjaTargetWriter::WriteInputDepsStampAndGetDep(
const std::vector<const Target*>& extra_hard_deps) const {
CHECK(target_->toolchain())
<< "Toolchain not set on target "
@@ -163,7 +164,7 @@ std::string NinjaTargetWriter::WriteInputDepsStampAndGetDep(
target_->recursive_hard_deps().empty() &&
(!list_sources_as_input_deps || target_->sources().empty()) &&
target_->toolchain()->deps().empty())
- return std::string(); // No input/hard deps.
+ return OutputFile(); // No input/hard deps.
// One potential optimization is if there are few input dependencies (or
// potentially few sources that depend on these) it's better to just write
@@ -178,11 +179,9 @@ std::string NinjaTargetWriter::WriteInputDepsStampAndGetDep(
input_stamp_file.value().append(target_->label().name());
input_stamp_file.value().append(".inputdeps.stamp");
- std::ostringstream stamp_file_stream;
- path_output_.WriteFile(stamp_file_stream, input_stamp_file);
- std::string stamp_file_string = stamp_file_stream.str();
-
- out_ << "build " << stamp_file_string << ": "
+ out_ << "build ";
+ path_output_.WriteFile(out_, input_stamp_file);
+ out_ << ": "
<< GetNinjaRulePrefixForToolchain(settings_)
<< Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP);
@@ -236,7 +235,7 @@ std::string NinjaTargetWriter::WriteInputDepsStampAndGetDep(
}
out_ << "\n";
- return " | " + stamp_file_string;
+ return input_stamp_file;
}
void NinjaTargetWriter::WriteStampForTarget(
« no previous file with comments | « tools/gn/ninja_target_writer.h ('k') | tools/gn/ninja_target_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698