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

Unified Diff: tools/gn/substitution_writer.cc

Issue 1887533003: Add an output_dir override to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const Created 4 years, 8 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/substitution_type.cc ('k') | tools/gn/substitution_writer_unittest.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 23d6914ac4e9e52b417730dddfc3895ae47b5203..a82e7ee2e753206b1e6c81b29e7728c0f5c0e21d 100644
--- a/tools/gn/substitution_writer.cc
+++ b/tools/gn/substitution_writer.cc
@@ -56,6 +56,10 @@ const char kSourceExpansion_Help[] =
"\n"
"Placeholders\n"
"\n"
+ " This section discusses only placeholders for actions. There are other\n"
+ " placeholders used in the definition of tools. See \"gn help tool\" for\n"
+ " those.\n"
+ "\n"
" {{source}}\n"
" The name of the source file including directory (*). This will\n"
" generally be used for specifying inputs to a script in the\n"
@@ -546,6 +550,23 @@ std::string SubstitutionWriter::GetLinkerSubstitution(
// Fall-through to the linker-specific ones.
switch (type) {
+ case SUBSTITUTION_OUTPUT_DIR:
+ // Use the target's value if there is one (it will have no expansion
+ // patterns since it can directly use GN variables to compute whatever
+ // path it wants), or the tool's default (which will contain further
+ // expansions).
+ if (target->output_dir().is_null()) {
+ return ApplyPatternToLinkerAsOutputFile(
+ target, tool, tool->default_output_dir()).value();
+ } else {
+ SetDirOrDotWithNoSlash(RebasePath(
+ target->output_dir().value(),
+ target->settings()->build_settings()->build_dir()),
+ &result);
+ return result;
+ }
+ break;
+
case SUBSTITUTION_OUTPUT_EXTENSION:
// Use the extension provided on the target if specified, otherwise
// fall back on the default. Note that the target's output extension
« no previous file with comments | « tools/gn/substitution_type.cc ('k') | tools/gn/substitution_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698