OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Template to run the tweak_info_plist.py script on a plist. | 5 # Template to run the tweak_info_plist.py script on a plist. |
6 # | 6 # |
7 # Arguments: | 7 # Arguments: |
8 # | 8 # |
9 # info_plist: | 9 # info_plist: |
10 # string, the plist to tweak. | 10 # (optional), string, the plist to tweak. |
| 11 # |
| 12 # info_plists: |
| 13 # (optional), list of string, the plist files to merge and tweak. |
11 # | 14 # |
12 # args: | 15 # args: |
13 # list of string, the arguments to pass to the tweak_info_plist.py | 16 # (optional), list of string, the arguments to pass to the |
14 # script. | 17 # tweak_info_plist.py script. |
15 # | 18 # |
16 # Callers should use get_target_outputs() to get the output name. | 19 # Callers should use get_target_outputs() to get the output name. One of |
| 20 # info_plist or info_plists must be specified. |
17 template("tweak_info_plist") { | 21 template("tweak_info_plist") { |
18 assert(defined(invoker.info_plist), | 22 _output_name = "$target_gen_dir/${target_name}_tweaked.plist" |
19 "The info_plist must be specified in $target_name") | 23 |
20 assert(defined(invoker.args), | 24 if (defined(invoker.info_plists)) { |
21 "The args to tweak_info_plist.py must be specified in $target_name") | 25 assert(!defined(invoker.info_plist), |
| 26 "Cannot have both info_plist and info_plists for $target_name") |
| 27 |
| 28 _source_name = "$target_gen_dir/${target_name}_merged.plist" |
| 29 _deps = [ ":" + target_name + "_merge_plist" ] |
| 30 |
| 31 action(target_name + "_merge_plist") { |
| 32 forward_variables_from(invoker, [ "testonly" ]) |
| 33 script = "//build/config/mac/plist_util.py" |
| 34 sources = invoker.info_plists |
| 35 outputs = [ |
| 36 _source_name, |
| 37 ] |
| 38 args = [ |
| 39 "merge", |
| 40 "-f=xml1", |
| 41 "-o=" + rebase_path(_source_name, root_build_dir), |
| 42 ] + rebase_path(invoker.info_plists, root_build_dir) |
| 43 } |
| 44 } else { |
| 45 assert(defined(invoker.info_plist), |
| 46 "The info_plist must be specified in $target_name") |
| 47 |
| 48 _source_name = invoker.info_plist |
| 49 _deps = [] |
| 50 } |
22 | 51 |
23 action(target_name) { | 52 action(target_name) { |
24 forward_variables_from(invoker, [ "testonly" ]) | 53 forward_variables_from(invoker, |
| 54 [ |
| 55 "args", |
| 56 "testonly", |
| 57 ]) |
25 script = "//build/mac/tweak_info_plist.py" | 58 script = "//build/mac/tweak_info_plist.py" |
26 inputs = [ | 59 inputs = [ |
27 script, | 60 script, |
28 "//build/util/version.py", | 61 "//build/util/version.py", |
29 "//build/util/LASTCHANGE", | 62 "//build/util/LASTCHANGE", |
30 "//chrome/VERSION", | 63 "//chrome/VERSION", |
31 ] | 64 ] |
32 sources = [ | 65 sources = [ |
33 invoker.info_plist, | 66 _source_name, |
34 ] | 67 ] |
35 _output_name = "$target_gen_dir/${target_name}_tweaked.plist" | |
36 outputs = [ | 68 outputs = [ |
37 _output_name, | 69 _output_name, |
38 ] | 70 ] |
39 args = invoker.args + [ | 71 if (!defined(args)) { |
40 "--plist", | 72 args = [] |
41 rebase_path(invoker.info_plist, root_build_dir), | 73 } |
42 "--output", | 74 args += [ |
43 rebase_path(_output_name, root_build_dir), | 75 "--plist", |
44 ] | 76 rebase_path(_source_name, root_build_dir), |
| 77 "--output", |
| 78 rebase_path(_output_name, root_build_dir), |
| 79 "--platform=$current_os", |
| 80 ] |
| 81 deps = _deps |
45 } | 82 } |
46 } | 83 } |
OLD | NEW |