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

Unified Diff: tools/gn/ninja_build_writer.cc

Issue 1256043006: Reference written files relatively when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/filesystem_utils_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/ninja_build_writer.cc
diff --git a/tools/gn/ninja_build_writer.cc b/tools/gn/ninja_build_writer.cc
index 12a37e13d8b5eaa735339b37a8ebed52b47fb670..a51b38bf5eaedc50a3c63bd41ead48354481496f 100644
--- a/tools/gn/ninja_build_writer.cc
+++ b/tools/gn/ninja_build_writer.cc
@@ -152,11 +152,19 @@ void NinjaBuildWriter::WriteNinjaRules() {
// Other files read by the build.
EscapeOptions path_escaping;
path_escaping.mode = ESCAPE_NINJA_COMMAND;
+
std::vector<SourceFile> written_files = g_scheduler->GetWrittenFiles();
- for (const auto& written_file : written_files)
- out_ << " " <<
- EscapeString(FilePathToUTF8(build_settings_->GetFullPath(written_file)),
- path_escaping, nullptr);
+ for (const auto& written_file : written_files) {
+ Err err;
+ base::FilePath::StringType fileref = ComputeStringInOutputDir(
brettw 2015/07/31 23:36:55 I think RebasePath in filesystem_utils.h will hand
+ build_settings_->build_dir(), written_file, &err);
+ out_ << " ";
+ if (!err.has_error())
+ EscapeStringToStream(out_, FilePathToUTF8(fileref), path_escaping);
+ else
+ EscapeStringToStream(out_,
+ written_file.Resolve(build_settings_->root_path()), path_escaping);
Peter Mayo 2015/07/31 19:08:07 Oops, forgot to change to UTF8.
+ }
out_ << ": gn\n"
<< " generator = 1\n"
« no previous file with comments | « tools/gn/filesystem_utils_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698