Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / testing / iossim / iossim.gyp
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.
4
5 {
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             # TODO(lliabraa): Once all builders are on Xcode 6 this variable can
16             # be removed and the actions gated by this variable can be run by
17             # default (crbug.com/385030).
18             'xcode_version': '<!(xcodebuild -version | grep Xcode | awk \'{print $2}\')',
19           },
20           'conditions': [
21             ['xcode_version>="6.0"', {
22               'variables': {
23                 'iphone_sim_path': '<(developer_dir)/../SharedFrameworks',
24               },
25               'defines': [
26                 'IOSSIM_USE_XCODE_6',
27               ],
28               'xcode_settings': {
29                 # The CoreSimulator.h file generated by class-dump defines a
30                 # property of type |NSString*| and a setter for the property
31                 # that takes a parameter of type |id|. This type mismatch causes
32                 # a compiler warning, so turn off -Werror.
33                 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
34               },
35               'actions': [
36                 {
37                   'action_name': 'generate_dvt_foundation_header',
38                   'inputs': [
39                     '<(iphone_sim_path)/DVTFoundation.framework/Versions/Current/DVTFoundation',
40                     '<(PRODUCT_DIR)/class-dump',
41                   ],
42                   'outputs': [
43                     '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h'
44                   ],
45                   'action': [
46                     # Actions don't provide a way to redirect stdout, so a custom
47                     # script is invoked that will execute the first argument and
48                     # write the output to the file specified as the second argument.
49                     # -I sorts classes, categories, and protocols by inheritance.
50                     # -C <regex> only displays classes matching regular expression.
51                     './redirect-stdout.sh',
52                     '<(PRODUCT_DIR)/class-dump -CDVTStackBacktrace|DVTInvalidation|DVTMixIn <(iphone_sim_path)/DVTFoundation.framework',
53                     '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h',
54                   ],
55                   'message': 'Generating DVTFoundation.h',
56                 },
57                 {
58                   'action_name': 'generate_dvt_core_simulator',
59                   'inputs': [
60                     '<(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework/Versions/Current/CoreSimulator',
61                     '<(PRODUCT_DIR)/class-dump',
62                   ],
63                   'outputs': [
64                     '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h'
65                   ],
66                   'action': [
67                     # Actions don't provide a way to redirect stdout, so a custom
68                     # script is invoked that will execute the first argument and
69                     # write the output to the file specified as the second argument.
70                     # -I sorts classes, categories, and protocols by inheritance.
71                     # -C <regex> only displays classes matching regular expression.
72                     './redirect-stdout.sh',
73                     '<(PRODUCT_DIR)/class-dump -CSim <(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework',
74                     '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h',
75                   ],
76                   'message': 'Generating CoreSimulator.h',
77                 },
78               ],  # actions
79             }, {  # else: xcode_version<"6.0"
80               'variables': {
81                 'iphone_sim_path': '<(developer_dir)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks',
82               },
83             }],  # xcode_version
84           ],  # conditions
85           'dependencies': [
86             'third_party/class-dump/class-dump.gyp:class-dump#host',
87           ],
88           'include_dirs': [
89             '<(INTERMEDIATE_DIR)/iossim',
90           ],
91           'sources': [
92             'iossim.mm',
93             '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h',
94           ],
95           'libraries': [
96             '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
97           ],
98           'actions': [
99             {
100               'action_name': 'generate_dvt_iphone_sim_header',
101               'inputs': [
102                 '<(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework/Versions/Current/DVTiPhoneSimulatorRemoteClient',
103                 '<(PRODUCT_DIR)/class-dump',
104               ],
105               'outputs': [
106                 '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h'
107               ],
108               'action': [
109                 # Actions don't provide a way to redirect stdout, so a custom
110                 # script is invoked that will execute the first argument and
111                 # write the output to the file specified as the second argument.
112                 # -I sorts classes, categories, and protocols by inheritance.
113                 # -C <regex> only displays classes matching regular expression.
114                 './redirect-stdout.sh',
115                 '<(PRODUCT_DIR)/class-dump -I -CiPhoneSimulator <(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework',
116                 '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h',
117               ],
118               'message': 'Generating DVTiPhoneSimulatorRemoteClient.h',
119             },
120           ],  # actions
121           'xcode_settings': {
122             'ARCHS': ['x86_64'],
123             'WARNING_CFLAGS': [
124               '-Wno-objc-property-no-attribute',
125             ],
126           },
127         },
128       ],
129     }, {  # else, OS=="ios" and "<(GENERATOR)"!="ninja"
130       'variables': {
131         'ninja_output_dir': 'ninja-iossim',
132         'ninja_product_dir':
133           '$(SYMROOT)/<(ninja_output_dir)/<(CONFIGURATION_NAME)',
134       },
135       'targets': [
136         {
137           'target_name': 'iossim',
138           'type': 'none',
139           'variables': {
140             # Gyp to rerun
141             're_run_targets': [
142                'testing/iossim/iossim.gyp',
143             ],
144           },
145           'includes': ['../../build/ios/mac_build.gypi'],
146           'actions': [
147             {
148               'action_name': 'compile iossim',
149               'inputs': [],
150               'outputs': [],
151               'action': [
152                 '<@(ninja_cmd)',
153                 'iossim',
154               ],
155               'message': 'Generating the iossim executable',
156             },
157           ],
158         },
159       ],
160     }],
161   ],
162 }