summaryrefslogtreecommitdiffstats
path: root/testing/iossim/iossim.gyp
blob: 2c1bd83e54aea74494b67e5f36160da58c69ed08 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Copyright (c) 2012 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.

{
  'conditions': [
    ['OS!="ios" or "<(GENERATOR)"=="ninja"', {
      'targets': [
        {
          'target_name': 'iossim',
          'toolsets': ['host'],
          'type': 'executable',
          'variables': {
            'developer_dir': '<!(xcode-select -print-path)',
            # TODO(lliabraa): Once all builders are on Xcode 6 this variable can
            # be removed and the actions gated by this variable can be run by
            # default (crbug.com/385030).
            'xcode_version': '<!(xcodebuild -version | grep Xcode | awk \'{print $2}\')',
          },
          'conditions': [
            ['xcode_version=="6.0"', {
              'variables': {
                'iphone_sim_path': '<(developer_dir)/../SharedFrameworks',
              },
              'defines': [
                'IOSSIM_USE_XCODE_6',
              ],
              'actions': [
                {
                  'action_name': 'generate_dvt_foundation_header',
                  'inputs': [
                    '<(iphone_sim_path)/DVTFoundation.framework/Versions/Current/DVTFoundation',
                    '<(PRODUCT_DIR)/class-dump',
                  ],
                  'outputs': [
                    '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h'
                  ],
                  'action': [
                    # Actions don't provide a way to redirect stdout, so a custom
                    # script is invoked that will execute the first argument and
                    # write the output to the file specified as the second argument.
                    # -I sorts classes, categories, and protocols by inheritance.
                    # -C <regex> only displays classes matching regular expression.
                    './redirect-stdout.sh',
                    '<(PRODUCT_DIR)/class-dump -CDVTStackBacktrace|DVTInvalidation|DVTMixIn <(iphone_sim_path)/DVTFoundation.framework',
                    '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h',
                  ],
                  'message': 'Generating DVTFoundation.h',
                },
                {
                  'action_name': 'generate_dvt_core_simulator',
                  'inputs': [
                    '<(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework/Versions/Current/CoreSimulator',
                    '<(PRODUCT_DIR)/class-dump',
                  ],
                  'outputs': [
                    '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h'
                  ],
                  'action': [
                    # Actions don't provide a way to redirect stdout, so a custom
                    # script is invoked that will execute the first argument and
                    # write the output to the file specified as the second argument.
                    # -I sorts classes, categories, and protocols by inheritance.
                    # -C <regex> only displays classes matching regular expression.
                    './redirect-stdout.sh',
                    '<(PRODUCT_DIR)/class-dump -CSim <(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework',
                    '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h',
                  ],
                  'message': 'Generating CoreSimulator.h',
                },
              ],  # actions
            }, {  # else: xcode_version!="6"
              'variables': {
                'iphone_sim_path': '<(developer_dir)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks',
              },
            }],  # xcode_version
          ],  # conditions
          'dependencies': [
            'third_party/class-dump/class-dump.gyp:class-dump#host',
          ],
          'include_dirs': [
            '<(INTERMEDIATE_DIR)/iossim',
          ],
          'sources': [
            'iossim.mm',
            '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h',
          ],
          'libraries': [
            '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
          ],
          'actions': [
            {
              'action_name': 'generate_dvt_iphone_sim_header',
              'inputs': [
                '<(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework/Versions/Current/DVTiPhoneSimulatorRemoteClient',
                '<(PRODUCT_DIR)/class-dump',
              ],
              'outputs': [
                '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h'
              ],
              'action': [
                # Actions don't provide a way to redirect stdout, so a custom
                # script is invoked that will execute the first argument and
                # write the output to the file specified as the second argument.
                # -I sorts classes, categories, and protocols by inheritance.
                # -C <regex> only displays classes matching regular expression.
                './redirect-stdout.sh',
                '<(PRODUCT_DIR)/class-dump -I -CiPhoneSimulator <(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework',
                '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h',
              ],
              'message': 'Generating DVTiPhoneSimulatorRemoteClient.h',
            },
          ],  # actions
          'xcode_settings': {
            'ARCHS': ['x86_64'],
            'WARNING_CFLAGS': [
              '-Wno-objc-property-no-attribute',
            ],
          },
        },
      ],
    }, {  # else, OS=="ios" and "<(GENERATOR)"!="ninja"
      'variables': {
        'ninja_output_dir': 'ninja-iossim',
        'ninja_product_dir':
          '$(SYMROOT)/<(ninja_output_dir)/<(CONFIGURATION_NAME)',
      },
      'targets': [
        {
          'target_name': 'iossim',
          'type': 'none',
          'variables': {
            # Gyp to rerun
            're_run_targets': [
               'testing/iossim/iossim.gyp',
            ],
          },
          'includes': ['../../build/ios/mac_build.gypi'],
          'actions': [
            {
              'action_name': 'compile iossim',
              'inputs': [],
              'outputs': [],
              'action': [
                '<@(ninja_cmd)',
                'iossim',
              ],
              'message': 'Generating the iossim executable',
            },
          ],
        },
      ],
    }],
  ],
}