summaryrefslogtreecommitdiffstats
path: root/components/version_info.gypi
diff options
context:
space:
mode:
authorsdefresne <sdefresne@chromium.org>2015-07-30 01:05:54 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-30 08:06:36 +0000
commit6e883e40d456dd422ac08ced1c25e7403f78bada (patch)
tree615f0986f2edb95b679d1598eaaff335e29283f1 /components/version_info.gypi
parent0289a621d385a5fa87f3635bedaae2daabc6f4b9 (diff)
downloadchromium_src-6e883e40d456dd422ac08ced1c25e7403f78bada.zip
chromium_src-6e883e40d456dd422ac08ced1c25e7403f78bada.tar.gz
chromium_src-6e883e40d456dd422ac08ced1c25e7403f78bada.tar.bz2
Componentize VersionInfo.
Create a new component version_info that allows to get information about the current version of Chrome running, except for the channel (which has to be provided by the embedder). The method to get the channel is not moved to the component because on Windows it depends on //chrome/installer which would be non-trivial to componentize. Since the method is embedder-specific (though it have no bad dependencies on the other platform) it makes sense to not move it into the component. Fixes VersionInfo API to only expose static method (since the class did not have any state and the API was a mix of "const" and "static" methods) and to delegate the job to version_info component in order to limit the API changes. Mass rename (chrome::)VersionInfo::(Channel|CHANNEL) after the enum was moved to the version_info namespace in the corresponding component using tools/git/mffr.py. Change Channel enumeration to be a "class enum" and add static_cast<int> where needed (as class enum do not implicitly convert to int). BUG=511912 Review URL: https://codereview.chromium.org/1257633002 Cr-Commit-Position: refs/heads/master@{#341085}
Diffstat (limited to 'components/version_info.gypi')
-rw-r--r--components/version_info.gypi124
1 files changed, 124 insertions, 0 deletions
diff --git a/components/version_info.gypi b/components/version_info.gypi
new file mode 100644
index 0000000..fa18bfe
--- /dev/null
+++ b/components/version_info.gypi
@@ -0,0 +1,124 @@
+# 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.
+
+{
+ 'variables': {
+ # Some plaform want to override part of the version number generation
+ # (for example iOS uses a different value for PATCH level for canary).
+ # This can be done settings "extra_version_path" variable to the path
+ # of a file with the corresponding value overrides. If present it will
+ # be loaded after all other input files.
+ 'extra_version_name': '',
+ },
+ 'targets': [
+ {
+ # GN version: //components/version_info
+ 'target_name': 'version_info',
+ 'type': 'static_library',
+ 'include_dirs': [
+ '..',
+ ],
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../ui/base/ui_base.gyp:ui_base',
+ 'components_strings.gyp:components_strings',
+ 'generate_version_info',
+ ],
+ 'sources': [
+ 'version_info/version_info.cc',
+ 'version_info/version_info.h',
+ ],
+ },
+ {
+ # GN version: //components/version_info:generate_version
+ 'target_name': 'generate_version_info',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)',
+ ],
+ },
+ # Because generate_version_info generates a header, the target must set
+ # the hard_dependency flag.
+ 'hard_dependency': 1,
+ 'actions': [
+ {
+ 'action_name': 'generation_version_info',
+ 'message': 'Generating version information',
+ 'variables': {
+ 'extra_version_flags': [],
+ 'lastchange_path': '../build/util/LASTCHANGE',
+ 'version_py_path': '../build/util/version.py',
+ 'template_input_path': 'version_info/version_info_values.h.version',
+ # Use VERSION and BRANDING files from //chrome even if this is bad
+ # dependency until they are moved to src/ for VERSION and to the
+ # version_info component for BRANDING. Synchronisation with TPM and
+ # all release script is required for thoses moves. They are tracked
+ # by issues http://crbug.com/512347 and http://crbug.com/513603.
+ 'version_path': '../chrome/VERSION',
+ 'branding_path': '../chrome/app/theme/<(branding_path_component)/BRANDING',
+ },
+ 'inputs': [
+ '<(version_py_path)',
+ '<(template_input_path)',
+ '<(version_path)',
+ '<(branding_path)',
+ '<(lastchange_path)',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/components/version_info/version_info_values.h',
+ ],
+ 'action': [
+ 'python',
+ '<(version_py_path)',
+ '-f', '<(version_path)',
+ '-f', '<(branding_path)',
+ '-f', '<(lastchange_path)',
+ '<@(extra_version_flags)',
+ '<(template_input_path)',
+ '<@(_outputs)',
+ ],
+ 'conditions': [
+ ['extra_version_name!=""', {
+ 'variables': {
+ 'extra_version_flags': [
+ '-f', '<(extra_version_name)',
+ ],
+ },
+ 'inputs': [
+ '<(extra_version_name)'
+ ],
+ }],
+ ],
+ },
+ ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="ios"', {
+ 'variables': {
+ # Controls whether the extra version path should be overridden to
+ # use ios/build/util/CANARY_VERSION (legacy until the bots have
+ # been updated to override ios_extra_version_path instead).
+ # TODO(sdefresne): remove once http://crbug.com/514560 is fixed.
+ 'use_canary_version_file%': 0,
+
+ # Path to the file used to override the version PATH level on iOS.
+ # Default to ios/build/util/VERSION.
+ 'ios_extra_version_path%': '../ios/build/util/VERSION',
+ },
+ 'conditions': [
+ ['use_canary_version_file==1', {
+ 'variables': {
+ 'extra_version_name': '../ios/build/util/CANARY_VERSION',
+ },
+ }, {
+ 'variables': {
+ 'extra_version_name': '<(ios_extra_version_path)',
+ },
+ }],
+ ],
+ }],
+ ],
+}