Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / testing / iossim / iossim.gyp
bloba5c9d30a891812cae78a90c98deae076daa36c9e
1 # Copyright (c) 2012 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.
6   'conditions': [
7     ['OS!="ios" or "<(GENERATOR)"=="ninja"', {
8       'targets': [
9         {
10           'target_name': 'iossim',
11           'toolsets': ['host'],
12           'type': 'executable',
13           'variables': {
14             'developer_dir': '<!(xcode-select -print-path)',
15             'iphone_sim_path': '<(developer_dir)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks',
16             'other_frameworks_path': '<(developer_dir)/../OtherFrameworks'
17           },
18           'dependencies': [
19             'third_party/class-dump/class-dump.gyp:class-dump#host',
20           ],
21           'include_dirs': [
22             '<(INTERMEDIATE_DIR)/iossim',
23           ],
24           'sources': [
25             'iossim.mm',
26             '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h',
27           ],
28           'libraries': [
29             '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
30           ],
31           'actions': [
32             {
33               'action_name': 'generate_iphone_sim_header',
34               'inputs': [
35                 '<(iphone_sim_path)/iPhoneSimulatorRemoteClient.framework/Versions/Current/iPhoneSimulatorRemoteClient',
36                 '<(PRODUCT_DIR)/class-dump',
37               ],
38               'outputs': [
39                 '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h'
40               ],
41               'action': [
42                 # Actions don't provide a way to redirect stdout, so a custom
43                 # script is invoked that will execute the first argument and write
44                 # the output to the file specified as the second argument.
45                 './redirect-stdout.sh',
46                 '<(PRODUCT_DIR)/class-dump -CiPhoneSimulator <(iphone_sim_path)/iPhoneSimulatorRemoteClient.framework',
47                 '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h',
48               ],
49               'message': 'Generating header',
50             },
51           ],
52         },
53       ],
54     }, {  # else, OS=="ios" and "<(GENERATOR)"!="ninja"
55       'variables': {
56         'ninja_output_dir': 'ninja-iossim',
57         'ninja_product_dir':
58           '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)',
59       },
60       'targets': [
61         {
62           'target_name': 'iossim',
63           'type': 'none',
64           'variables': {
65             # Gyp to rerun
66             're_run_targets': [
67                'testing/iossim/iossim.gyp',
68             ],
69           },
70           'includes': ['../../build/ios/mac_build.gypi'],
71           'actions': [
72             {
73               'action_name': 'compile iossim',
74               'inputs': [],
75               'outputs': [],
76               'action': [
77                 '<@(ninja_cmd)',
78                 'iossim',
79               ],
80               'message': 'Generating the iossim executable',
81             },
82           ],
83         },
84       ],
85     }],
86   ],