Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1080)

Unified Diff: chrome/version.gni

Issue 949233003: Fix official build in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@random
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/version.gni
diff --git a/chrome/version.gni b/chrome/version.gni
index cc8d96a4c665d7f99bd2d8dc4f262dfe80a862b4..457c6713144c375f5a7079228e000a0d161ea2e3 100644
--- a/chrome/version.gni
+++ b/chrome/version.gni
@@ -6,28 +6,46 @@
# 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.
#
# Parameters:
-# source:
-# File name of source template file to read.
+# sources (optional):
+# List of file names to read. In GYP, 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"
Dirk Pranke 2015/02/25 00:23:19 Nit: you have two leading quotes and a missing end
# 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),
+ "sources or template_file must be defined for $target_name")
Dirk Pranke 2015/02/25 00:23:19 It's not actually clear in the docs above that you
assert(defined(invoker.output), "Output must be defined for $target_name")
action(target_name) {
@@ -43,28 +61,40 @@ 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
Dirk Pranke 2015/02/25 00:23:19 nit: should there be a trailing comma?
]
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(template_path, root_build_dir),
rebase_path(invoker.output, root_build_dir),
]

Powered by Google App Engine
This is Rietveld 408576698