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

Unified Diff: tools/gn/substitution_writer.cc

Issue 630223002: gn: Support build directories outside the source tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch that compiles and passes unit tests on both Windows and Linux Created 6 years, 1 month 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/source_file.cc ('k') | tools/gn/value_extractors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/substitution_writer.cc
diff --git a/tools/gn/substitution_writer.cc b/tools/gn/substitution_writer.cc
index 65a1d1fe2859f23388922df978ddb2cab1a71d48..a642e478c98e373a6907d94ee2c73aa183108973 100644
--- a/tools/gn/substitution_writer.cc
+++ b/tools/gn/substitution_writer.cc
@@ -235,10 +235,6 @@ OutputFile SubstitutionWriter::ApplyPatternToSourceAsOutputFile(
const SubstitutionPattern& pattern,
const SourceFile& source) {
SourceFile result_as_source = ApplyPatternToSource(settings, pattern, source);
- CHECK(result_as_source.is_source_absolute())
- << "The result of the pattern \""
- << pattern.AsString()
- << "\" was not an absolute path beginning in \"//\".";
return OutputFile(settings->build_settings(), result_as_source);
}
@@ -357,8 +353,9 @@ std::string SubstitutionWriter::GetSourceSubstitution(
case SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR:
if (source.is_system_absolute())
return DirectoryWithNoLastSlash(source.GetDir());
- return RebaseSourceAbsolutePath(
- DirectoryWithNoLastSlash(source.GetDir()), SourceDir("//"));
+ return RebasePath(
+ DirectoryWithNoLastSlash(source.GetDir()), SourceDir("//"),
+ settings->build_settings()->root_path_utf8());
case SUBSTITUTION_SOURCE_GEN_DIR:
to_rebase = DirectoryWithNoLastSlash(
@@ -382,7 +379,8 @@ std::string SubstitutionWriter::GetSourceSubstitution(
// extension extraction) will have been handled via early return above.
if (output_style == OUTPUT_ABSOLUTE)
return to_rebase;
- return RebaseSourceAbsolutePath(to_rebase, relative_to);
+ return RebasePath(to_rebase, relative_to,
+ settings->build_settings()->root_path_utf8());
}
// static
« no previous file with comments | « tools/gn/source_file.cc ('k') | tools/gn/value_extractors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698