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 'actions': [ 29 { 30 'action_name': 'generate_dvt_foundation_header', 31 'inputs': [ 32 '<(iphone_sim_path)/DVTFoundation.framework/Versions/Current/DVTFoundation', 33 '<(PRODUCT_DIR)/class-dump', 34 ], 35 'outputs': [ 36 '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h' 37 ], 38 'action': [ 39 # Actions don't provide a way to redirect stdout, so a custom 40 # script is invoked that will execute the first argument and 41 # write the output to the file specified as the second argument. 42 # -I sorts classes, categories, and protocols by inheritance. 43 # -C <regex> only displays classes matching regular expression. 44 './redirect-stdout.sh', 45 '<(PRODUCT_DIR)/class-dump -CDVTStackBacktrace|DVTInvalidation|DVTMixIn <(iphone_sim_path)/DVTFoundation.framework', 46 '<(INTERMEDIATE_DIR)/iossim/DVTFoundation.h', 47 ], 48 'message': 'Generating DVTFoundation.h', 49 }, 50 { 51 'action_name': 'generate_dvt_core_simulator', 52 'inputs': [ 53 '<(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework/Versions/Current/CoreSimulator', 54 '<(PRODUCT_DIR)/class-dump', 55 ], 56 'outputs': [ 57 '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h' 58 ], 59 'action': [ 60 # Actions don't provide a way to redirect stdout, so a custom 61 # script is invoked that will execute the first argument and 62 # write the output to the file specified as the second argument. 63 # -I sorts classes, categories, and protocols by inheritance. 64 # -C <regex> only displays classes matching regular expression. 65 './redirect-stdout.sh', 66 '<(PRODUCT_DIR)/class-dump -CSim <(developer_dir)/Library/PrivateFrameworks/CoreSimulator.framework', 67 '<(INTERMEDIATE_DIR)/iossim/CoreSimulator.h', 68 ], 69 'message': 'Generating CoreSimulator.h', 70 }, 71 ], # actions 72 }, { # else: xcode_version!="6" 73 'variables': { 74 'iphone_sim_path': '<(developer_dir)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks', 75 }, 76 }], # xcode_version 77 ], # conditions 78 'dependencies': [ 79 'third_party/class-dump/class-dump.gyp:class-dump#host', 80 ], 81 'include_dirs': [ 82 '<(INTERMEDIATE_DIR)/iossim', 83 ], 84 'sources': [ 85 'iossim.mm', 86 '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h', 87 ], 88 'libraries': [ 89 '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', 90 ], 91 'actions': [ 92 { 93 'action_name': 'generate_dvt_iphone_sim_header', 94 'inputs': [ 95 '<(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework/Versions/Current/DVTiPhoneSimulatorRemoteClient', 96 '<(PRODUCT_DIR)/class-dump', 97 ], 98 'outputs': [ 99 '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h' 100 ], 101 'action': [ 102 # Actions don't provide a way to redirect stdout, so a custom 103 # script is invoked that will execute the first argument and 104 # write the output to the file specified as the second argument. 105 # -I sorts classes, categories, and protocols by inheritance. 106 # -C <regex> only displays classes matching regular expression. 107 './redirect-stdout.sh', 108 '<(PRODUCT_DIR)/class-dump -I -CiPhoneSimulator <(iphone_sim_path)/DVTiPhoneSimulatorRemoteClient.framework', 109 '<(INTERMEDIATE_DIR)/iossim/DVTiPhoneSimulatorRemoteClient.h', 110 ], 111 'message': 'Generating DVTiPhoneSimulatorRemoteClient.h', 112 }, 113 ], # actions 114 'xcode_settings': { 115 'ARCHS': ['x86_64'], 116 'WARNING_CFLAGS': [ 117 '-Wno-objc-property-no-attribute', 118 ], 119 }, 120 }, 121 ], 122 }, { # else, OS=="ios" and "<(GENERATOR)"!="ninja" 123 'variables': { 124 'ninja_output_dir': 'ninja-iossim', 125 'ninja_product_dir': 126 '$(SYMROOT)/<(ninja_output_dir)/<(CONFIGURATION_NAME)', 127 }, 128 'targets': [ 129 { 130 'target_name': 'iossim', 131 'type': 'none', 132 'variables': { 133 # Gyp to rerun 134 're_run_targets': [ 135 'testing/iossim/iossim.gyp', 136 ], 137 }, 138 'includes': ['../../build/ios/mac_build.gypi'], 139 'actions': [ 140 { 141 'action_name': 'compile iossim', 142 'inputs': [], 143 'outputs': [], 144 'action': [ 145 '<@(ninja_cmd)', 146 'iossim', 147 ], 148 'message': 'Generating the iossim executable', 149 }, 150 ], 151 }, 152 ], 153 }], 154 ], 155 } 156