Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: pylib/gyp/xcode_ninja.py

Issue 421053005: Fix: xcode-ninja should generate Xcode workspace into generator_output (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@Fix-Xcode-ninja-workspace-2
Patch Set: Rebase onto 421453003 Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/generator-output/gyptest-actions.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 major performance headaches experienced using complex projects and large number 11 major performance headaches experienced using complex projects and large number
12 of targets within Xcode. 12 of targets within Xcode.
13 """ 13 """
14 14
15 import errno 15 import errno
16 import gyp.generator.ninja 16 import gyp.generator.ninja
17 import os 17 import os
18 import re 18 import re
19 import xml.sax.saxutils 19 import xml.sax.saxutils
20 20
21 21
22 def _WriteWorkspace(main_gyp, sources_gyp): 22 def _WriteWorkspace(main_gyp, sources_gyp, params):
23 """ Create a workspace to wrap main and sources gyp paths. """ 23 """ Create a workspace to wrap main and sources gyp paths. """
24 (build_file_root, build_file_ext) = os.path.splitext(main_gyp) 24 (build_file_root, build_file_ext) = os.path.splitext(main_gyp)
25 workspace_path = build_file_root + '.xcworkspace' 25 workspace_path = build_file_root + '.xcworkspace'
26 options = params['options']
27 if options.generator_output:
28 workspace_path = os.path.join(options.generator_output, workspace_path)
26 try: 29 try:
27 os.makedirs(workspace_path) 30 os.makedirs(workspace_path)
28 except OSError, e: 31 except OSError, e:
29 if e.errno != errno.EEXIST: 32 if e.errno != errno.EEXIST:
30 raise 33 raise
31 output_string = '<?xml version="1.0" encoding="UTF-8"?>\n' + \ 34 output_string = '<?xml version="1.0" encoding="UTF-8"?>\n' + \
32 '<Workspace version = "1.0">\n' 35 '<Workspace version = "1.0">\n'
33 for gyp_name in [main_gyp, sources_gyp]: 36 for gyp_name in [main_gyp, sources_gyp]:
34 name = os.path.splitext(os.path.basename(gyp_name))[0] + '.xcodeproj' 37 name = os.path.splitext(os.path.basename(gyp_name))[0] + '.xcodeproj'
35 name = xml.sax.saxutils.quoteattr("group:" + name) 38 name = xml.sax.saxutils.quoteattr("group:" + name)
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 new_data_target['_DEPTH'] = depth 251 new_data_target['_DEPTH'] = depth
249 new_data_target['toolset'] = "target" 252 new_data_target['toolset'] = "target"
250 new_data[sources_gyp] = {} 253 new_data[sources_gyp] = {}
251 new_data[sources_gyp]['targets'] = [] 254 new_data[sources_gyp]['targets'] = []
252 new_data[sources_gyp]['included_files'] = [] 255 new_data[sources_gyp]['included_files'] = []
253 new_data[sources_gyp]['xcode_settings'] = \ 256 new_data[sources_gyp]['xcode_settings'] = \
254 data[orig_gyp].get('xcode_settings', {}) 257 data[orig_gyp].get('xcode_settings', {})
255 new_data[sources_gyp]['targets'].append(new_data_target) 258 new_data[sources_gyp]['targets'].append(new_data_target)
256 259
257 # Write workspace to file. 260 # Write workspace to file.
258 _WriteWorkspace(main_gyp, sources_gyp) 261 _WriteWorkspace(main_gyp, sources_gyp, params)
259 return (new_target_list, new_target_dicts, new_data) 262 return (new_target_list, new_target_dicts, new_data)
OLDNEW
« no previous file with comments | « no previous file | test/generator-output/gyptest-actions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698