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 # Runs the version processing script over the given template file to produce | 5 # Runs the version processing script over the given template file to produce |
6 # an output file. This is used for generating various forms of files that | 6 # an output file. This is used for generating various forms of files that |
7 # incorporate the product name and version. | 7 # incorporate the product name and version. |
8 # | 8 # |
9 # This template automatically includes VERSION, LASTCHANGE, and BRANDING, | 9 # This template automatically includes VERSION, LASTCHANGE, and BRANDING, |
10 # | 10 # |
11 # Parameters: | 11 # Parameters: |
12 # source: | 12 # source: |
13 # File name of source template file to read. | 13 # File name of source template file to read. |
14 # | 14 # |
15 # output: | 15 # output: |
16 # File name of file to write. | 16 # File name of file to write. |
17 # | 17 # |
18 # extra_args: | |
19 # Extra arguments to pass to version.py. | |
20 # | |
18 # visibility (optional) | 21 # visibility (optional) |
19 # | 22 # |
20 # Example: | 23 # Example: |
21 # process_version("myversion") { | 24 # process_version("myversion") { |
22 # source = "myfile.h.in" | 25 # source = "myfile.h.in" |
23 # output = "$target_gen_dir/myfile.h" | 26 # output = "$target_gen_dir/myfile.h" |
27 # extra_args = ["-e", "FOO=42"] | |
24 # } | 28 # } |
25 template("process_version") { | 29 template("process_version") { |
26 assert(defined(invoker.source), "Source must be defined for $target_name") | 30 assert(defined(invoker.source), "Source must be defined for $target_name") |
27 assert(defined(invoker.output), "Output must be defined for $target_name") | 31 assert(defined(invoker.output), "Output must be defined for $target_name") |
28 | 32 |
29 action(target_name) { | 33 action(target_name) { |
30 if (defined(invoker.visibility)) { | 34 if (defined(invoker.visibility)) { |
31 visibility = invoker.visibility | 35 visibility = invoker.visibility |
32 } | 36 } |
33 script = "//build/util/version.py" | 37 script = "//build/util/version.py" |
34 | 38 |
35 lastchange_path = "//build/util/LASTCHANGE" | 39 lastchange_path = "//build/util/LASTCHANGE" |
36 version_path = "//chrome/VERSION" | 40 version_path = "//chrome/VERSION" |
37 if (is_chrome_branded) { | 41 if (is_chrome_branded) { |
38 branding_path = "//chrome/app/theme/google_chrome/BRANDING" | 42 branding_path = "//chrome/app/theme/google_chrome/BRANDING" |
39 } else { | 43 } else { |
40 branding_path = "//chrome/app/theme/chromium/BRANDING" | 44 branding_path = "//chrome/app/theme/chromium/BRANDING" |
41 } | 45 } |
42 | 46 |
47 extra_args = [] | |
48 if (defined(invoker.extra_args)) { | |
49 extra_args = invoker.extra_args | |
50 } | |
51 | |
43 inputs = [ | 52 inputs = [ |
44 version_path, | 53 version_path, |
45 invoker.source, | 54 invoker.source, |
46 lastchange_path, | 55 lastchange_path, |
47 branding_path, | 56 branding_path, |
48 ] | 57 ] |
49 | 58 |
50 outputs = [ invoker.output ] | 59 outputs = [ invoker.output ] |
51 | 60 |
52 args = [ | 61 args = [ |
53 "-f", rebase_path(version_path, root_build_dir), | 62 "-f", rebase_path(version_path, root_build_dir), |
54 "-f", rebase_path(branding_path, root_build_dir), | 63 "-f", rebase_path(branding_path, root_build_dir), |
55 "-f", rebase_path(lastchange_path, root_build_dir), | 64 "-f", rebase_path(lastchange_path, root_build_dir), |
56 rebase_path(invoker.source, root_build_dir), | 65 "-i", rebase_path(invoker.source, root_build_dir), |
57 rebase_path(invoker.output, root_build_dir), | 66 "-o", rebase_path(invoker.output, root_build_dir), |
58 ] | 67 ] + extra_args |
brettw
2014/10/29 20:46:36
I'd just move the if down below here and avoid the
newt (away)
2014/10/29 21:04:19
Good point. Done.
| |
59 } | 68 } |
60 } | 69 } |
OLD | NEW |