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
3 # found in the LICENSE file.
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
7 # incorporate the product name and version.
9 # This template automatically includes VERSION, LASTCHANGE, and BRANDING,
13 # File name of source template file to read.
16 # File name of file to write.
18 # extra_args (optional):
19 # Extra arguments to pass to version.py.
21 # visibility (optional)
24 # process_version("myversion") {
25 # source = "myfile.h.in"
26 # output = "$target_gen_dir/myfile.h"
27 # extra_args = ["-e", "FOO=42"]
29 template("process_version") {
30 assert(defined(invoker.source), "Source must be defined for $target_name")
31 assert(defined(invoker.output), "Output must be defined for $target_name")
34 if (defined(invoker.visibility)) {
35 visibility = invoker.visibility
37 script = "//build/util/version.py"
39 lastchange_path = "//build/util/LASTCHANGE"
40 version_path = "//chrome/VERSION"
41 if (is_chrome_branded) {
42 branding_path = "//chrome/app/theme/google_chrome/BRANDING"
44 branding_path = "//chrome/app/theme/chromium/BRANDING"
60 rebase_path(version_path, root_build_dir),
62 rebase_path(branding_path, root_build_dir),
64 rebase_path(lastchange_path, root_build_dir),
66 rebase_path(invoker.source, root_build_dir),
68 rebase_path(invoker.output, root_build_dir),
71 if (defined(invoker.extra_args)) {
72 args += invoker.extra_args