Chromium Code Reviews| Index: build/config/mac/rules.gni |
| diff --git a/build/config/mac/rules.gni b/build/config/mac/rules.gni |
| index 2105afa790bf46753be9eb3f7fea28e13d9e5630..f616af51bd8d7d8fb5f723ca1f036892e4a0be62 100644 |
| --- a/build/config/mac/rules.gni |
| +++ b/build/config/mac/rules.gni |
| @@ -20,6 +20,19 @@ import("//build/config/mac/base_rules.gni") |
| # (optional) string array, 'key=value' pairs for extra fields which are |
| # specified in a source Info.plist template. |
| template("mac_info_plist") { |
| + assert( |
| + (defined(invoker.info_plist) || defined(invoker.info_plist_target)) && |
|
sdefresne
2016/04/29 18:23:18
Can't this be expressed more simply by "defined(in
Robert Sesek
2016/05/02 16:53:54
Ah, yes, that's better.
|
| + !(defined(invoker.info_plist) && defined(invoker.info_plist_target)), |
| + "Only one of info_plist or info_plist_target may be specified in " + |
| + target_name) |
| + |
| + if (defined(invoker.info_plist)) { |
| + _info_plist = invoker.info_plist |
| + } else { |
| + _info_plist_target_output = get_target_outputs(invoker.info_plist_target) |
| + _info_plist = _info_plist_target_output[0] |
| + } |
| + |
| info_plist(target_name) { |
| format = "xml1" |
| extra_substitutions = [] |
| @@ -32,9 +45,18 @@ template("mac_info_plist") { |
| ] |
| plist_templates = [ |
| "//build/config/mac/BuildInfo.plist", |
| - invoker.info_plist, |
| + _info_plist, |
| ] |
| - forward_variables_from(invoker, [ "executable_name" ]) |
| + if (defined(invoker.info_plist_target)) { |
| + deps = [ |
| + invoker.info_plist_target, |
| + ] |
| + } |
| + forward_variables_from(invoker, |
| + [ |
| + "testonly", |
| + "executable_name", |
| + ]) |
| } |
| } |
| @@ -103,6 +125,11 @@ template("mac_xib_bundle_data") { |
| # info_plist: |
| # string, path to the Info.plist file that will be used for the bundle. |
|
sdefresne
2016/04/29 18:23:18
nit: info_plist is now also optional, isn't it?
Robert Sesek
2016/05/02 16:53:54
Done.
|
| # |
| +# info_plist_target: |
| +# (optional) string, if the info_plist is generated from an action, |
| +# rather than a regular source file, specify the target name in lieu |
| +# of info_plist. The two arguments are mutually exclusive. |
| +# |
| # output_name: |
| # (optional) string, name of the generated framework without the |
| # .framework suffix. If omitted, defaults to target_name. |
| @@ -118,7 +145,7 @@ template("mac_xib_bundle_data") { |
| template("mac_framework_bundle") { |
| assert(defined(invoker.deps), |
| "Dependencies must be specified for $target_name") |
| - assert(defined(invoker.info_plist), |
| + assert(defined(invoker.info_plist) || defined(invoker.info_plist_target), |
| "The Info.plist file must be specified for $target_name") |
| _info_plist_target = target_name + "_info_plist" |
| @@ -128,7 +155,12 @@ template("mac_framework_bundle") { |
| if (defined(invoker.output_name)) { |
| executable_name = invoker.output_name |
| } |
| - forward_variables_from(invoker, [ "info_plist" ]) |
| + forward_variables_from(invoker, |
| + [ |
| + "testonly", |
| + "info_plist", |
| + "info_plist_target", |
| + ]) |
| } |
| _info_plist_bundle_data = _info_plist_target + "_bundle_data" |
| @@ -161,11 +193,16 @@ template("mac_framework_bundle") { |
| # info_plist: |
| # string, path to the Info.plist file that will be used for the bundle. |
|
sdefresne
2016/04/29 18:23:18
ditto
Robert Sesek
2016/05/02 16:53:54
Done.
|
| # |
| +# info_plist_target: |
| +# (optional) string, if the info_plist is generated from an action, |
| +# rather than a regular source file, specify the target name in lieu |
| +# of info_plist. The two arguments are mutually exclusive. |
| +# |
| # output_name: |
| # (optional) string, name of the generated app without the |
| # .app suffix. If omitted, defaults to target_name. |
| template("mac_app_bundle") { |
| - assert(defined(invoker.info_plist), |
| + assert(defined(invoker.info_plist) || defined(invoker.info_plist_target), |
|
sdefresne
2016/04/29 18:23:18
Shouldn't it be the same mutually exclusive test t
Robert Sesek
2016/05/02 16:53:54
Does it make sense to duplicate that check? The ma
sdefresne
2016/05/03 07:12:17
I wanted to say that we should either do the same
Robert Sesek
2016/05/03 13:44:27
Agreed on your reasoning. Removed the checks in fa
|
| "The Info.plist file must be specified for $target_name") |
| _target_name = target_name |
| @@ -177,6 +214,18 @@ template("mac_app_bundle") { |
| _executable_target = target_name + "_executable" |
| _executable_bundle_data = _executable_target + "_bundle_data" |
| + _info_plist_target = target_name + "_info_plist" |
| + |
| + mac_info_plist(_info_plist_target) { |
| + executable_name = _output_name |
| + forward_variables_from(invoker, |
| + [ |
| + "testonly", |
| + "info_plist", |
| + "info_plist_target", |
| + ]) |
| + } |
| + |
| executable(_executable_target) { |
| visibility = [ ":$_executable_bundle_data" ] |
| forward_variables_from(invoker, |
| @@ -206,13 +255,6 @@ template("mac_app_bundle") { |
| ] |
| } |
| - _info_plist_target = target_name + "_info_plist" |
| - |
| - mac_info_plist(_info_plist_target) { |
| - executable_name = _output_name |
| - forward_variables_from(invoker, [ "info_plist" ]) |
| - } |
| - |
| _info_plist_bundle_data = _info_plist_target + "_bundle_data" |
| bundle_data(_info_plist_bundle_data) { |