| OLD | NEW |
| 1 # Copyright (c) 2014 Google Inc. All rights reserved. | 1 # Copyright (c) 2014 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Xcode-ninja wrapper project file generator. | 5 """Xcode-ninja wrapper project file generator. |
| 6 | 6 |
| 7 This updates the data structures passed to the Xcode gyp generator to build | 7 This updates the data structures passed to the Xcode gyp generator to build |
| 8 with ninja instead. The Xcode project itself is transformed into a list of | 8 with ninja instead. The Xcode project itself is transformed into a list of |
| 9 executable targets, each with a build step to build with ninja, and a target | 9 executable targets, each with a build step to build with ninja, and a target |
| 10 with every source and resource file. This appears to sidestep some of the | 10 with every source and resource file. This appears to sidestep some of the |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 'default_configuration': 'Default', | 222 'default_configuration': 'Default', |
| 223 'mac_bundle': '0', | 223 'mac_bundle': '0', |
| 224 'type': 'executable' | 224 'type': 'executable' |
| 225 }, None) | 225 }, None) |
| 226 | 226 |
| 227 # Tell Xcode to look everywhere for headers. | 227 # Tell Xcode to look everywhere for headers. |
| 228 sources_target['configurations'] = {'Default': { 'include_dirs': [ depth ] } } | 228 sources_target['configurations'] = {'Default': { 'include_dirs': [ depth ] } } |
| 229 | 229 |
| 230 sources = [] | 230 sources = [] |
| 231 for target, target_dict in target_dicts.iteritems(): | 231 for target, target_dict in target_dicts.iteritems(): |
| 232 base = os.path.dirname(target) | 232 base = os.path.dirname(target) |
| 233 files = target_dict.get('sources', []) + \ | 233 files = target_dict.get('sources', []) + \ |
| 234 target_dict.get('mac_bundle_resources', []) | 234 target_dict.get('mac_bundle_resources', []) |
| 235 for action in target_dict.get('actions', []): |
| 236 files.extend(action.get('inputs', [])) |
| 235 # Remove files starting with $. These are mostly intermediate files for the | 237 # Remove files starting with $. These are mostly intermediate files for the |
| 236 # build system. | 238 # build system. |
| 237 files = [ file for file in files if not file.startswith('$')] | 239 files = [ file for file in files if not file.startswith('$')] |
| 238 | 240 |
| 239 # Make sources relative to root build file. | 241 # Make sources relative to root build file. |
| 240 relative_path = os.path.dirname(main_gyp) | 242 relative_path = os.path.dirname(main_gyp) |
| 241 sources += [ os.path.relpath(os.path.join(base, file), relative_path) | 243 sources += [ os.path.relpath(os.path.join(base, file), relative_path) |
| 242 for file in files ] | 244 for file in files ] |
| 243 | 245 |
| 244 sources_target['sources'] = sorted(set(sources)) | 246 sources_target['sources'] = sorted(set(sources)) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 259 new_data[sources_gyp] = {} | 261 new_data[sources_gyp] = {} |
| 260 new_data[sources_gyp]['targets'] = [] | 262 new_data[sources_gyp]['targets'] = [] |
| 261 new_data[sources_gyp]['included_files'] = [] | 263 new_data[sources_gyp]['included_files'] = [] |
| 262 new_data[sources_gyp]['xcode_settings'] = \ | 264 new_data[sources_gyp]['xcode_settings'] = \ |
| 263 data[orig_gyp].get('xcode_settings', {}) | 265 data[orig_gyp].get('xcode_settings', {}) |
| 264 new_data[sources_gyp]['targets'].append(new_data_target) | 266 new_data[sources_gyp]['targets'].append(new_data_target) |
| 265 | 267 |
| 266 # Write workspace to file. | 268 # Write workspace to file. |
| 267 _WriteWorkspace(main_gyp, sources_gyp, params) | 269 _WriteWorkspace(main_gyp, sources_gyp, params) |
| 268 return (new_target_list, new_target_dicts, new_data) | 270 return (new_target_list, new_target_dicts, new_data) |
| OLD | NEW |