Index: build/mac/tweak_info_plist.gni |
diff --git a/build/mac/tweak_info_plist.gni b/build/mac/tweak_info_plist.gni |
index d24a95d2ef7163de0e5424670fc9aeae64dfa7ce..505f5e50ab75942e6504bb5fe377b17da51be9c9 100644 |
--- a/build/mac/tweak_info_plist.gni |
+++ b/build/mac/tweak_info_plist.gni |
@@ -7,21 +7,54 @@ |
# Arguments: |
# |
# info_plist: |
-# string, the plist to tweak. |
+# (optional), string, the plist to tweak. |
+# |
+# info_plists: |
+# (optional), list of string, the plist files to merge and tweak. |
# |
# args: |
-# list of string, the arguments to pass to the tweak_info_plist.py |
-# script. |
+# (optional), list of string, the arguments to pass to the |
+# tweak_info_plist.py script. |
# |
-# Callers should use get_target_outputs() to get the output name. |
+# Callers should use get_target_outputs() to get the output name. One of |
+# info_plist or info_plists must be specified. |
template("tweak_info_plist") { |
- assert(defined(invoker.info_plist), |
- "The info_plist must be specified in $target_name") |
- assert(defined(invoker.args), |
- "The args to tweak_info_plist.py must be specified in $target_name") |
+ _output_name = "$target_gen_dir/${target_name}_tweaked.plist" |
+ |
+ if (defined(invoker.info_plists)) { |
+ assert(!defined(invoker.info_plist), |
+ "Cannot have both info_plist and info_plists for $target_name") |
+ |
+ _source_name = "$target_gen_dir/${target_name}_merged.plist" |
+ _deps = [ ":" + target_name + "_merge_plist" ] |
+ |
+ action(target_name + "_merge_plist") { |
+ forward_variables_from(invoker, [ "testonly" ]) |
+ script = "//build/config/mac/plist_util.py" |
+ sources = invoker.info_plists |
+ outputs = [ |
+ _source_name, |
+ ] |
+ args = [ |
+ "merge", |
+ "-f=xml1", |
+ "-o=" + rebase_path(_source_name, root_build_dir), |
+ ] + rebase_path(invoker.info_plists, root_build_dir) |
+ } |
+ } else { |
+ assert(defined(invoker.info_plist), |
+ "The info_plist must be specified in $target_name") |
+ |
+ _source_name = invoker.info_plist |
+ _deps = [] |
+ } |
action(target_name) { |
- forward_variables_from(invoker, [ "testonly" ]) |
+ forward_variables_from(invoker, |
+ [ |
+ "args", |
+ "testonly", |
+ ]) |
script = "//build/mac/tweak_info_plist.py" |
inputs = [ |
script, |
@@ -30,17 +63,21 @@ template("tweak_info_plist") { |
"//chrome/VERSION", |
] |
sources = [ |
- invoker.info_plist, |
+ _source_name, |
] |
- _output_name = "$target_gen_dir/${target_name}_tweaked.plist" |
outputs = [ |
_output_name, |
] |
- args = invoker.args + [ |
- "--plist", |
- rebase_path(invoker.info_plist, root_build_dir), |
- "--output", |
- rebase_path(_output_name, root_build_dir), |
- ] |
+ if (!defined(args)) { |
+ args = [] |
+ } |
+ args += [ |
+ "--plist", |
+ rebase_path(_source_name, root_build_dir), |
+ "--output", |
+ rebase_path(_output_name, root_build_dir), |
+ "--platform=$current_os", |
+ ] |
+ deps = _deps |
} |
} |