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

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

Issue 51413002: Adds generator support for Xcode 5 xctest targets. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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 import filecmp 5 import filecmp
6 import gyp.common 6 import gyp.common
7 import gyp.xcodeproj_file 7 import gyp.xcodeproj_file
8 import errno 8 import errno
9 import os 9 import os
10 import sys 10 import sys
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 # 'mac_framework_dirs', input already handles _dirs endings. 65 # 'mac_framework_dirs', input already handles _dirs endings.
66 ] 66 ]
67 67
68 # The Xcode-specific keys that exist on targets and aren't moved down to 68 # The Xcode-specific keys that exist on targets and aren't moved down to
69 # configurations. 69 # configurations.
70 generator_additional_non_configuration_keys = [ 70 generator_additional_non_configuration_keys = [
71 'mac_bundle', 71 'mac_bundle',
72 'mac_bundle_resources', 72 'mac_bundle_resources',
73 'mac_framework_headers', 73 'mac_framework_headers',
74 'mac_framework_private_headers', 74 'mac_framework_private_headers',
75 'mac_xctest_bundle',
75 'xcode_create_dependents_test_runner', 76 'xcode_create_dependents_test_runner',
76 ] 77 ]
77 78
78 # We want to let any rules apply to files that are resources also. 79 # We want to let any rules apply to files that are resources also.
79 generator_extra_sources_for_rules = [ 80 generator_extra_sources_for_rules = [
80 'mac_bundle_resources', 81 'mac_bundle_resources',
81 'mac_framework_headers', 82 'mac_framework_headers',
82 'mac_framework_private_headers', 83 'mac_framework_private_headers',
83 ] 84 ]
84 85
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 # loadable_modules not in a mac_bundle are mapped to 636 # loadable_modules not in a mac_bundle are mapped to
636 # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets 637 # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets
637 # to create a single-file mh_bundle. 638 # to create a single-file mh_bundle.
638 _types = { 639 _types = {
639 'executable': 'com.apple.product-type.tool', 640 'executable': 'com.apple.product-type.tool',
640 'loadable_module': 'com.googlecode.gyp.xcode.bundle', 641 'loadable_module': 'com.googlecode.gyp.xcode.bundle',
641 'shared_library': 'com.apple.product-type.library.dynamic', 642 'shared_library': 'com.apple.product-type.library.dynamic',
642 'static_library': 'com.apple.product-type.library.static', 643 'static_library': 'com.apple.product-type.library.static',
643 'executable+bundle': 'com.apple.product-type.application', 644 'executable+bundle': 'com.apple.product-type.application',
644 'loadable_module+bundle': 'com.apple.product-type.bundle', 645 'loadable_module+bundle': 'com.apple.product-type.bundle',
646 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test',
645 'shared_library+bundle': 'com.apple.product-type.framework', 647 'shared_library+bundle': 'com.apple.product-type.framework',
646 } 648 }
647 649
648 target_properties = { 650 target_properties = {
649 'buildConfigurationList': xccl, 651 'buildConfigurationList': xccl,
650 'name': target_name, 652 'name': target_name,
651 } 653 }
652 654
653 type = spec['type'] 655 type = spec['type']
654 is_bundle = int(spec.get('mac_bundle', 0)) 656 is_xctest = int(spec.get('mac_xctest_bundle', 0))
657 is_bundle = int(spec.get('mac_bundle', 0)) or is_xctest
655 if type != 'none': 658 if type != 'none':
656 type_bundle_key = type 659 type_bundle_key = type
657 if is_bundle: 660 if is_xctest:
661 type_bundle_key += '+xctest'
662 assert type == 'loadable_module', (
663 'mac_xctest_bundle targets must have type loadable_module '
664 '(target %s)' % target_name)
665 elif is_bundle:
658 type_bundle_key += '+bundle' 666 type_bundle_key += '+bundle'
667
659 xctarget_type = gyp.xcodeproj_file.PBXNativeTarget 668 xctarget_type = gyp.xcodeproj_file.PBXNativeTarget
660 try: 669 try:
661 target_properties['productType'] = _types[type_bundle_key] 670 target_properties['productType'] = _types[type_bundle_key]
662 except KeyError, e: 671 except KeyError, e:
663 gyp.common.ExceptionAppend(e, "-- unknown product type while " 672 gyp.common.ExceptionAppend(e, "-- unknown product type while "
664 "writing target %s" % target_name) 673 "writing target %s" % target_name)
665 raise 674 raise
666 else: 675 else:
667 xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget 676 xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget
668 assert not is_bundle, ( 677 assert not is_bundle, (
669 'mac_bundle targets cannot have type none (target "%s")' % 678 'mac_bundle targets cannot have type none (target "%s")' %
670 target_name) 679 target_name)
680 assert not is_xctest, (
681 'mac_xctest_bundle targets cannot have type none (target "%s")' %
682 target_name)
671 683
672 target_product_name = spec.get('product_name') 684 target_product_name = spec.get('product_name')
673 if target_product_name is not None: 685 if target_product_name is not None:
674 target_properties['productName'] = target_product_name 686 target_properties['productName'] = target_product_name
675 687
676 xct = xctarget_type(target_properties, parent=pbxp, 688 xct = xctarget_type(target_properties, parent=pbxp,
677 force_outdir=spec.get('product_dir'), 689 force_outdir=spec.get('product_dir'),
678 force_prefix=spec.get('product_prefix'), 690 force_prefix=spec.get('product_prefix'),
679 force_extension=spec.get('product_extension')) 691 force_extension=spec.get('product_extension'))
680 pbxp.AppendProperty('targets', xct) 692 pbxp.AppendProperty('targets', xct)
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 1215
1204 for build_file in build_files: 1216 for build_file in build_files:
1205 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) 1217 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests)
1206 1218
1207 for build_file in build_files: 1219 for build_file in build_files:
1208 xcode_projects[build_file].Finalize2(xcode_targets, 1220 xcode_projects[build_file].Finalize2(xcode_targets,
1209 xcode_target_to_target_dict) 1221 xcode_target_to_target_dict)
1210 1222
1211 for build_file in build_files: 1223 for build_file in build_files:
1212 xcode_projects[build_file].Write() 1224 xcode_projects[build_file].Write()
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/xcodeproj_file.py » ('j') | test/mac/xctest/test.xcodeproj/xcshareddata/xcschemes/classes.xcscheme » ('J')

Powered by Google App Engine
This is Rietveld 408576698