Commit dc683d2a authored by raphael.kubo.da.costa's avatar raphael.kubo.da.costa Committed by Commit bot

gn: Generalize process_version() and move it to build/util (take #2)

(Compared to https://codereview.chromium.org/2308313003/, this version
fixes chrome/installer/linux/BUILD.gn by including all required files)

There is nothing really chrome-specific in the process_version()
template, and if we stop always passing some files in chrome/ on every
invocation it is possible to generalize it and move it to build/util
instead (and fix some layering violation comments along the way).

Compared to its previous incarnation, process_version() no longer passes
LASTCHANGE, BRANDING and VERSION automatically to version.py. This makes
it easier for callers to specify their own |sources| with values that
may override those set in those 3 files.

A new wrapper, process_version_rc_template(), was introduced to cater
for callers (generally Windows ones) who need to process a .rc.version
file that requires the values from LASTCHANGE, BRANDING and VERSION. It
always passes those 3 files to process_version() before any optional
additional |sources|, and |template_file| defaults to
chrome_version.rc.version.
Since this template depends on files from //chrome, it lives in the
newly-added //chrome/process_version_rc_template.gni.

R=dpranke@chromium.org,brettw@chromium.org,phajdan.jr@chromium.org,ddorwin@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win10_chromium_x64_rel_ng

Review-Url: https://codereview.chromium.org/2341673003
Cr-Commit-Position: refs/heads/master@{#419377}
parent 5c433826
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/version.gni") import("//build/util/process_version.gni")
process_version("version") { process_version("version") {
sources = [
"//chrome/VERSION",
]
template_file = "aw_version_info_values.h.version" template_file = "aw_version_info_values.h.version"
output = "$root_gen_dir/android_webview/common/aw_version_info_values.h" output = "$root_gen_dir/android_webview/common/aw_version_info_values.h"
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/version.gni") import("//build/util/process_version.gni")
import("//testing/test.gni") import("//testing/test.gni")
component("common") { component("common") {
...@@ -82,6 +82,9 @@ source_set("unit_tests") { ...@@ -82,6 +82,9 @@ source_set("unit_tests") {
} }
process_version("protocol_version") { process_version("protocol_version") {
sources = [
"//chrome/VERSION",
]
template_file = "protocol_version.h.version" template_file = "protocol_version.h.version"
output = "$target_gen_dir/protocol_version.h" output = "$target_gen_dir/protocol_version.h"
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/chrome_build.gni")
# Runs the version processing script over the given template file to produce # Runs the version processing script over the given template file to produce
# an output file. This is used for generating various forms of files that # an output file. This is used for generating various forms of files that
# incorporate the product name and version. # incorporate the product name and version.
...@@ -11,12 +9,6 @@ import("//build/config/chrome_build.gni") ...@@ -11,12 +9,6 @@ import("//build/config/chrome_build.gni")
# Unlike GYP, this will actually compile the resulting file, so you don't need # Unlike GYP, this will actually compile the resulting file, so you don't need
# to add it separately to the sources, just depend on the target. # to add it separately to the sources, just depend on the target.
# #
# 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 # 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 # processes one file per invocation of the template so you may have to have
# multiple targets. # multiple targets.
...@@ -25,6 +17,7 @@ import("//build/config/chrome_build.gni") ...@@ -25,6 +17,7 @@ import("//build/config/chrome_build.gni")
# sources (optional): # sources (optional):
# List of file names to read. When converting a GYP target, this should # 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. # list the 'source' (see above) as well as any extra_variable_files.
# The files will be passed to version.py in the order specified here.
# #
# output: # output:
# File name of file to write. In GYP this is unspecified and it will # File name of file to write. In GYP this is unspecified and it will
...@@ -33,8 +26,7 @@ import("//build/config/chrome_build.gni") ...@@ -33,8 +26,7 @@ import("//build/config/chrome_build.gni")
# #
# template_file (optional): # template_file (optional):
# Template file to use (not a list). Most Windows uses for generating # Template file to use (not a list). Most Windows uses for generating
# resources will want to specify the chrome_version_rc_template defined # resources will want to use process_version_rc_template() instead.
# below.
# #
# extra_args (optional): # extra_args (optional):
# Extra arguments to pass to version.py. Any "-f <filename>" args should # Extra arguments to pass to version.py. Any "-f <filename>" args should
...@@ -49,10 +41,12 @@ import("//build/config/chrome_build.gni") ...@@ -49,10 +41,12 @@ import("//build/config/chrome_build.gni")
# #
# Example: # Example:
# process_version("myversion") { # process_version("myversion") {
# sources = [ "myfile.h.in" ] # sources = [
# "//chrome/VERSION"
# "myfile.h.in"
# ]
# output = "$target_gen_dir/myfile.h" # output = "$target_gen_dir/myfile.h"
# extra_args = ["-e", "FOO=42"] # extra_args = [ "-e", "FOO=42" ]
# extra_files = [ "foo/BRANDING" ]
# } # }
template("process_version") { template("process_version") {
assert(defined(invoker.output), "Output must be defined for $target_name") assert(defined(invoker.output), "Output must be defined for $target_name")
...@@ -69,19 +63,7 @@ template("process_version") { ...@@ -69,19 +63,7 @@ template("process_version") {
action(action_name) { action(action_name) {
script = "//build/util/version.py" script = "//build/util/version.py"
lastchange_path = "//build/util/LASTCHANGE" inputs = []
version_path = "//chrome/VERSION"
if (is_chrome_branded) {
branding_path = "//chrome/app/theme/google_chrome/BRANDING"
} else {
branding_path = "//chrome/app/theme/chromium/BRANDING"
}
inputs = [
version_path,
lastchange_path,
branding_path,
]
if (defined(invoker.inputs)) { if (defined(invoker.inputs)) {
inputs += invoker.inputs inputs += invoker.inputs
} }
...@@ -109,14 +91,6 @@ template("process_version") { ...@@ -109,14 +91,6 @@ template("process_version") {
} }
} }
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),
]
if (defined(invoker.extra_args)) { if (defined(invoker.extra_args)) {
args += invoker.extra_args args += invoker.extra_args
} }
...@@ -149,5 +123,3 @@ template("process_version") { ...@@ -149,5 +123,3 @@ template("process_version") {
} }
} }
} }
chrome_version_rc_template = "//chrome/app/chrome_version.rc.version"
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# #
# PREFER NOT TO USE THESE. The GYP build uses this kind of thing extensively. # PREFER NOT TO USE THESE. The GYP build uses this kind of thing extensively.
# However, it is far better to write an action (or use the process_version # However, it is far better to write an action (or use the process_version
# wrapper in chrome/version.gni) to generate a file at build-time with the # wrapper in build/util/version.gni) to generate a file at build-time with the
# information you need. This allows better dependency checking and GN will # information you need. This allows better dependency checking and GN will
# run faster. # run faster.
# #
......
...@@ -13,7 +13,7 @@ import("//build/config/win/console_app.gni") ...@@ -13,7 +13,7 @@ import("//build/config/win/console_app.gni")
import("//build/config/win/manifest.gni") import("//build/config/win/manifest.gni")
import("//chrome/chrome_paks.gni") import("//chrome/chrome_paks.gni")
import("//chrome/common/features.gni") import("//chrome/common/features.gni")
import("//chrome/version.gni") import("//chrome/process_version_rc_template.gni")
import("//third_party/widevine/cdm/widevine.gni") import("//third_party/widevine/cdm/widevine.gni")
import("//ui/base/ui_features.gni") import("//ui/base/ui_features.gni")
import("//v8/gni/v8.gni") import("//v8/gni/v8.gni")
...@@ -1191,16 +1191,14 @@ group("child_dependencies") { ...@@ -1191,16 +1191,14 @@ group("child_dependencies") {
} }
if (is_win) { if (is_win) {
process_version("chrome_exe_version") { process_version_rc_template("chrome_exe_version") {
template_file = chrome_version_rc_template
sources = [ sources = [
"app/chrome_exe.ver", "app/chrome_exe.ver",
] ]
output = "$target_gen_dir/chrome_exe_version.rc" output = "$target_gen_dir/chrome_exe_version.rc"
} }
process_version("chrome_dll_version") { process_version_rc_template("chrome_dll_version") {
template_file = chrome_version_rc_template
sources = [ sources = [
"app/chrome_dll.ver", "app/chrome_dll.ver",
] ]
...@@ -1216,16 +1214,14 @@ if (is_win) { ...@@ -1216,16 +1214,14 @@ if (is_win) {
type = "dll" type = "dll"
} }
process_version("nacl64_exe_version") { process_version_rc_template("nacl64_exe_version") {
template_file = chrome_version_rc_template
sources = [ sources = [
"app/nacl64_exe.ver", "app/nacl64_exe.ver",
] ]
output = "$target_gen_dir/nacl64_exe_version.rc" output = "$target_gen_dir/nacl64_exe_version.rc"
} }
process_version("other_version") { process_version_rc_template("other_version") {
template_file = chrome_version_rc_template
sources = [ sources = [
"app/other.ver", "app/other.ver",
] ]
......
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
import("//build/config/android/config.gni") import("//build/config/android/config.gni")
import("//build/config/android/rules.gni") import("//build/config/android/rules.gni")
import("//build/util/process_version.gni")
import("//build_overrides/v8.gni") import("//build_overrides/v8.gni")
import("//chrome/android/chrome_public_apk_tmpl.gni") import("//chrome/android/chrome_public_apk_tmpl.gni")
import("//chrome/common/features.gni") import("//chrome/common/features.gni")
import("//chrome/version.gni") import("//chrome/process_version_rc_template.gni") # For branding_file_path.
import("//testing/test.gni") import("//testing/test.gni")
import("//third_party/icu/config.gni") import("//third_party/icu/config.gni")
import("//third_party/protobuf/proto_library.gni") import("//third_party/protobuf/proto_library.gni")
...@@ -377,6 +378,10 @@ chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java" ...@@ -377,6 +378,10 @@ chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java"
chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java" chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java"
process_version("chrome_version_java") { process_version("chrome_version_java") {
template_file = "java/ChromeVersionConstants.java.version" template_file = "java/ChromeVersionConstants.java.version"
sources = [
"//chrome/VERSION",
branding_file_path,
]
output = chrome_version_java_file output = chrome_version_java_file
extra_args = [ extra_args = [
"-e", "-e",
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/win/manifest.gni") import("//build/config/win/manifest.gni")
import("//build/util/process_version.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//chrome/version.gni")
version_assembly_output_file = "$target_gen_dir/version_assembly.manifest" version_assembly_output_file = "$target_gen_dir/version_assembly.manifest"
...@@ -12,6 +12,9 @@ version_assembly_output_file = "$target_gen_dir/version_assembly.manifest" ...@@ -12,6 +12,9 @@ version_assembly_output_file = "$target_gen_dir/version_assembly.manifest"
process_version("chrome_exe_version_manifest") { process_version("chrome_exe_version_manifest") {
visibility = [ ":*" ] visibility = [ ":*" ]
template_file = "chrome_exe_manifest.template" template_file = "chrome_exe_manifest.template"
sources = [
"//chrome/VERSION",
]
output = version_assembly_output_file output = version_assembly_output_file
} }
...@@ -36,6 +39,9 @@ windows_manifest("chrome_exe_manifest") { ...@@ -36,6 +39,9 @@ windows_manifest("chrome_exe_manifest") {
# directory where Chrome finds chrome.dll. # directory where Chrome finds chrome.dll.
process_version("version_assembly_manifest") { process_version("version_assembly_manifest") {
template_file = "version_assembly_manifest.template" template_file = "version_assembly_manifest.template"
sources = [
"//chrome/VERSION",
]
output = "$root_build_dir/$chrome_version_full.manifest" output = "$root_build_dir/$chrome_version_full.manifest"
process_only = true process_only = true
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/version.gni") import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni") import("//testing/test.gni")
source_set("client") { source_set("client") {
...@@ -47,8 +47,7 @@ group("kasko_util") { ...@@ -47,8 +47,7 @@ group("kasko_util") {
] ]
} }
process_version("chrome_watcher_resources") { process_version_rc_template("chrome_watcher_resources") {
template_file = chrome_version_rc_template
sources = [ sources = [
"chrome_watcher.ver", "chrome_watcher.ver",
] ]
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/buildflag_header.gni") import("//build/buildflag_header.gni")
import("//build/util/process_version.gni")
import("//chrome/common/features.gni") import("//chrome/common/features.gni")
import("//chrome/version.gni") import("//chrome/process_version_rc_template.gni") # For branding_file_path.
import("//mojo/public/tools/bindings/mojom.gni") import("//mojo/public/tools/bindings/mojom.gni")
import("//tools/grit/grit_rule.gni") import("//tools/grit/grit_rule.gni")
...@@ -510,8 +511,11 @@ process_version("version_header") { ...@@ -510,8 +511,11 @@ process_version("version_header") {
# currently depends on this. # currently depends on this.
#visibility = [ ":*" ] #visibility = [ ":*" ]
# This one just uses the custom template and no separate sources. sources = [
sources = [] "//build/util/LASTCHANGE",
"//chrome/VERSION",
branding_file_path,
]
template_file = "chrome_version.h.in" template_file = "chrome_version.h.in"
output = "$target_gen_dir/chrome_version.h" output = "$target_gen_dir/chrome_version.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/version.gni") import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni") import("//testing/test.gni")
assert(is_win) assert(is_win)
...@@ -34,7 +34,7 @@ copy("copy_gcapi_header") { ...@@ -34,7 +34,7 @@ copy("copy_gcapi_header") {
] ]
} }
process_version("gcapi_dll_version") { process_version_rc_template("gcapi_dll_version") {
template_file = "gcapi_dll_version.rc.version" template_file = "gcapi_dll_version.rc.version"
output = "$target_gen_dir/gcapi_dll_version.rc" output = "$target_gen_dir/gcapi_dll_version.rc"
} }
......
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
import("//build/util/process_version.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//chrome/version.gni") import("//chrome/process_version_rc_template.gni") # For branding_file_path.
if (current_cpu == "x86" || current_cpu == "x64") { if (current_cpu == "x86" || current_cpu == "x64") {
import("//media/cdm/ppapi/cdm_paths.gni") import("//media/cdm/ppapi/cdm_paths.gni")
...@@ -150,6 +151,11 @@ if (!is_chromeos) { ...@@ -150,6 +151,11 @@ if (!is_chromeos) {
process_version("save_build_info") { process_version("save_build_info") {
# Just output the default version info variables (no template). # Just output the default version info variables (no template).
process_only = true process_only = true
sources = [
"//build/util/LASTCHANGE",
"//chrome/VERSION",
branding_file_path,
]
output = "$root_out_dir/installer/version.txt" output = "$root_out_dir/installer/version.txt"
} }
......
...@@ -6,8 +6,8 @@ import("//build/config/compiler/compiler.gni") ...@@ -6,8 +6,8 @@ import("//build/config/compiler/compiler.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//build/config/win/visual_studio_version.gni") import("//build/config/win/visual_studio_version.gni")
import("//chrome/process_version_rc_template.gni")
import("//chrome/test/mini_installer/mini_installer_test.gni") import("//chrome/test/mini_installer/mini_installer_test.gni")
import("//chrome/version.gni")
import("//third_party/icu/config.gni") import("//third_party/icu/config.gni")
import("//ui/base/ui_features.gni") import("//ui/base/ui_features.gni")
import("//v8/gni/v8.gni") import("//v8/gni/v8.gni")
...@@ -51,7 +51,7 @@ source_set("lib") { ...@@ -51,7 +51,7 @@ source_set("lib") {
inputs = mini_installer_test_files inputs = mini_installer_test_files
} }
process_version("version") { process_version_rc_template("version") {
template_file = "mini_installer_exe_version.rc.version" template_file = "mini_installer_exe_version.rc.version"
output = "$root_out_dir/mini_installer_exe_version.rc" output = "$root_out_dir/mini_installer_exe_version.rc"
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/version.gni") import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni") import("//testing/test.gni")
if (is_win) { if (is_win) {
...@@ -78,7 +78,7 @@ if (is_win) { ...@@ -78,7 +78,7 @@ if (is_win) {
] ]
} }
process_version("setup_exe_version") { process_version_rc_template("setup_exe_version") {
template_file = "setup_exe_version.rc.version" template_file = "setup_exe_version.rc.version"
output = "$target_gen_dir/setup_exe_version.rc" output = "$target_gen_dir/setup_exe_version.rc"
} }
......
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chrome_build.gni")
import("//build/util/process_version.gni")
# The path to the BRANDING file in chrome/app/theme.
branding_file_path = "//chrome/app/theme/$branding_path_component/BRANDING"
# This is a wrapper around process_version() that eases the task of processing
# a .rc.version file (used especially on Windows).
#
# This template automatically includes VERSION, LASTCHANGE and BRANDING, and
# any additional source files are passed after those (so their values can
# override the ones specified by those 3 files).
#
# Parameters:
# sources (optional):
# List of files with value definitions that will be passed in addition to
# VERSION, LASTCHANGE and BRANDING.
#
# template_file (optional):
# Template file to use (not a list). If not specified, a default value,
# //chrome/app/chrome_version.rc.version will be used.
#
# This template forwards all other parameters directly to process_version().
#
# Examples:
# process_version_rc_template("my_exe_version") {
# output = "$target_gen_dir/my_exe_version.rc"
# sources = [ "frob/my_exe.ver" ]
# extra_args = [ "-e", "FOO=42" ]
# }
#
# process_version_rc_template("my_dll_version") {
# output = "$target_gen_dir/my_dll_version.rc"
# template_file = [ "//foo/bar/my_dll_version.rc.version" ]
# }
template("process_version_rc_template") {
if (defined(invoker.template_file)) {
_template_file = invoker.template_file
} else {
_template_file = "//chrome/app/chrome_version.rc.version"
}
_sources = [
"//build/util/LASTCHANGE",
"//chrome/VERSION",
branding_file_path,
]
if (defined(invoker.sources)) {
_sources += invoker.sources
}
process_version(target_name) {
template_file = _template_file
sources = _sources
forward_variables_from(invoker,
"*",
[
"sources",
"template_file",
])
}
}
...@@ -6,15 +6,14 @@ ...@@ -6,15 +6,14 @@
# Please don't add dependencies on any other system libraries. # Please don't add dependencies on any other system libraries.
import("//build/config/win/manifest.gni") import("//build/config/win/manifest.gni")
import("//chrome/version.gni") import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni") import("//testing/test.gni")
##------------------------------------------------------------------------------ ##------------------------------------------------------------------------------
## chrome_elf ## chrome_elf
##------------------------------------------------------------------------------ ##------------------------------------------------------------------------------
process_version("chrome_elf_resources") { process_version_rc_template("chrome_elf_resources") {
template_file = chrome_version_rc_template
sources = [ sources = [
"chrome_elf.ver", "chrome_elf.ver",
] ]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/version.gni") # TODO layering violation! import("//build/util/process_version.gni")
import("//chromecast/chromecast.gni") import("//chromecast/chromecast.gni")
import("//testing/test.gni") import("//testing/test.gni")
...@@ -200,6 +200,9 @@ process_version("cast_version") { ...@@ -200,6 +200,9 @@ process_version("cast_version") {
template_file = "version.h.in" template_file = "version.h.in"
output = "$target_gen_dir/version.h" output = "$target_gen_dir/version.h"
sources = [
"//chrome/VERSION",
]
extra_args = [ extra_args = [
"-e", "-e",
"VERSION_FULL=\"%s.%s.%s.%s\"%(MAJOR,MINOR,BUILD,PATCH)", "VERSION_FULL=\"%s.%s.%s.%s\"%(MAJOR,MINOR,BUILD,PATCH)",
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/version.gni") # TODO layering violation!
import("//testing/test.gni") import("//testing/test.gni")
source_set("crypto") { source_set("crypto") {
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
import("//build/buildflag_header.gni") import("//build/buildflag_header.gni")
import("//build/config/android/config.gni") import("//build/config/android/config.gni")
import("//build/config/android/rules.gni") import("//build/config/android/rules.gni")
import("//build/util/process_version.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//chrome/version.gni")
import("//testing/test.gni") import("//testing/test.gni")
import("//third_party/protobuf/proto_library.gni") import("//third_party/protobuf/proto_library.gni")
import("//url/features.gni") import("//url/features.gni")
...@@ -95,6 +95,10 @@ _generated_api_version_java = ...@@ -95,6 +95,10 @@ _generated_api_version_java =
process_version("cronet_api_version_java") { process_version("cronet_api_version_java") {
template_file = "api/src/org/chromium/net/ApiVersion.template" template_file = "api/src/org/chromium/net/ApiVersion.template"
sources = [
"//build/util/LASTCHANGE",
"//chrome/VERSION",
]
output = _generated_api_version_java output = _generated_api_version_java
} }
...@@ -116,6 +120,10 @@ _generated_impl_version_java = ...@@ -116,6 +120,10 @@ _generated_impl_version_java =
process_version("cronet_impl_version_java") { process_version("cronet_impl_version_java") {
template_file = "java/src/org/chromium/net/impl/ImplVersion.template" template_file = "java/src/org/chromium/net/impl/ImplVersion.template"
sources = [
"//build/util/LASTCHANGE",
"//chrome/VERSION",
]
output = _generated_impl_version_java output = _generated_impl_version_java
} }
......
...@@ -6,8 +6,8 @@ import("//build/buildflag_header.gni") ...@@ -6,8 +6,8 @@ import("//build/buildflag_header.gni")
import("//build/config/ios/rules.gni") import("//build/config/ios/rules.gni")
import("//build/config/mac/symbols.gni") import("//build/config/mac/symbols.gni")
import("//build/mac/tweak_info_plist.gni") import("//build/mac/tweak_info_plist.gni")
import("//build/util/process_version.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//chrome/version.gni")
import("//testing/test.gni") import("//testing/test.gni")
import("//url/features.gni") import("//url/features.gni")
...@@ -19,6 +19,9 @@ declare_args() { ...@@ -19,6 +19,9 @@ declare_args() {
process_version("cronet_version_header") { process_version("cronet_version_header") {
template_file = "//components/cronet/version.h.in" template_file = "//components/cronet/version.h.in"
sources = [
"//chrome/VERSION",
]
output = "$target_gen_dir/version.h" output = "$target_gen_dir/version.h"
extra_args = [ extra_args = [
"-e", "-e",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/version.gni") import("//build/util/process_version.gni")
# Variables: # Variables:
# deps: Extra dependencies. # deps: Extra dependencies.
...@@ -109,6 +109,9 @@ source_set("unit_tests") { ...@@ -109,6 +109,9 @@ source_set("unit_tests") {
process_version("version_header") { process_version("version_header") {
template_file = "version.h.in" template_file = "version.h.in"
sources = [
"//chrome/VERSION",
]
output = "$target_gen_dir/version.h" output = "$target_gen_dir/version.h"
extra_args = [ extra_args = [
"-e", "-e",
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//chrome/version.gni") import("//build/util/process_version.gni")
import("//chrome/process_version_rc_template.gni") # For branding_file_path.
declare_args() { declare_args() {
use_unofficial_version_number = !is_chrome_branded use_unofficial_version_number = !is_chrome_branded
...@@ -29,5 +30,10 @@ static_library("version_info") { ...@@ -29,5 +30,10 @@ static_library("version_info") {
process_version("generate_version_info") { process_version("generate_version_info") {
template_file = "version_info_values.h.version" template_file = "version_info_values.h.version"
sources = [
"//build/util/LASTCHANGE",
"//chrome/VERSION",
branding_file_path,
]
output = "$target_gen_dir/version_info_values.h" output = "$target_gen_dir/version_info_values.h"
} }
...@@ -4,11 +4,7 @@ ...@@ -4,11 +4,7 @@
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//build/util/process_version.gni")
# Technically, this directory should not depend on files from src/chrome, but
# that's where the VERSION file is. This should probably all be moved to
# src/build.
import("//chrome/version.gni")
import("//testing/test.gni") import("//testing/test.gni")
import("//tools/grit/grit_rule.gni") import("//tools/grit/grit_rule.gni")
...@@ -280,6 +276,10 @@ test("app_shell_unittests") { ...@@ -280,6 +276,10 @@ test("app_shell_unittests") {
process_version("version_header") { process_version("version_header") {
template_file = "common/version.h.in" template_file = "common/version.h.in"
sources = [
"//build/util/LASTCHANGE",
"//chrome/VERSION",
]
output = "$target_gen_dir/common/version.h" output = "$target_gen_dir/common/version.h"
} }
......
...@@ -7,7 +7,6 @@ import("//build/config/ios/rules.gni") ...@@ -7,7 +7,6 @@ import("//build/config/ios/rules.gni")
import("//build/config/mac/symbols.gni") import("//build/config/mac/symbols.gni")
import("//build/mac/tweak_info_plist.gni") import("//build/mac/tweak_info_plist.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//chrome/version.gni")
import("//testing/test.gni") import("//testing/test.gni")
import("//url/features.gni") import("//url/features.gni")
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/features.gni") import("//build/config/features.gni")
import("//chrome/version.gni") # TODO layering violation! import("//chrome/process_version_rc_template.gni")
import("//media/cdm/ppapi/cdm_paths.gni") import("//media/cdm/ppapi/cdm_paths.gni")
import("//media/cdm/ppapi/ppapi_cdm_adapter.gni") import("//media/cdm/ppapi/ppapi_cdm_adapter.gni")
import("//media/media_options.gni") import("//media/media_options.gni")
...@@ -50,9 +50,8 @@ shared_library("clearkeycdm") { ...@@ -50,9 +50,8 @@ shared_library("clearkeycdm") {
} }
} }
process_version("clearkeycdmadapter_resources") { process_version_rc_template("clearkeycdmadapter_resources") {
visibility = [ ":*" ] visibility = [ ":*" ]
template_file = chrome_version_rc_template
sources = [ sources = [
"//media/clearkeycdmadapter.ver", "//media/clearkeycdmadapter.ver",
"external_clear_key/BRANDING", "external_clear_key/BRANDING",
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//chrome/version.gni")
import("//remoting/remoting_enable.gni") import("//remoting/remoting_enable.gni")
import("//remoting/remoting_locales.gni") import("//remoting/remoting_locales.gni")
import("//remoting/remoting_options.gni") import("//remoting/remoting_options.gni")
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/util/process_version.gni")
import("//remoting/build/config/remoting_build.gni") import("//remoting/build/config/remoting_build.gni")
group("all_tests") { group("all_tests") {
......
...@@ -457,8 +457,6 @@ remoting_localize("remoting_windows_resources") { ...@@ -457,8 +457,6 @@ remoting_localize("remoting_windows_resources") {
"version.rc.jinja2", "version.rc.jinja2",
] ]
# TODO(zijiehe): Export lastchange_path from
# //chrome/version.gni:process_version
variables = [ variables = [
rebase_path(chrome_version_file), rebase_path(chrome_version_file),
rebase_path(remoting_version_file), rebase_path(remoting_version_file),
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//chrome/version.gni") # TODO layering violation import("//chrome/process_version_rc_template.gni")
import("//media/cdm/ppapi/cdm_paths.gni") import("//media/cdm/ppapi/cdm_paths.gni")
import("//media/cdm/ppapi/ppapi_cdm_adapter.gni") import("//media/cdm/ppapi/ppapi_cdm_adapter.gni")
import("//third_party/widevine/cdm/widevine.gni") import("//third_party/widevine/cdm/widevine.gni")
...@@ -129,9 +129,8 @@ if (widevine_cdm_manifest_file != []) { ...@@ -129,9 +129,8 @@ if (widevine_cdm_manifest_file != []) {
if ((is_chrome_branded || enable_widevine) && enable_pepper_cdms) { if ((is_chrome_branded || enable_widevine) && enable_pepper_cdms) {
# Produce and compile the .rc file. # Produce and compile the .rc file.
process_version("widevinecdmadapter_resources") { process_version_rc_template("widevinecdmadapter_resources") {
visibility = [ ":*" ] visibility = [ ":*" ]
template_file = chrome_version_rc_template
sources = [ sources = [
"BRANDING", "BRANDING",
"widevinecdmadapter.ver", "widevinecdmadapter.ver",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment