Commit 983c0562 authored by brettw's avatar brettw Committed by Commit bot

Hook up chrome.exe manifest in the Windows GN build.

This generates a proper version manifest for chrome.exe and also for the version assembly.

This adds a new way to get the chrome version info programatically at GN time. Although this adds another exec_script call, it removes four such calls in remoting so there is a net speed increase.

BUG=

Review URL: https://codereview.chromium.org/1250853007

Cr-Commit-Position: refs/heads/master@{#339833}
parent 0355eead
...@@ -118,6 +118,7 @@ exec_script_whitelist = [ ...@@ -118,6 +118,7 @@ exec_script_whitelist = [
"//build/toolchain/gcc_toolchain.gni", "//build/toolchain/gcc_toolchain.gni",
"//build/toolchain/mac/BUILD.gn", "//build/toolchain/mac/BUILD.gn",
"//build/toolchain/win/BUILD.gn", "//build/toolchain/win/BUILD.gn",
"//build/util/version.gni",
"//chrome/android/BUILD.gn", "//chrome/android/BUILD.gn",
"//chrome/browser/BUILD.gn", "//chrome/browser/BUILD.gn",
"//chrome/browser/chromeos/BUILD.gn", "//chrome/browser/chromeos/BUILD.gn",
......
# Copyright 2015 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.
# This exposes the Chrome version as GN variables for use in build files.
#
# 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
# wrapper in chrome/version.gni) to generate a file at build-time with the
# information you need. This allows better dependency checking and GN will
# run faster.
#
# These values should only be used if you REALLY need to depend on them at
# build-time, for example, in the computation of output file names.
# Give version.py a pattern that will expand to a GN scope consisting of
# all values we need at once.
_version_dictionary_template = "full = \"@MAJOR@.@MINOR@.@BUILD@.@PATCH@\" " +
"major = \"@MAJOR@\" minor = \"@MINOR@\" " +
"build = \"@BUILD@\" patch = \"@PATCH@\""
# The file containing the Chrome version number.
chrome_version_file = "//chrome/VERSION"
_result = exec_script("version.py",
[
"-f",
rebase_path(chrome_version_file, root_build_dir),
"-t",
_version_dictionary_template,
],
"scope",
[ chrome_version_file ])
# Full version. For example "45.0.12321.0"
chrome_version_full = _result.full
# The consituent parts of the full version.
chrome_version_major = _result.major
chrome_version_minor = _result.minor
chrome_version_build = _result.build
chrome_version_patch = _result.patch
...@@ -71,6 +71,7 @@ if (!is_android) { ...@@ -71,6 +71,7 @@ if (!is_android) {
"//base", "//base",
"//breakpad:breakpad_handler", "//breakpad:breakpad_handler",
"//breakpad:breakpad_sender", "//breakpad:breakpad_sender",
"//chrome/app/version_assembly:chrome_exe_manifest",
"//chrome/browser:chrome_process_finder", "//chrome/browser:chrome_process_finder",
"//chrome/chrome_watcher", "//chrome/chrome_watcher",
"//chrome/chrome_watcher:client", "//chrome/chrome_watcher:client",
...@@ -83,6 +84,8 @@ if (!is_android) { ...@@ -83,6 +84,8 @@ if (!is_android) {
"//sandbox", "//sandbox",
"//ui/gfx", "//ui/gfx",
] ]
data_deps = [ "//chrome/app/version_assembly:version_assembly_manifest" ]
libs = [ libs = [
"wintrust.lib", "wintrust.lib",
"crypt32.lib", "crypt32.lib",
......
# Copyright 2015 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/win/manifest.gni")
import("//build/util/version.gni")
import("//chrome/version.gni")
version_assembly_output_file = "$target_gen_dir/version_assembly.manifest"
# Generates a manifest file with the current build's version information.
process_version("chrome_exe_version_manifest") {
visibility = [ ":*" ]
template_file = "chrome_exe_manifest.template"
output = version_assembly_output_file
}
# Generates the manifest for chrome.exe. This is the normal manifest stuff plus
# the version information.
windows_manifest("chrome_exe_manifest") {
sources = [
as_invoker_manifest,
common_controls_manifest,
default_compatibility_manifest,
version_assembly_output_file,
]
type = "exe"
deps = [
":chrome_exe_version_manifest",
]
}
# Generates the manifest for the version assembly, which is the versioned
# directory where Chrome finds chrome.dll.
process_version("version_assembly_manifest") {
template_file = "version_assembly_manifest.template"
output = "$root_build_dir/$chrome_version_full.manifest"
process_only = true
}
...@@ -533,12 +533,14 @@ ...@@ -533,12 +533,14 @@
'message': 'Copy first run complete sentinel file', 'message': 'Copy first run complete sentinel file',
}, },
{ {
# GN version: //chrome/app/version_assembly:chrome_exe_manifest
'action_name': 'chrome_exe_manifest', 'action_name': 'chrome_exe_manifest',
'includes': [ 'includes': [
'app/version_assembly/chrome_exe_manifest_action.gypi', 'app/version_assembly/chrome_exe_manifest_action.gypi',
], ],
}, },
{ {
# GN version: //chrome/app/version_assembly:version_assembly_manifest
'action_name': 'version_assembly_manifest', 'action_name': 'version_assembly_manifest',
'includes': [ 'includes': [
'app/version_assembly/version_assembly_manifest_action.gypi', 'app/version_assembly/version_assembly_manifest_action.gypi',
......
...@@ -36,11 +36,17 @@ import("//build/config/chrome_build.gni") ...@@ -36,11 +36,17 @@ import("//build/config/chrome_build.gni")
# template_file (optional): # template_file (optional):
# Template file to use (not a list). Defaults to # Template file to use (not a list). Defaults to
# //chrome/app/chrome_version.rc.version if unspecified. # //chrome/app/chrome_version.rc.version if unspecified.
# TODO(brettw) remove this default behavior and specify it every time.
# #
# 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
# use sources instead. # use sources instead.
# #
# process_only (optional, defaults to false)
# Set to generate only one action that processes the version file and
# doesn't attempt to link the result into a source set. This is for if
# you are processing the version as data only.
#
# visibility (optional) # visibility (optional)
# #
# Example: # Example:
...@@ -55,11 +61,16 @@ template("process_version") { ...@@ -55,11 +61,16 @@ template("process_version") {
"Either sources or template_file must be defined for $target_name") "Either sources or template_file must be defined for $target_name")
assert(defined(invoker.output), "Output must be defined for $target_name") assert(defined(invoker.output), "Output must be defined for $target_name")
action_name = target_name + "_action" process_only = defined(invoker.process_only) && invoker.process_only
source_set_name = target_name
if (process_only) {
action_name = target_name
} else {
action_name = target_name + "_action"
source_set_name = target_name
}
action(action_name) { action(action_name) {
visibility = [ ":$source_set_name" ]
script = "//build/util/version.py" script = "//build/util/version.py"
lastchange_path = "//build/util/LASTCHANGE" lastchange_path = "//build/util/LASTCHANGE"
...@@ -113,15 +124,27 @@ template("process_version") { ...@@ -113,15 +124,27 @@ template("process_version") {
rebase_path(template_path, root_build_dir), rebase_path(template_path, root_build_dir),
rebase_path(invoker.output, root_build_dir), rebase_path(invoker.output, root_build_dir),
] ]
if (process_only) {
# When processing only, visibility gets applied to this target.
if (defined(invoker.visibility)) {
visibility = invoker.visibility
}
} else {
# When linking the result, only the source set can depend on the action.
visibility = [ ":$source_set_name" ]
}
} }
source_set(source_set_name) { if (!process_only) {
if (defined(invoker.visibility)) { source_set(source_set_name) {
visibility = invoker.visibility if (defined(invoker.visibility)) {
visibility = invoker.visibility
}
sources = get_target_outputs(":$action_name")
public_deps = [
":$action_name",
]
} }
sources = get_target_outputs(":$action_name")
public_deps = [
":$action_name",
]
} }
} }
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
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("//remoting/remoting_version.gni") import("//remoting/remoting_version.gni")
import("//remoting/remoting_enable.gni") import("//remoting/remoting_enable.gni")
import("//testing/test.gni") import("//testing/test.gni")
# Various remoting targets need this version definition. # Various remoting targets need this version definition.
config("version") { config("version") {
defines = [ "VERSION=$version_full" ] defines = [ "VERSION=$chrome_version_full" ]
} }
group("remoting_all") { group("remoting_all") {
......
...@@ -6,7 +6,6 @@ import("//build/config/chrome_build.gni") ...@@ -6,7 +6,6 @@ import("//build/config/chrome_build.gni")
_version_py_abspath = "//build/util/version.py" _version_py_abspath = "//build/util/version.py"
_remoting_version_abspath = "//remoting/VERSION" _remoting_version_abspath = "//remoting/VERSION"
_chrome_version_abspath = "//chrome/VERSION"
if (is_chrome_branded) { if (is_chrome_branded) {
_remoting_branding_abspath = "//remoting/branding_Chrome" _remoting_branding_abspath = "//remoting/branding_Chrome"
} else { } else {
...@@ -17,58 +16,13 @@ if (is_chrome_branded) { ...@@ -17,58 +16,13 @@ if (is_chrome_branded) {
# be re-run if the files change. # be re-run if the files change.
remoting_version_files = [ remoting_version_files = [
_remoting_version_abspath, _remoting_version_abspath,
_chrome_version_abspath,
_remoting_branding_abspath, _remoting_branding_abspath,
] ]
_chrome_version_path = rebase_path(_chrome_version_abspath, root_build_dir)
_remoting_version_path = rebase_path(_remoting_version_abspath, root_build_dir) _remoting_version_path = rebase_path(_remoting_version_abspath, root_build_dir)
_remoting_branding_path = _remoting_branding_path =
rebase_path(_remoting_branding_abspath, root_build_dir) rebase_path(_remoting_branding_abspath, root_build_dir)
version_major = exec_script(_version_py_abspath,
[
"-f",
_chrome_version_path,
"-f",
_remoting_version_path,
"-t \"@MAJOR@\"",
],
"value",
remoting_version_files)
version_minor = exec_script(_version_py_abspath,
[
"-f",
_remoting_version_path,
"-t \"@REMOTING_PATCH@\"",
],
"value",
remoting_version_files)
version_short =
"${version_major}.${version_minor}." + exec_script(_version_py_abspath,
[
"-f",
_chrome_version_path,
"-f",
_remoting_version_path,
"-t \"@BUILD@\"",
],
"value",
remoting_version_files)
version_full = "${version_short}." + exec_script(_version_py_abspath,
[
"-f",
_chrome_version_path,
"-f",
_remoting_version_path,
"-t \"@PATCH@\"",
],
"value",
remoting_version_files)
prefpane_bundle_name = exec_script(_version_py_abspath, prefpane_bundle_name = exec_script(_version_py_abspath,
[ [
"-f", "-f",
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# Keep in sync with 'remoting_webapp' target in remoting/remoting_client.gypi. # Keep in sync with 'remoting_webapp' target in remoting/remoting_client.gypi.
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/util/version.gni")
import("//remoting/remoting_locales.gni") import("//remoting/remoting_locales.gni")
import("//remoting/remoting_options.gni") import("//remoting/remoting_options.gni")
import("//remoting/remoting_version.gni") import("//remoting/remoting_version.gni")
...@@ -211,7 +212,7 @@ template("desktop_remoting_webapp") { ...@@ -211,7 +212,7 @@ template("desktop_remoting_webapp") {
args = [ args = [
buildtype, buildtype,
version_full, chrome_version_full,
output_dir, output_dir,
zip_path, zip_path,
rebase_path("crd/manifest.json.jinja2", root_build_dir), rebase_path("crd/manifest.json.jinja2", root_build_dir),
...@@ -307,7 +308,7 @@ template("app_remoting_webapp") { ...@@ -307,7 +308,7 @@ template("app_remoting_webapp") {
args = [ args = [
buildtype, buildtype,
version_full, chrome_version_full,
output_dir, output_dir,
zip_path, zip_path,
rebase_path(ar_app_manifest, root_build_dir), rebase_path(ar_app_manifest, root_build_dir),
...@@ -492,7 +493,7 @@ template("app_remoting_shared_module") { ...@@ -492,7 +493,7 @@ template("app_remoting_shared_module") {
args = [ args = [
buildtype, buildtype,
version_full, chrome_version_full,
output_dir, output_dir,
zip_path, zip_path,
rebase_path(ar_manifest, root_build_dir), rebase_path(ar_manifest, root_build_dir),
......
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