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

Unified Diff: tools/gn/function_toolchain.cc

Issue 1752033002: Add "create_bundle" target in order to support bundle with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-bundle-data
Patch Set: Add unit tests, address comments, update docs and format with clang-format Created 4 years, 9 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/docs/reference.md ('k') | tools/gn/functions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/function_toolchain.cc
diff --git a/tools/gn/function_toolchain.cc b/tools/gn/function_toolchain.cc
index 9eeae982cf3bf17210ef53e4325d23b69c7f98a1..727be54d7362ddc85e3d4b125ef77aff8f5974c7 100644
--- a/tools/gn/function_toolchain.cc
+++ b/tools/gn/function_toolchain.cc
@@ -407,6 +407,10 @@ const char kTool_Help[] =
" \"stamp\": Tool for creating stamp files\n"
" \"copy\": Tool to copy files.\n"
"\n"
+ " Platform specific tools:\n"
+ " \"copy_bundle_data\": [iOS, OS X] Tool to copy files in a bundle.\n"
+ " \"compile_xcassets\": [iOS, OS X] Tool to compile asset catalogs.\n"
+ "\n"
"Tool variables\n"
"\n"
" command [string with substitutions]\n"
@@ -718,6 +722,18 @@ const char kTool_Help[] =
" {{source}} which is the source of the copy. The stamp tool allows\n"
" only the common tool substitutions.\n"
"\n"
+ " The copy_bundle_data and compile_xcassets tools only allows the common\n"
+ " tool substitutions. Both tools are required to create iOS/OS X bundles\n"
+ " and need only be defined on those platforms.\n"
+ "\n"
+ " The copy_bundle_data tool will be called with one source and needs to\n"
+ " copy (optionally optimizing the data representation) to its output. It\n"
+ " may be called with a directory as input and it needs to be recursively\n"
+ " copied.\n"
+ "\n"
+ " The compile_xcassets tool will be called with one or more source (each\n"
+ " an asset catalog) that needs to be compiled to a single output.\n"
+ "\n"
"Separate linking and dependencies for shared libraries\n"
"\n"
" Shared libraries are special in that not all changes to them require\n"
@@ -812,9 +828,13 @@ Value RunTool(Scope* scope,
} else if (IsLinkerTool(tool_type)) {
subst_validator = &IsValidLinkerSubstitution;
subst_output_validator = &IsValidLinkerOutputsSubstitution;
- } else if (tool_type == Toolchain::TYPE_COPY) {
+ } else if (tool_type == Toolchain::TYPE_COPY ||
+ tool_type == Toolchain::TYPE_COPY_BUNDLE_DATA) {
subst_validator = &IsValidCopySubstitution;
subst_output_validator = &IsValidCopySubstitution;
+ } else if (tool_type == Toolchain::TYPE_COMPILE_XCASSETS) {
+ subst_validator = &IsValidCompileXCassetsSubstitution;
+ subst_output_validator = &IsValidCompileXCassetsSubstitution;
} else {
subst_validator = &IsValidToolSubstitution;
subst_output_validator = &IsValidToolSubstitution;
@@ -851,9 +871,12 @@ Value RunTool(Scope* scope,
return Value();
}
- if (tool_type != Toolchain::TYPE_COPY && tool_type != Toolchain::TYPE_STAMP) {
- // All tools except the copy and stamp tools should have outputs. The copy
- // and stamp tool's outputs are generated internally.
+ if (tool_type != Toolchain::TYPE_COPY &&
+ tool_type != Toolchain::TYPE_STAMP &&
+ tool_type != Toolchain::TYPE_COPY_BUNDLE_DATA &&
+ tool_type != Toolchain::TYPE_COMPILE_XCASSETS) {
+ // All tools should have outputs, except the copy, stamp, copy_bundle_data
+ // and compile_xcassets tools that generate their outputs internally.
if (!ReadOutputs(&block_scope, function, subst_output_validator,
tool.get(), err))
return Value();
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/functions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698