OLD | NEW |
---|---|
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 'xcode_create_dependents_test_runner', | 75 'xcode_create_dependents_test_runner', |
76 'xctest_bundle', | |
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 |
85 # Xcode's standard set of library directories, which don't need to be duplicated | 86 # Xcode's standard set of library directories, which don't need to be duplicated |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_bundle = int(spec.get('mac_bundle', 0)) |
Mark Mentovai
2013/10/30 21:31:16
The name mac_bundle was chosen because platform-sp
jonwall
2013/10/30 22:03:15
Done.
| |
657 is_xctest = int(spec.get('xctest_bundle', 0)) | |
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 'xctest_bundle targets must have type loadable_module (target %s)' % | |
664 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 '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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 if int(action.get('process_outputs_as_sources', False)): | 773 if int(action.get('process_outputs_as_sources', False)): |
762 for output in action['outputs']: | 774 for output in action['outputs']: |
763 AddSourceToTarget(output, type, pbxp, xct) | 775 AddSourceToTarget(output, type, pbxp, xct) |
764 | 776 |
765 if int(action.get('process_outputs_as_mac_bundle_resources', False)): | 777 if int(action.get('process_outputs_as_mac_bundle_resources', False)): |
766 for output in action['outputs']: | 778 for output in action['outputs']: |
767 AddResourceToTarget(output, pbxp, xct) | 779 AddResourceToTarget(output, pbxp, xct) |
768 | 780 |
769 # tgt_mac_bundle_resources holds the list of bundle resources so | 781 # tgt_mac_bundle_resources holds the list of bundle resources so |
770 # the rule processing can check against it. | 782 # the rule processing can check against it. |
771 if is_bundle: | 783 if is_bundle: |
Mark Mentovai
2013/10/30 21:31:16
It’s still possible for something to be both xctes
jonwall
2013/10/30 22:03:15
Done - hopefully I understood your intention here?
| |
772 tgt_mac_bundle_resources = spec.get('mac_bundle_resources', []) | 784 tgt_mac_bundle_resources = spec.get('mac_bundle_resources', []) |
773 else: | 785 else: |
774 tgt_mac_bundle_resources = [] | 786 tgt_mac_bundle_resources = [] |
775 | 787 |
776 # Add custom shell script phases driving "make" for "rules" sections. | 788 # Add custom shell script phases driving "make" for "rules" sections. |
777 # | 789 # |
778 # Xcode's built-in rule support is almost powerful enough to use directly, | 790 # Xcode's built-in rule support is almost powerful enough to use directly, |
779 # but there are a few significant deficiencies that render them unusable. | 791 # but there are a few significant deficiencies that render them unusable. |
780 # There are workarounds for some of its inadequacies, but in aggregate, | 792 # There are workarounds for some of its inadequacies, but in aggregate, |
781 # the workarounds added complexity to the generator, and some workarounds | 793 # the workarounds added complexity to the generator, and some workarounds |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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() |
OLD | NEW |