Index: build/config/ios/rules.gni |
diff --git a/build/config/ios/rules.gni b/build/config/ios/rules.gni |
index cf2548f1bfbc2999dd45695702ee483237faf819..59233360a81805ce95b4872111fd61fcec440c9a 100644 |
--- a/build/config/ios/rules.gni |
+++ b/build/config/ios/rules.gni |
@@ -157,6 +157,16 @@ template("lipo_binary") { |
# (optional) boolean, control whether code signing is enabled or not, |
# default to ios_enable_code_signing if not defined. |
# |
+# entitlements_path: |
+# (optional) path to the template to use to generate the application |
+# entitlements by performing variable substitutions, defaults to |
+# //build/config/ios/entitlements.plist. |
+# |
+# entitlements_target: |
+# (optional) label of the target generating the application |
+# entitlements (must generate a single file as output); cannot be |
+# defined if entitlements_path is set. |
+# |
template("create_signed_bundle") { |
assert(defined(invoker.product_type), |
"product_type must be defined for $target_name") |
@@ -180,9 +190,19 @@ template("create_signed_bundle") { |
_bundle_extension = invoker.bundle_extension |
_bundle_root_dir = "$root_out_dir/$_output_name$_bundle_extension" |
- _entitlements_path = "//build/config/ios/entitlements.plist" |
- if (defined(invoker.entitlements_path)) { |
- _entitlements_path = invoker.entitlements_path |
+ if (!defined(invoker.entitlements_target)) { |
+ _entitlements_path = "//build/config/ios/entitlements.plist" |
+ if (defined(invoker.entitlements_path)) { |
+ _entitlements_path = invoker.entitlements_path |
+ } |
+ } else { |
+ assert(!defined(invoker.entitlements_path), |
+ "Cannot define both entitlements_path and entitlements_target " + |
+ "for $target_name") |
+ |
+ _entitlements_target_outputs = |
+ get_target_outputs(invoker.entitlements_target) |
+ _entitlements_path = _entitlements_target_outputs[0] |
} |
_enable_code_signing = ios_enable_code_signing |
@@ -219,6 +239,12 @@ template("create_signed_bundle") { |
} |
deps += invoker.bundle_deps |
} |
+ if (defined(invoker.entitlements_target)) { |
+ if (!defined(deps)) { |
+ deps = [] |
+ } |
+ deps += [ invoker.entitlements_target ] |
+ } |
code_signing_script = "//build/config/ios/codesign.py" |
code_signing_sources = [ |
@@ -369,6 +395,11 @@ template("ios_info_plist") { |
# entitlements by performing variable substitutions, defaults to |
# //build/config/ios/entitlements.plist. |
# |
+# entitlements_target: |
+# (optional) label of the target generating the application |
+# entitlements (must generate a single file as output); cannot be |
+# defined if entitlements_path is set. |
+# |
# bundle_extension: |
# (optional) bundle extension including the dot, default to ".app". |
# |
@@ -402,6 +433,7 @@ template("ios_app_bundle") { |
"bundle_extension", |
"enable_code_signing", |
"entitlements_path", |
+ "entitlements_target", |
"extra_substitutions", |
"extra_system_frameworks", |
"info_plist", |
@@ -430,6 +462,7 @@ template("ios_app_bundle") { |
"bundle_extension", |
"enable_code_signing", |
"entitlements_path", |
+ "entitlements_target", |
"extra_substitutions", |
"extra_system_frameworks", |
"info_plist", |
@@ -539,9 +572,19 @@ template("ios_app_bundle") { |
} |
if (current_toolchain == default_toolchain) { |
- _entitlements_path = "//build/config/ios/entitlements.plist" |
- if (defined(invoker.entitlements_path)) { |
- _entitlements_path = invoker.entitlements_path |
+ if (!defined(invoker.entitlements_target)) { |
+ _entitlements_path = "//build/config/ios/entitlements.plist" |
+ if (defined(invoker.entitlements_path)) { |
+ _entitlements_path = invoker.entitlements_path |
+ } |
+ } else { |
+ assert(!defined(invoker.entitlements_path), |
+ "Cannot define both entitlements_path and entitlements_target" + |
+ "for $_target_name") |
+ |
+ _entitlements_target_outputs = |
+ get_target_outputs(invoker.entitlements_target) |
+ _entitlements_path = _entitlements_target_outputs[0] |
} |
action(_generate_entitlements_target) { |
@@ -552,6 +595,9 @@ template("ios_app_bundle") { |
deps = [ |
":$_generate_info_plist", |
] |
+ if (defined(invoker.entitlements_target)) { |
+ deps += [ invoker.entitlements_target ] |
+ } |
sources = [ |
_entitlements_path, |
_info_plist_path, |
@@ -598,6 +644,7 @@ template("ios_app_bundle") { |
"deps", |
"enable_code_signing", |
"entitlements_path", |
+ "entitlements_target", |
"extra_system_frameworks", |
"product_type", |
"public_configs", |