summaryrefslogtreecommitdiffstats
path: root/ios/chrome/tools/strings/generate_localizable_strings.gyp
blob: 70cb3db7b27cb51317952185bd4fd6739e8f3a17 (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
# 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.

# Builds an OS X command line tool to generate Localizable.strings and
# InfoPlist.strings from compiled locales.pak.

{
  'conditions': [
    ['OS!="ios" or "<(GENERATOR)"!="xcode" or "<(GENERATOR_FLAVOR)"=="ninja"', {
      'targets': [
        {
          'target_name': 'generate_localizable_strings',
          'type': 'executable',
          'toolsets': ['host'],
          'dependencies': [
            '../../../../base/base.gyp:base',
            '../../../../ui/base/ui_base.gyp:ui_data_pack',
          ],
          'sources': [
            'generate_localizable_strings.mm',
          ],
          'libraries': [
            '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
          ],
        },
      ],
    }, {  # else, OS=="ios" and "<(GENERATOR)"=="xcode" and "<(GENERATOR_FLAVOR)"!="ninja"
      # Generation is done via two actions: (1) compiling the executable with
      # ninja, and (2) copying the executable into a location that is shared
      # with other projects. These actions are separated into two targets in
      # order to be able to specify that the second action should not run until
      # the first action finishes (since the ordering of multiple actions in
      # one target is defined only by inputs and outputs, and it's impossible
      # to set correct inputs for the ninja build, so setting all the inputs
      # and outputs isn't an option).
      'variables': {
        # Hardcode the ninja_product_dir variable to avoid having to include
        # mac_build.gypi, as otherwise the re-generation of the project will
        # happen twice while running gyp. It's a bit fragile, but if it gets
        # out of sync we'll know as soon as anyone does a clobber build
        # because it won't find the input.
        'ninja_output_dir': 'ninja-localizable_string_tool',
        'ninja_product_dir':
          '../../../../xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)',
        # Gyp to rerun
        're_run_targets': [
          'ios/chrome/tools/strings/generate_localizable_strings.gyp',
        ],
      },
      'targets': [
        {
          'target_name': 'compile_generate_localizable_strings',
          'type': 'none',
          'includes': ['../../../../build/ios/mac_build.gypi'],
          'actions': [
            {
              'action_name': 'compile generate_localizable_strings',
              'inputs': [],
              'outputs': [],
              'action': [
                '<@(ninja_cmd)',
                'generate_localizable_strings',
              ],
              'message':
                'Generating the generate_localizable_strings executable',
            },
          ],
        },
        {
          'target_name': 'generate_localizable_strings',
          'type': 'none',
          'dependencies': [
            'compile_generate_localizable_strings',
          ],
          'actions': [
            {
              'action_name': 'copy generate_localizable_strings',
              'inputs': [
                '<(ninja_product_dir)/generate_localizable_strings',
              ],
              'outputs': [
                '<(PRODUCT_DIR)/generate_localizable_strings',
              ],
              'action': [
                'cp',
                '<(ninja_product_dir)/generate_localizable_strings',
                '<(PRODUCT_DIR)/generate_localizable_strings',
              ],
            },
          ],
        },
      ],
    }],
  ],
}