| Index: tools/gn/functions_target.cc
|
| diff --git a/tools/gn/functions_target.cc b/tools/gn/functions_target.cc
|
| index b04fea8b0f49d56c9121ac9b7432f27aad272751..c257b4839c0272caa4580031c10338c2776d29a7 100644
|
| --- a/tools/gn/functions_target.cc
|
| +++ b/tools/gn/functions_target.cc
|
| @@ -18,8 +18,9 @@
|
| #define DEPS_VARS \
|
| " Deps: data_deps, deps, public_deps\n"
|
| #define GENERAL_TARGET_VARS \
|
| - " General: check_includes, configs, data, inputs, output_name,\n" \
|
| - " output_extension, public, sources, testonly, visibility\n"
|
| + " General: bundle_data, check_includes, configs, data, inputs,\n" \
|
| + " output_name, output_extension, public, sources, testonly,\n" \
|
| + " visibility\n"
|
|
|
| namespace functions {
|
|
|
| @@ -299,6 +300,67 @@ Value RunCopy(const FunctionCallNode* function,
|
| return Value();
|
| }
|
|
|
| +// copy bundle data ------------------------------------------------------------
|
| +
|
| +const char kCopyBundleData[] = "copy_bundle_data";
|
| +const char kCopyBundleData_HelpShort[] =
|
| + "copy_bundle_data: Declare a target that copy \"bundle_data\" files.";
|
| +const char kCopyBundleData_Help[] =
|
| + "copy_bundle_data: Declare a target that copy \"bundle_data\" files.\n"
|
| + "\n"
|
| + " Similar to the \"copy\" target, but the list of files to copy comes\n"
|
| + " from the \"bundle_data\" property of all dependencies recursively.\n"
|
| + " It can be used to copy files required at runtime by the application\n"
|
| + " into a location where it can be found.\n"
|
| + "\n"
|
| + " This uses the \"copy_bundle_data\" tool from the toolchain.\n"
|
| + "\n"
|
| + " See \"gn help copy\" for more information.\n"
|
| + "\n"
|
| + "Examples\n"
|
| + "\n"
|
| + " # A source_set that has a runtime dependency expressed as bundle_data\n"
|
| + " source_set(\"icu\") {\n"
|
| + " sources = [ \"icu.h\", \"icu.cc\" ]\n"
|
| + " bundle_data = [ \"icudtl.dat\" ]\n"
|
| + " }\n"
|
| + "\n"
|
| + " # Main application executable.\n"
|
| + " executable(\"app.app\") {\n"
|
| + " visibility = [ \":app\" ]\n"
|
| + " deps = [ \":icu\" ]\n"
|
| + " output_name = \"$root_build_dir/app.app/app\"\n"
|
| + " sources = [ \"main.cc\" ]\n"
|
| + " }\n"
|
| + "\n"
|
| + " # Copy runtime dependencies into the application bundle, filtering\n"
|
| + " # the .xcassets files as they need to be compiled into a .car file\n"
|
| + " # on Mac/iOS.\n"
|
| + " copy_bundle_data(\"app.bundle\") {\n"
|
| + " visibility = [ \":app\" ]\n"
|
| + " deps = [ \":icu\" ] # Same deps as the executable.\n"
|
| + " outputs = [ $root_build_dir/app.app/{{source_file_name}}\" ]\n"
|
| + " bundle_data_filter = [ \"*.xcassets\" ]\n"
|
| + " }\n"
|
| + "\n"
|
| + " # Main application target.\n"
|
| + " group(\"app\") {\n"
|
| + " deps = [ \":app.app\", \"app.bundle\" ]\n"
|
| + " }\n"
|
| + "";
|
| +
|
| +Value RunCopyBundleData(const FunctionCallNode* function,
|
| + const std::vector<Value>& args,
|
| + Scope* scope,
|
| + Err* err) {
|
| + if (!EnsureNotProcessingImport(function, scope, err) ||
|
| + !EnsureNotProcessingBuildConfig(function, scope, err))
|
| + return Value();
|
| + TargetGenerator::GenerateTarget(scope, function, args,
|
| + functions::kCopyBundleData, err);
|
| + return Value();
|
| +}
|
| +
|
| // executable ------------------------------------------------------------------
|
|
|
| const char kExecutable[] = "executable";
|
|
|