| Index: tools/gn/functions_target.cc
|
| diff --git a/tools/gn/functions_target.cc b/tools/gn/functions_target.cc
|
| index 645c24a8198eabef47c8346acb7644079608b4a2..5cfd20ba48b0b1c3ee5e5e877b2934e9cc5a9753 100644
|
| --- a/tools/gn/functions_target.cc
|
| +++ b/tools/gn/functions_target.cc
|
| @@ -334,11 +334,28 @@ const char kCreateBundle_Help[] =
|
| " dependencies should be placed in the bundle. A create_bundle can\n"
|
| " declare its own explicit data and data_deps, however.\n"
|
| "\n"
|
| + "Code signing\n"
|
| + "\n"
|
| + " Some bundle needs to be code signed as part of the build (on iOS all\n"
|
| + " application needs to be code signed to run on a device). The code\n"
|
| + " signature can be configured via the code_signing_script variable.\n"
|
| + "\n"
|
| + " If set, code_signing_script is the path of a script that invoked after\n"
|
| + " all files have been moved into the bundle. The script must not change\n"
|
| + " any file in the bundle, but may add new files.\n"
|
| + "\n"
|
| + " If code_signing_script is defined, then code_signing_outputs must also\n"
|
| + " be defined and non-empty to inform when the script needs to be re-run.\n"
|
| + " The code_signing_args will be passed as is to the script (so path have\n"
|
| + " to be rebased) and additional inputs may be listed with the variable\n"
|
| + " code_signing_sources.\n"
|
| + "\n"
|
| "Variables\n"
|
| "\n"
|
| " bundle_root_dir*, bundle_resources_dir*, bundle_executable_dir*,\n"
|
| " bundle_plugins_dir*, deps, data_deps, public_deps, visibility,\n"
|
| - " product_type\n"
|
| + " product_type, code_signing_args, code_signing_script,\n"
|
| + " code_signing_sources, code_signing_outputs\n"
|
| " * = required\n"
|
| "\n"
|
| "Example\n"
|
| @@ -371,25 +388,26 @@ const char kCreateBundle_Help[] =
|
| "\n"
|
| " executable(\"${app_name}_generate_executable\") {\n"
|
| " forward_variables_from(invoker, \"*\", [\n"
|
| - " \"output_name\",\n"
|
| - " \"visibility\",\n"
|
| - " ])\n"
|
| + " \"output_name\",\n"
|
| + " \"visibility\",\n"
|
| + " ])\n"
|
| " output_name =\n"
|
| " rebase_path(\"$gen_path/$app_name\", root_build_dir)\n"
|
| " }\n"
|
| "\n"
|
| - " bundle_data(\"${app_name}_bundle_executable\") {\n"
|
| - " deps = [ \":${app_name}_generate_executable\" ]\n"
|
| - " sources = [ \"$gen_path/$app_name\" ]\n"
|
| - " outputs = [ \"{{bundle_executable_dir}}/$app_name\" ]\n"
|
| + " code_signing =\n"
|
| + " defined(invoker.code_signing) && invoker.code_signing\n"
|
| + "\n"
|
| + " if (is_ios && !code_signing) {\n"
|
| + " bundle_data(\"${app_name}_bundle_executable\") {\n"
|
| + " deps = [ \":${app_name}_generate_executable\" ]\n"
|
| + " sources = [ \"$gen_path/$app_name\" ]\n"
|
| + " outputs = [ \"{{bundle_executable_dir}}/$app_name\" ]\n"
|
| + " }\n"
|
| " }\n"
|
| "\n"
|
| " create_bundle(\"${app_name}.app\") {\n"
|
| " product_type = \"com.apple.product-type.application\"\n"
|
| - " deps = [\n"
|
| - " \":${app_name}_bundle_executable\",\n"
|
| - " \":${app_name}_bundle_info_plist\",\n"
|
| - " ]\n"
|
| " if (is_ios) {\n"
|
| " bundle_root_dir = \"${root_build_dir}/$target_name\"\n"
|
| " bundle_resources_dir = bundle_root_dir\n"
|
| @@ -401,11 +419,33 @@ const char kCreateBundle_Help[] =
|
| " bundle_executable_dir = bundle_root_dir + \"/MacOS\"\n"
|
| " bundle_plugins_dir = bundle_root_dir + \"/Plugins\"\n"
|
| " }\n"
|
| - " }\n"
|
| - "\n"
|
| - " group(target_name) {\n"
|
| - " forward_variables_from(invoker, [\"visibility\"])\n"
|
| - " deps = [ \":${app_name}.app\" ]\n"
|
| + " deps = [ \":${app_name}_bundle_info_plist\" ]\n"
|
| + " if (is_ios && code_signing) {\n"
|
| + " deps += [ \":${app_name}_generate_executable\" ]\n"
|
| + " code_signing_script = \"//build/config/ios/codesign.py\"\n"
|
| + " code_signing_sources = [\n"
|
| + " invoker.entitlements_path,\n"
|
| + " \"$target_gen_dir/$app_name\",\n"
|
| + " ]\n"
|
| + " code_signing_outputs = [\n"
|
| + " \"$bundle_root_dir/$app_name\",\n"
|
| + " \"$bundle_root_dir/_CodeSignature/CodeResources\",\n"
|
| + " \"$bundle_root_dir/embedded.mobileprovision\",\n"
|
| + " \"$target_gen_dir/$app_name.xcent\",\n"
|
| + " ]\n"
|
| + " code_signing_args = [\n"
|
| + " \"-i=\" + ios_code_signing_identity,\n"
|
| + " \"-b=\" + rebase_path(\n"
|
| + " \"$target_gen_dir/$app_name\", root_build_dir),\n"
|
| + " \"-e=\" + rebase_path(\n"
|
| + " invoker.entitlements_path, root_build_dir),\n"
|
| + " \"-e=\" + rebase_path(\n"
|
| + " \"$target_gen_dir/$app_name.xcent\", root_build_dir),\n"
|
| + " rebase_path(bundle_root_dir, root_build_dir),\n"
|
| + " ]\n"
|
| + " } else {\n"
|
| + " deps += [ \":${app_name}_bundle_executable\" ]\n"
|
| + " }\n"
|
| " }\n"
|
| " }\n"
|
| " }\n";
|
|
|