summaryrefslogtreecommitdiffstats
path: root/components/version_info.gypi
blob: 472f1d87be20f8ac6cd4dc87ff9f62e968c9b538 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# 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': '',
    'conditions': [
      ['branding == "Chrome"', {
        'use_unofficial_version_number%': 0,
      }, {
        'use_unofficial_version_number%': 1,
      }],
    ],
  },
  'targets': [
    {
      # GN version: //components/version_info
      'target_name': 'version_info',
      'type': 'static_library',
      'include_dirs': [
        '..',
      ],
      'dependencies': [
        '../base/base.gyp:base',
        'components_strings.gyp:components_strings',
        'generate_version_info',
      ],
      'sources': [
        'version_info/version_info.cc',
        'version_info/version_info.h',
      ],
      'conditions': [
        ['use_unofficial_version_number==1', {
          'dependencies': [
              '../ui/base/ui_base.gyp:ui_base',
            ],
          'defines': ['USE_UNOFFICIAL_VERSION_NUMBER'],
        }],
      ],
    },
    {
      # 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': {
        # Use nested 'variables' to workaround how variables work with gyp (no
        # determined ordering and thuse it is not possible to define a variable
        # in function of another).
        'variables': {
          # 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',
        },
        'extra_version_name': '<(ios_extra_version_path)'
      },
    }],
  ],
}