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

Side by Side Diff: pylib/gyp/generator/xcode.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 months 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
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 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 from __future__ import print_function
6
5 import filecmp 7 import filecmp
6 import gyp.common 8 import gyp.common
7 import gyp.xcodeproj_file 9 import gyp.xcodeproj_file
8 import gyp.xcode_ninja 10 import gyp.xcode_ninja
9 import errno 11 import errno
10 import os 12 import os
11 import sys 13 import sys
12 import posixpath 14 import posixpath
13 import re 15 import re
14 import shutil 16 import shutil
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 gyp.xcodeproj_file.XCProjectFile({'rootObject': self.project}) 123 gyp.xcodeproj_file.XCProjectFile({'rootObject': self.project})
122 self.build_file_dict = build_file_dict 124 self.build_file_dict = build_file_dict
123 125
124 # TODO(mark): add destructor that cleans up self.path if created_dir is 126 # TODO(mark): add destructor that cleans up self.path if created_dir is
125 # True and things didn't complete successfully. Or do something even 127 # True and things didn't complete successfully. Or do something even
126 # better with "try"? 128 # better with "try"?
127 self.created_dir = False 129 self.created_dir = False
128 try: 130 try:
129 os.makedirs(self.path) 131 os.makedirs(self.path)
130 self.created_dir = True 132 self.created_dir = True
131 except OSError, e: 133 except OSError as e:
132 if e.errno != errno.EEXIST: 134 if e.errno != errno.EEXIST:
133 raise 135 raise
134 136
135 def Finalize1(self, xcode_targets, serialize_all_tests): 137 def Finalize1(self, xcode_targets, serialize_all_tests):
136 # Collect a list of all of the build configuration names used by the 138 # Collect a list of all of the build configuration names used by the
137 # various targets in the file. It is very heavily advised to keep each 139 # various targets in the file. It is very heavily advised to keep each
138 # target in an entire project (even across multiple project files) using 140 # target in an entire project (even across multiple project files) using
139 # the same set of configuration names. 141 # the same set of configuration names.
140 configurations = [] 142 configurations = []
141 for xct in self.project.GetProperty('targets'): 143 for xct in self.project.GetProperty('targets'):
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 177
176 # Set user-specified project-wide build settings and config files. This 178 # Set user-specified project-wide build settings and config files. This
177 # is intended to be used very sparingly. Really, almost everything should 179 # is intended to be used very sparingly. Really, almost everything should
178 # go into target-specific build settings sections. The project-wide 180 # go into target-specific build settings sections. The project-wide
179 # settings are only intended to be used in cases where Xcode attempts to 181 # settings are only intended to be used in cases where Xcode attempts to
180 # resolve variable references in a project context as opposed to a target 182 # resolve variable references in a project context as opposed to a target
181 # context, such as when resolving sourceTree references while building up 183 # context, such as when resolving sourceTree references while building up
182 # the tree tree view for UI display. 184 # the tree tree view for UI display.
183 # Any values set globally are applied to all configurations, then any 185 # Any values set globally are applied to all configurations, then any
184 # per-configuration values are applied. 186 # per-configuration values are applied.
185 for xck, xcv in self.build_file_dict.get('xcode_settings', {}).iteritems(): 187 for xck, xcv in self.build_file_dict.get('xcode_settings', {}).items():
186 xccl.SetBuildSetting(xck, xcv) 188 xccl.SetBuildSetting(xck, xcv)
187 if 'xcode_config_file' in self.build_file_dict: 189 if 'xcode_config_file' in self.build_file_dict:
188 config_ref = self.project.AddOrGetFileInRootGroup( 190 config_ref = self.project.AddOrGetFileInRootGroup(
189 self.build_file_dict['xcode_config_file']) 191 self.build_file_dict['xcode_config_file'])
190 xccl.SetBaseConfiguration(config_ref) 192 xccl.SetBaseConfiguration(config_ref)
191 build_file_configurations = self.build_file_dict.get('configurations', {}) 193 build_file_configurations = self.build_file_dict.get('configurations', {})
192 if build_file_configurations: 194 if build_file_configurations:
193 for config_name in configurations: 195 for config_name in configurations:
194 build_file_configuration_named = \ 196 build_file_configuration_named = \
195 build_file_configurations.get(config_name, {}) 197 build_file_configurations.get(config_name, {})
196 if build_file_configuration_named: 198 if build_file_configuration_named:
197 xcc = xccl.ConfigurationNamed(config_name) 199 xcc = xccl.ConfigurationNamed(config_name)
198 for xck, xcv in build_file_configuration_named.get('xcode_settings', 200 for xck, xcv in build_file_configuration_named.get('xcode_settings',
199 {}).iteritems(): 201 {}).items():
200 xcc.SetBuildSetting(xck, xcv) 202 xcc.SetBuildSetting(xck, xcv)
201 if 'xcode_config_file' in build_file_configuration_named: 203 if 'xcode_config_file' in build_file_configuration_named:
202 config_ref = self.project.AddOrGetFileInRootGroup( 204 config_ref = self.project.AddOrGetFileInRootGroup(
203 build_file_configurations[config_name]['xcode_config_file']) 205 build_file_configurations[config_name]['xcode_config_file'])
204 xcc.SetBaseConfiguration(config_ref) 206 xcc.SetBaseConfiguration(config_ref)
205 207
206 # Sort the targets based on how they appeared in the input. 208 # Sort the targets based on how they appeared in the input.
207 # TODO(mark): Like a lot of other things here, this assumes internal 209 # TODO(mark): Like a lot of other things here, this assumes internal
208 # knowledge of PBXProject - in this case, of its "targets" property. 210 # knowledge of PBXProject - in this case, of its "targets" property.
209 211
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 script = '' 267 script = ''
266 if command.get('working_directory'): 268 if command.get('working_directory'):
267 script = script + 'cd "%s"\n' % \ 269 script = script + 'cd "%s"\n' % \
268 gyp.xcodeproj_file.ConvertVariablesToShellSyntax( 270 gyp.xcodeproj_file.ConvertVariablesToShellSyntax(
269 command.get('working_directory')) 271 command.get('working_directory'))
270 272
271 if command.get('environment'): 273 if command.get('environment'):
272 script = script + "\n".join( 274 script = script + "\n".join(
273 ['export %s="%s"' % 275 ['export %s="%s"' %
274 (key, gyp.xcodeproj_file.ConvertVariablesToShellSyntax(val)) 276 (key, gyp.xcodeproj_file.ConvertVariablesToShellSyntax(val))
275 for (key, val) in command.get('environment').iteritems()]) + "\n" 277 for (key, val) in command.get('environment').items()]) + "\n"
276 278
277 # Some test end up using sockets, files on disk, etc. and can get 279 # Some test end up using sockets, files on disk, etc. and can get
278 # confused if more then one test runs at a time. The generator 280 # confused if more then one test runs at a time. The generator
279 # flag 'xcode_serialize_all_test_runs' controls the forcing of all 281 # flag 'xcode_serialize_all_test_runs' controls the forcing of all
280 # tests serially. It defaults to True. To get serial runs this 282 # tests serially. It defaults to True. To get serial runs this
281 # little bit of python does the same as the linux flock utility to 283 # little bit of python does the same as the linux flock utility to
282 # make sure only one runs at a time. 284 # make sure only one runs at a time.
283 command_prefix = '' 285 command_prefix = ''
284 if serialize_all_tests: 286 if serialize_all_tests:
285 command_prefix = \ 287 command_prefix = \
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 # the new project file is simply deleted. Xcode properly detects a file 438 # the new project file is simply deleted. Xcode properly detects a file
437 # being renamed over an open project file as a change and so it remains 439 # being renamed over an open project file as a change and so it remains
438 # able to present the "project file changed" sheet under this system. 440 # able to present the "project file changed" sheet under this system.
439 # Writing to a temporary file first also avoids the possible problem of 441 # Writing to a temporary file first also avoids the possible problem of
440 # Xcode rereading an incomplete project file. 442 # Xcode rereading an incomplete project file.
441 (output_fd, new_pbxproj_path) = \ 443 (output_fd, new_pbxproj_path) = \
442 tempfile.mkstemp(suffix='.tmp', prefix='project.pbxproj.gyp.', 444 tempfile.mkstemp(suffix='.tmp', prefix='project.pbxproj.gyp.',
443 dir=self.path) 445 dir=self.path)
444 446
445 try: 447 try:
446 output_file = os.fdopen(output_fd, 'wb') 448 output_file = os.fdopen(output_fd, 'w')
447 449
448 self.project_file.Print(output_file) 450 self.project_file.Print(output_file)
449 output_file.close() 451 output_file.close()
450 452
451 pbxproj_path = os.path.join(self.path, 'project.pbxproj') 453 pbxproj_path = os.path.join(self.path, 'project.pbxproj')
452 454
453 same = False 455 same = False
454 try: 456 try:
455 same = filecmp.cmp(pbxproj_path, new_pbxproj_path, False) 457 same = filecmp.cmp(pbxproj_path, new_pbxproj_path, False)
456 except OSError, e: 458 except OSError as e:
457 if e.errno != errno.ENOENT: 459 if e.errno != errno.ENOENT:
458 raise 460 raise
459 461
460 if same: 462 if same:
461 # The new file is identical to the old one, just get rid of the new 463 # The new file is identical to the old one, just get rid of the new
462 # one. 464 # one.
463 os.unlink(new_pbxproj_path) 465 os.unlink(new_pbxproj_path)
464 else: 466 else:
465 # The new file is different from the old one, or there is no old one. 467 # The new file is different from the old one, or there is no old one.
466 # Rename the new file to the permanent name. 468 # Rename the new file to the permanent name.
467 # 469 #
468 # tempfile.mkstemp uses an overly restrictive mode, resulting in a 470 # tempfile.mkstemp uses an overly restrictive mode, resulting in a
469 # file that can only be read by the owner, regardless of the umask. 471 # file that can only be read by the owner, regardless of the umask.
470 # There's no reason to not respect the umask here, which means that 472 # There's no reason to not respect the umask here, which means that
471 # an extra hoop is required to fetch it and reset the new file's mode. 473 # an extra hoop is required to fetch it and reset the new file's mode.
472 # 474 #
473 # No way to get the umask without setting a new one? Set a safe one 475 # No way to get the umask without setting a new one? Set a safe one
474 # and then set it back to the old value. 476 # and then set it back to the old value.
475 umask = os.umask(077) 477 umask = os.umask(0o77)
476 os.umask(umask) 478 os.umask(umask)
477 479
478 os.chmod(new_pbxproj_path, 0666 & ~umask) 480 os.chmod(new_pbxproj_path, 0o666 & ~umask)
479 os.rename(new_pbxproj_path, pbxproj_path) 481 os.rename(new_pbxproj_path, pbxproj_path)
480 482
481 except Exception: 483 except Exception:
482 # Don't leave turds behind. In fact, if this code was responsible for 484 # Don't leave turds behind. In fact, if this code was responsible for
483 # creating the xcodeproj directory, get rid of that too. 485 # creating the xcodeproj directory, get rid of that too.
484 os.unlink(new_pbxproj_path) 486 os.unlink(new_pbxproj_path)
485 if self.created_dir: 487 if self.created_dir:
486 shutil.rmtree(self.path, True) 488 shutil.rmtree(self.path, True)
487 raise 489 raise
488 490
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 """We must escape the defines that we give to XCode so that it knows not to 560 """We must escape the defines that we give to XCode so that it knows not to
559 split on spaces and to respect backslash and quote literals. However, we 561 split on spaces and to respect backslash and quote literals. However, we
560 must not quote the define, or Xcode will incorrectly intepret variables 562 must not quote the define, or Xcode will incorrectly intepret variables
561 especially $(inherited).""" 563 especially $(inherited)."""
562 return re.sub(_xcode_define_re, r'\\\1', s) 564 return re.sub(_xcode_define_re, r'\\\1', s)
563 565
564 566
565 def PerformBuild(data, configurations, params): 567 def PerformBuild(data, configurations, params):
566 options = params['options'] 568 options = params['options']
567 569
568 for build_file, build_file_dict in data.iteritems(): 570 for build_file, build_file_dict in data.items():
569 (build_file_root, build_file_ext) = os.path.splitext(build_file) 571 (build_file_root, build_file_ext) = os.path.splitext(build_file)
570 if build_file_ext != '.gyp': 572 if build_file_ext != '.gyp':
571 continue 573 continue
572 xcodeproj_path = build_file_root + options.suffix + '.xcodeproj' 574 xcodeproj_path = build_file_root + options.suffix + '.xcodeproj'
573 if options.generator_output: 575 if options.generator_output:
574 xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) 576 xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path)
575 577
576 for config in configurations: 578 for config in configurations:
577 arguments = ['xcodebuild', '-project', xcodeproj_path] 579 arguments = ['xcodebuild', '-project', xcodeproj_path]
578 arguments += ['-configuration', config] 580 arguments += ['-configuration', config]
579 print "Building [%s]: %s" % (config, arguments) 581 print("Building [%s]: %s" % (config, arguments))
580 subprocess.check_call(arguments) 582 subprocess.check_call(arguments)
581 583
582 584
583 def CalculateGeneratorInputInfo(params): 585 def CalculateGeneratorInputInfo(params):
584 toplevel = params['options'].toplevel_dir 586 toplevel = params['options'].toplevel_dir
585 if params.get('flavor') == 'ninja': 587 if params.get('flavor') == 'ninja':
586 generator_dir = os.path.relpath(params['options'].generator_output or '.') 588 generator_dir = os.path.relpath(params['options'].generator_output or '.')
587 output_dir = params.get('generator_flags', {}).get('output_dir', 'out') 589 output_dir = params.get('generator_flags', {}).get('output_dir', 'out')
588 output_dir = os.path.normpath(os.path.join(generator_dir, output_dir)) 590 output_dir = os.path.normpath(os.path.join(generator_dir, output_dir))
589 qualified_out_dir = os.path.normpath(os.path.join( 591 qualified_out_dir = os.path.normpath(os.path.join(
(...skipping 27 matching lines...) Expand all
617 619
618 # Format upgrade_check_project_version with leading zeros as needed. 620 # Format upgrade_check_project_version with leading zeros as needed.
619 if upgrade_check_project_version: 621 if upgrade_check_project_version:
620 upgrade_check_project_version = str(upgrade_check_project_version) 622 upgrade_check_project_version = str(upgrade_check_project_version)
621 while len(upgrade_check_project_version) < 4: 623 while len(upgrade_check_project_version) < 4:
622 upgrade_check_project_version = '0' + upgrade_check_project_version 624 upgrade_check_project_version = '0' + upgrade_check_project_version
623 625
624 skip_excluded_files = \ 626 skip_excluded_files = \
625 not generator_flags.get('xcode_list_excluded_files', True) 627 not generator_flags.get('xcode_list_excluded_files', True)
626 xcode_projects = {} 628 xcode_projects = {}
627 for build_file, build_file_dict in data.iteritems(): 629 for build_file, build_file_dict in data.items():
628 (build_file_root, build_file_ext) = os.path.splitext(build_file) 630 (build_file_root, build_file_ext) = os.path.splitext(build_file)
629 if build_file_ext != '.gyp': 631 if build_file_ext != '.gyp':
630 continue 632 continue
631 xcodeproj_path = build_file_root + options.suffix + '.xcodeproj' 633 xcodeproj_path = build_file_root + options.suffix + '.xcodeproj'
632 if options.generator_output: 634 if options.generator_output:
633 xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) 635 xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path)
634 xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict) 636 xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict)
635 xcode_projects[build_file] = xcp 637 xcode_projects[build_file] = xcp
636 pbxp = xcp.project 638 pbxp = xcp.project
637 639
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 elif is_watch_app: 731 elif is_watch_app:
730 assert is_bundle, ('ios_watch_app flag requires mac_bundle ' 732 assert is_bundle, ('ios_watch_app flag requires mac_bundle '
731 '(target %s)' % target_name) 733 '(target %s)' % target_name)
732 type_bundle_key += '+watch+bundle' 734 type_bundle_key += '+watch+bundle'
733 elif is_bundle: 735 elif is_bundle:
734 type_bundle_key += '+bundle' 736 type_bundle_key += '+bundle'
735 737
736 xctarget_type = gyp.xcodeproj_file.PBXNativeTarget 738 xctarget_type = gyp.xcodeproj_file.PBXNativeTarget
737 try: 739 try:
738 target_properties['productType'] = _types[type_bundle_key] 740 target_properties['productType'] = _types[type_bundle_key]
739 except KeyError, e: 741 except KeyError as e:
740 gyp.common.ExceptionAppend(e, "-- unknown product type while " 742 gyp.common.ExceptionAppend(e, "-- unknown product type while "
741 "writing target %s" % target_name) 743 "writing target %s" % target_name)
742 raise 744 raise
743 else: 745 else:
744 xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget 746 xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget
745 assert not is_bundle, ( 747 assert not is_bundle, (
746 'mac_bundle targets cannot have type none (target "%s")' % 748 'mac_bundle targets cannot have type none (target "%s")' %
747 target_name) 749 target_name)
748 assert not is_xctest, ( 750 assert not is_xctest, (
749 'mac_xctest_bundle targets cannot have type none (target "%s")' % 751 'mac_xctest_bundle targets cannot have type none (target "%s")' %
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 1000
999 if len(concrete_outputs_all) > 0: 1001 if len(concrete_outputs_all) > 0:
1000 # TODO(mark): There's a possibilty for collision here. Consider 1002 # TODO(mark): There's a possibilty for collision here. Consider
1001 # target "t" rule "A_r" and target "t_A" rule "r". 1003 # target "t" rule "A_r" and target "t_A" rule "r".
1002 makefile_name = '%s.make' % re.sub( 1004 makefile_name = '%s.make' % re.sub(
1003 '[^a-zA-Z0-9_]', '_' , '%s_%s' % (target_name, rule['rule_name'])) 1005 '[^a-zA-Z0-9_]', '_' , '%s_%s' % (target_name, rule['rule_name']))
1004 makefile_path = os.path.join(xcode_projects[build_file].path, 1006 makefile_path = os.path.join(xcode_projects[build_file].path,
1005 makefile_name) 1007 makefile_name)
1006 # TODO(mark): try/close? Write to a temporary file and swap it only 1008 # TODO(mark): try/close? Write to a temporary file and swap it only
1007 # if it's got changes? 1009 # if it's got changes?
1008 makefile = open(makefile_path, 'wb') 1010 makefile = open(makefile_path, 'w')
1009 1011
1010 # make will build the first target in the makefile by default. By 1012 # make will build the first target in the makefile by default. By
1011 # convention, it's called "all". List all (or at least one) 1013 # convention, it's called "all". List all (or at least one)
1012 # concrete output for each rule source as a prerequisite of the "all" 1014 # concrete output for each rule source as a prerequisite of the "all"
1013 # target. 1015 # target.
1014 makefile.write('all: \\\n') 1016 makefile.write('all: \\\n')
1015 for concrete_output_index in \ 1017 for concrete_output_index, concrete_output_by_rule_source in \
1016 xrange(0, len(concrete_outputs_by_rule_source)): 1018 enumerate(concrete_outputs_by_rule_source):
1017 # Only list the first (index [0]) concrete output of each input 1019 # Only list the first (index [0]) concrete output of each input
1018 # in the "all" target. Otherwise, a parallel make (-j > 1) would 1020 # in the "all" target. Otherwise, a parallel make (-j > 1) would
1019 # attempt to process each input multiple times simultaneously. 1021 # attempt to process each input multiple times simultaneously.
1020 # Otherwise, "all" could just contain the entire list of 1022 # Otherwise, "all" could just contain the entire list of
1021 # concrete_outputs_all. 1023 # concrete_outputs_all.
1022 concrete_output = \ 1024 concrete_output = concrete_output_by_rule_source[0]
1023 concrete_outputs_by_rule_source[concrete_output_index][0]
1024 if concrete_output_index == len(concrete_outputs_by_rule_source) - 1: 1025 if concrete_output_index == len(concrete_outputs_by_rule_source) - 1:
1025 eol = '' 1026 eol = ''
1026 else: 1027 else:
1027 eol = ' \\' 1028 eol = ' \\'
1028 makefile.write(' %s%s\n' % (concrete_output, eol)) 1029 makefile.write(' %s%s\n' % (concrete_output, eol))
1029 1030
1030 for (rule_source, concrete_outputs, message, action) in \ 1031 for (rule_source, concrete_outputs, message, action) in \
1031 zip(rule['rule_sources'], concrete_outputs_by_rule_source, 1032 zip(rule['rule_sources'], concrete_outputs_by_rule_source,
1032 messages, actions): 1033 messages, actions):
1033 makefile.write('\n') 1034 makefile.write('\n')
1034 1035
1035 # Add a rule that declares it can build each concrete output of a 1036 # Add a rule that declares it can build each concrete output of a
1036 # rule source. Collect the names of the directories that are 1037 # rule source. Collect the names of the directories that are
1037 # required. 1038 # required.
1038 concrete_output_dirs = [] 1039 concrete_output_dirs = []
1039 for concrete_output_index in xrange(0, len(concrete_outputs)): 1040 for concrete_output_index, concrete_output in \
1040 concrete_output = concrete_outputs[concrete_output_index] 1041 enumerate(concrete_outputs):
1041 if concrete_output_index == 0: 1042 if concrete_output_index == 0:
1042 bol = '' 1043 bol = ''
1043 else: 1044 else:
1044 bol = ' ' 1045 bol = ' '
1045 makefile.write('%s%s \\\n' % (bol, concrete_output)) 1046 makefile.write('%s%s \\\n' % (bol, concrete_output))
1046 1047
1047 concrete_output_dir = posixpath.dirname(concrete_output) 1048 concrete_output_dir = posixpath.dirname(concrete_output)
1048 if (concrete_output_dir and 1049 if (concrete_output_dir and
1049 concrete_output_dir not in concrete_output_dirs): 1050 concrete_output_dir not in concrete_output_dirs):
1050 concrete_output_dirs.append(concrete_output_dir) 1051 concrete_output_dirs.append(concrete_output_dir)
1051 1052
1052 makefile.write(' : \\\n') 1053 makefile.write(' : \\\n')
1053 1054
1054 # The prerequisites for this rule are the rule source itself and 1055 # The prerequisites for this rule are the rule source itself and
1055 # the set of additional rule inputs, if any. 1056 # the set of additional rule inputs, if any.
1056 prerequisites = [rule_source] 1057 prerequisites = [rule_source]
1057 prerequisites.extend(rule.get('inputs', [])) 1058 prerequisites.extend(rule.get('inputs', []))
1058 for prerequisite_index in xrange(0, len(prerequisites)): 1059 for prerequisite_index, prerequisite in enumerate(prerequisites):
1059 prerequisite = prerequisites[prerequisite_index]
1060 if prerequisite_index == len(prerequisites) - 1: 1060 if prerequisite_index == len(prerequisites) - 1:
1061 eol = '' 1061 eol = ''
1062 else: 1062 else:
1063 eol = ' \\' 1063 eol = ' \\'
1064 makefile.write(' %s%s\n' % (prerequisite, eol)) 1064 makefile.write(' %s%s\n' % (prerequisite, eol))
1065 1065
1066 # Make sure that output directories exist before executing the rule 1066 # Make sure that output directories exist before executing the rule
1067 # action. 1067 # action.
1068 if len(concrete_output_dirs) > 0: 1068 if len(concrete_output_dirs) > 0:
1069 makefile.write('\t@mkdir -p "%s"\n' % 1069 makefile.write('\t@mkdir -p "%s"\n' %
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 if library_dir not in xcode_standard_library_dirs and ( 1270 if library_dir not in xcode_standard_library_dirs and (
1271 not xcbc.HasBuildSetting(_library_search_paths_var) or 1271 not xcbc.HasBuildSetting(_library_search_paths_var) or
1272 library_dir not in xcbc.GetBuildSetting(_library_search_paths_var)): 1272 library_dir not in xcbc.GetBuildSetting(_library_search_paths_var)):
1273 xcbc.AppendBuildSetting(_library_search_paths_var, library_dir) 1273 xcbc.AppendBuildSetting(_library_search_paths_var, library_dir)
1274 1274
1275 if 'defines' in configuration: 1275 if 'defines' in configuration:
1276 for define in configuration['defines']: 1276 for define in configuration['defines']:
1277 set_define = EscapeXcodeDefine(define) 1277 set_define = EscapeXcodeDefine(define)
1278 xcbc.AppendBuildSetting('GCC_PREPROCESSOR_DEFINITIONS', set_define) 1278 xcbc.AppendBuildSetting('GCC_PREPROCESSOR_DEFINITIONS', set_define)
1279 if 'xcode_settings' in configuration: 1279 if 'xcode_settings' in configuration:
1280 for xck, xcv in configuration['xcode_settings'].iteritems(): 1280 for xck, xcv in configuration['xcode_settings'].items():
1281 xcbc.SetBuildSetting(xck, xcv) 1281 xcbc.SetBuildSetting(xck, xcv)
1282 if 'xcode_config_file' in configuration: 1282 if 'xcode_config_file' in configuration:
1283 config_ref = pbxp.AddOrGetFileInRootGroup( 1283 config_ref = pbxp.AddOrGetFileInRootGroup(
1284 configuration['xcode_config_file']) 1284 configuration['xcode_config_file'])
1285 xcbc.SetBaseConfiguration(config_ref) 1285 xcbc.SetBaseConfiguration(config_ref)
1286 1286
1287 build_files = [] 1287 build_files = []
1288 for build_file, build_file_dict in data.iteritems(): 1288 for build_file, build_file_dict in data.items():
1289 if build_file.endswith('.gyp'): 1289 if build_file.endswith('.gyp'):
1290 build_files.append(build_file) 1290 build_files.append(build_file)
1291 1291
1292 for build_file in build_files: 1292 for build_file in build_files:
1293 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) 1293 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests)
1294 1294
1295 for build_file in build_files: 1295 for build_file in build_files:
1296 xcode_projects[build_file].Finalize2(xcode_targets, 1296 xcode_projects[build_file].Finalize2(xcode_targets,
1297 xcode_target_to_target_dict) 1297 xcode_target_to_target_dict)
1298 1298
1299 for build_file in build_files: 1299 for build_file in build_files:
1300 xcode_projects[build_file].Write() 1300 xcode_projects[build_file].Write()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698