blob: 42bafbece5569ef052eb27edc1f9128f1dd2e933 [file] [log] [blame]
sdefresne6e883e42015-07-30 08:05:541# Copyright 2015 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.
4
5{
6 'variables': {
7 # Some plaform want to override part of the version number generation
8 # (for example iOS uses a different value for PATCH level for canary).
9 # This can be done settings "extra_version_path" variable to the path
10 # of a file with the corresponding value overrides. If present it will
11 # be loaded after all other input files.
12 'extra_version_name': '',
joleksy0495daeb2015-10-21 14:37:0413 'conditions': [
14 ['branding == "Chrome"', {
15 'use_unofficial_version_number%': 0,
16 }, {
17 'use_unofficial_version_number%': 1,
18 }],
19 ],
sdefresne6e883e42015-07-30 08:05:5420 },
21 'targets': [
22 {
23 # GN version: //components/version_info
24 'target_name': 'version_info',
25 'type': 'static_library',
26 'include_dirs': [
27 '..',
28 ],
29 'dependencies': [
30 '../base/base.gyp:base',
sdefresne6e883e42015-07-30 08:05:5431 'components_strings.gyp:components_strings',
32 'generate_version_info',
33 ],
34 'sources': [
35 'version_info/version_info.cc',
36 'version_info/version_info.h',
37 ],
joleksy0495daeb2015-10-21 14:37:0438 'conditions': [
39 ['use_unofficial_version_number==1', {
40 'dependencies': [
41 '../ui/base/ui_base.gyp:ui_base',
42 ],
43 'defines': ['USE_UNOFFICIAL_VERSION_NUMBER'],
44 }],
45 ],
sdefresnec9c0d902015-09-25 14:06:4646 'export_dependent_settings': [
47 'generate_version_info',
48 ],
sdefresne6e883e42015-07-30 08:05:5449 },
50 {
51 # GN version: //components/version_info:generate_version
52 'target_name': 'generate_version_info',
53 'type': 'none',
54 'direct_dependent_settings': {
55 'include_dirs': [
56 '<(SHARED_INTERMEDIATE_DIR)',
57 ],
58 },
59 # Because generate_version_info generates a header, the target must set
60 # the hard_dependency flag.
61 'hard_dependency': 1,
62 'actions': [
63 {
64 'action_name': 'generation_version_info',
65 'message': 'Generating version information',
66 'variables': {
67 'extra_version_flags': [],
68 'lastchange_path': '../build/util/LASTCHANGE',
69 'version_py_path': '../build/util/version.py',
70 'template_input_path': 'version_info/version_info_values.h.version',
71 # Use VERSION and BRANDING files from //chrome even if this is bad
72 # dependency until they are moved to src/ for VERSION and to the
73 # version_info component for BRANDING. Synchronisation with TPM and
74 # all release script is required for thoses moves. They are tracked
75 # by issues http://crbug.com/512347 and http://crbug.com/513603.
76 'version_path': '../chrome/VERSION',
77 'branding_path': '../chrome/app/theme/<(branding_path_component)/BRANDING',
78 },
79 'inputs': [
80 '<(version_py_path)',
81 '<(template_input_path)',
82 '<(version_path)',
83 '<(branding_path)',
84 '<(lastchange_path)',
85 ],
86 'outputs': [
87 '<(SHARED_INTERMEDIATE_DIR)/components/version_info/version_info_values.h',
88 ],
89 'action': [
90 'python',
91 '<(version_py_path)',
92 '-f', '<(version_path)',
93 '-f', '<(branding_path)',
94 '-f', '<(lastchange_path)',
95 '<@(extra_version_flags)',
96 '<(template_input_path)',
97 '<@(_outputs)',
98 ],
99 'conditions': [
100 ['extra_version_name!=""', {
101 'variables': {
102 'extra_version_flags': [
103 '-f', '<(extra_version_name)',
104 ],
105 },
106 'inputs': [
107 '<(extra_version_name)'
108 ],
109 }],
110 ],
111 },
112 ],
113 },
114 ],
115 'conditions': [
116 ['OS=="ios"', {
117 'variables': {
sdefresne85e9bf22015-08-20 12:41:14118 # Use nested 'variables' to workaround how variables work with gyp (no
119 # determined ordering and thuse it is not possible to define a variable
120 # in function of another).
121 'variables': {
122 # Path to the file used to override the version PATH level on iOS.
123 # Default to ios/build/util/VERSION.
124 'ios_extra_version_path%': '../ios/build/util/VERSION',
125 },
126 'extra_version_name': '<(ios_extra_version_path)'
sdefresne6e883e42015-07-30 08:05:54127 },
sdefresne6e883e42015-07-30 08:05:54128 }],
129 ],
130}