OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 declare_args() { |
| 6 # Absolute path to a resource whitelist (generated using |
| 7 # //tools/resources/find_used_resources.py). |
| 8 repack_whitelist = "" |
| 9 } |
| 10 |
5 # This file defines a template to invoke grit repack in a consistent manner. | 11 # This file defines a template to invoke grit repack in a consistent manner. |
6 # | 12 # |
7 # Parameters: | 13 # Parameters: |
8 # sources [required] | 14 # sources [required] |
9 # List of pak files that need to be combined. | 15 # List of pak files that need to be combined. |
10 # | 16 # |
11 # output [required] | 17 # output [required] |
12 # File name (single string) of the output file. | 18 # File name (single string) of the output file. |
13 # | 19 # |
14 # repack_options [optional] | |
15 # List of extra arguments to pass. | |
16 # | |
17 # deps [optional] | 20 # deps [optional] |
18 # visibility [optional] | 21 # visibility [optional] |
19 # Normal meaning. | 22 # Normal meaning. |
20 template("repack") { | 23 template("repack") { |
21 action(target_name) { | 24 action(target_name) { |
22 assert(defined(invoker.sources), "Need sources for $target_name") | 25 assert(defined(invoker.sources), "Need sources for $target_name") |
23 assert(defined(invoker.output), "Need output for $target_name") | 26 assert(defined(invoker.output), "Need output for $target_name") |
24 | 27 |
25 if (defined(invoker.visibility)) { | 28 if (defined(invoker.visibility)) { |
26 visibility = invoker.visibility | 29 visibility = invoker.visibility |
27 } | 30 } |
28 | 31 |
29 script = "//tools/grit/grit/format/repack.py" | 32 script = "//tools/grit/grit/format/repack.py" |
30 | 33 |
31 inputs = invoker.sources | 34 inputs = invoker.sources |
32 outputs = [ | 35 outputs = [ |
33 invoker.output, | 36 invoker.output, |
34 ] | 37 ] |
35 | 38 |
36 args = [] | 39 args = [] |
37 if (defined(invoker.repack_options)) { | 40 if (repack_whitelist != "") { |
38 args += invoker.repack_options | 41 assert( |
| 42 repack_whitelist == rebase_path(repack_whitelist), |
| 43 "repack_whitelist must be an absolute path. Current value is $repack_w
hitelist") |
| 44 args += [ "--whitelist=$repack_whitelist" ] |
39 } | 45 } |
40 args += [ rebase_path(invoker.output, root_build_dir) ] | 46 args += [ rebase_path(invoker.output, root_build_dir) ] |
41 args += rebase_path(invoker.sources, root_build_dir) | 47 args += rebase_path(invoker.sources, root_build_dir) |
42 | 48 |
43 if (defined(invoker.deps)) { | 49 if (defined(invoker.deps)) { |
44 deps = invoker.deps | 50 deps = invoker.deps |
45 } | 51 } |
46 } | 52 } |
47 } | 53 } |
OLD | NEW |