Index: chrome/version.gni |
diff --git a/chrome/version.gni b/chrome/version.gni |
index cc8d96a4c665d7f99bd2d8dc4f262dfe80a862b4..b956e9c38e5084fae3b4569c86d3ba88d36412fb 100644 |
--- a/chrome/version.gni |
+++ b/chrome/version.gni |
@@ -6,28 +6,48 @@ |
# an output file. This is used for generating various forms of files that |
# incorporate the product name and version. |
# |
-# This template automatically includes VERSION, LASTCHANGE, and BRANDING, |
+# This template automatically includes VERSION, LASTCHANGE, and BRANDING. It |
+# automatically uses the template file . |
+# GYP parameterizes this template file but all current invocations use this |
+# same one. If in the future we need to set it, this should be added as an |
+# optional argument. |
+# |
+# In GYP this is a rule that runs once per ".ver" file. In GN this just |
+# processes one file per invocation of the template so you may have to have |
+# multiple targets. |
+# |
+# You must specify either sources or a template_file, or both. |
# |
# Parameters: |
-# source: |
-# File name of source template file to read. |
+# sources (optional): |
+# List of file names to read. When converting a GYP target, this should |
+# list the 'source' (see above) as well as any extra_variable_files. |
# |
# output: |
-# File name of file to write. |
+# File name of file to write. In GYP this is unspecified and it will |
+# make up a file name for you based on the input name, and tack on |
+# "_version.rc" to the end. But in GN you need to specify the full name. |
+# |
+# template_file (optional): |
+# Template file to use (not a list). Defaults to |
+# //chrome/app/chrome_version.rc.version if unspecified. |
# |
# extra_args (optional): |
-# Extra arguments to pass to version.py. |
+# Extra arguments to pass to version.py. Any "-f <filename>" args should |
+# use sources instead. |
# |
# visibility (optional) |
# |
# Example: |
# process_version("myversion") { |
-# source = "myfile.h.in" |
+# sources = [ "myfile.h.in" ] |
# output = "$target_gen_dir/myfile.h" |
# extra_args = ["-e", "FOO=42"] |
+# extra_files = [ "foo/BRANDING" ] |
# } |
template("process_version") { |
- assert(defined(invoker.source), "Source must be defined for $target_name") |
+ assert(defined(invoker.sources) || defined(invoker.template_file), |
+ "Either sources or template_file must be defined for $target_name") |
assert(defined(invoker.output), "Output must be defined for $target_name") |
action(target_name) { |
@@ -43,33 +63,49 @@ template("process_version") { |
} else { |
branding_path = "//chrome/app/theme/chromium/BRANDING" |
} |
+ if (defined(invoker.template_file)) { |
+ template_path = invoker.template_file |
+ } else { |
+ template_path = "//chrome/app/chrome_version.rc.version" |
+ } |
inputs = [ |
version_path, |
- invoker.source, |
lastchange_path, |
branding_path, |
+ template_path, |
] |
outputs = [ |
invoker.output, |
] |
- args = [ |
+ args = [] |
+ |
+ if (defined(invoker.sources)) { |
+ inputs += invoker.sources |
+ foreach(i, invoker.sources) { |
+ args += [ |
+ "-f", |
+ rebase_path(i, root_build_dir), |
+ ] |
+ } |
+ } |
+ |
+ args += [ |
"-f", |
rebase_path(version_path, root_build_dir), |
"-f", |
rebase_path(branding_path, root_build_dir), |
"-f", |
rebase_path(lastchange_path, root_build_dir), |
- "-i", |
- rebase_path(invoker.source, root_build_dir), |
- "-o", |
- rebase_path(invoker.output, root_build_dir), |
] |
- |
if (defined(invoker.extra_args)) { |
args += invoker.extra_args |
} |
+ args += [ |
+ rebase_path(template_path, root_build_dir), |
+ rebase_path(invoker.output, root_build_dir), |
+ ] |
} |
} |