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

Unified Diff: tools/gn/functions_target.cc

Issue 23606031: GN: Use build directory for CD for scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/functions.cc ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/functions_target.cc
diff --git a/tools/gn/functions_target.cc b/tools/gn/functions_target.cc
index 7e046019964914acb350a5e708c70694bd204540..3d1631105a5dbe61131c9cdaeb59ebac2c884296 100644
--- a/tools/gn/functions_target.cc
+++ b/tools/gn/functions_target.cc
@@ -123,7 +123,11 @@ const char kCustom_Help[] =
" files and generate a set of output files.\n"
"\n"
" The script will be executed with the given arguments with the current\n"
- " directory being that of the current BUILD file.\n"
+ " directory being that of the root build directory. If you pass\n"
+ " to your script, see \"gn help to_build_path\" for how to convert\n"
+ " file names to be relative to the build directory (file names in the\n"
+ " sources, outputs, and source_prereqs will be all treated as relative\n"
+ " to the current build file and converted as needed automatically).\n"
"\n"
" There are two modes. The first mode is the \"per-file\" mode where you\n"
" specify a list of sources and the script is run once for each one as a\n"
@@ -151,8 +155,8 @@ const char kCustom_Help[] =
"\n"
" {{source}}\n"
" Expanded in |args|, this is the name of the source file relative\n"
- " to the current directory when running the script. This is how\n"
- " you specify the current input file to your script.\n"
+ " to the build directory This is how you specify the current input\n"
+ " file to your script.\n"
"\n"
" {{source_name_part}}\n"
" Expanded in |args| and |outputs|, this is just the filename part\n"
@@ -176,16 +180,21 @@ const char kCustom_Help[] =
" source_prereqs = [ \"my_configuration.txt\" ]\n"
" outputs = [ \"$target_gen_dir/{{source_name_part}}.h\",\n"
" \"$target_gen_dir/{{source_name_part}}.cc\" ]\n"
+ "\n"
+ " # Note that since \"args\" is opaque to GN, if you specify paths\n"
+ " # here, you will need to convert it to be relative to the build\n"
+ " # directory using \"to_build_path()\".\n"
" args = [ \"{{source}}\",\n"
" \"-o\",\n"
- " \"$relative_target_gen_dir/{{source_name_part}}.h\" ]\n"
+ " to_build_path(relative_target_gen_dir) + \"/\" +\n"
+ " {{source_name_part}}.h\" ]\n"
" }\n"
"\n"
" custom(\"just_run_this_guy_once\") {\n"
" script = \"doprocessing.py\"\n"
" source_prereqs = [ \"my_configuration.txt\" ]\n"
" outputs = [ \"$target_gen_dir/insightful_output.txt\" ]\n"
- " args = [ \"--output_dir\", $target_gen_dir ]\n"
+ " args = [ \"--output_dir\", to_build_path(target_gen_dir) ]\n"
" }\n";
Value RunCustom(Scope* scope,
« no previous file with comments | « tools/gn/functions.cc ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698