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 gyp.xcode_ninja | 8 import gyp.xcode_ninja |
9 import errno | 9 import errno |
10 import os | 10 import os |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 generator_additional_path_sections = [ | 62 generator_additional_path_sections = [ |
63 'mac_bundle_resources', | 63 'mac_bundle_resources', |
64 'mac_framework_headers', | 64 'mac_framework_headers', |
65 'mac_framework_private_headers', | 65 'mac_framework_private_headers', |
66 # 'mac_framework_dirs', input already handles _dirs endings. | 66 # 'mac_framework_dirs', input already handles _dirs endings. |
67 ] | 67 ] |
68 | 68 |
69 # The Xcode-specific keys that exist on targets and aren't moved down to | 69 # The Xcode-specific keys that exist on targets and aren't moved down to |
70 # configurations. | 70 # configurations. |
71 generator_additional_non_configuration_keys = [ | 71 generator_additional_non_configuration_keys = [ |
| 72 'ios_app_extension', |
72 'mac_bundle', | 73 'mac_bundle', |
73 'mac_bundle_resources', | 74 'mac_bundle_resources', |
74 'mac_framework_headers', | 75 'mac_framework_headers', |
75 'mac_framework_private_headers', | 76 'mac_framework_private_headers', |
76 'mac_xctest_bundle', | 77 'mac_xctest_bundle', |
77 'xcode_create_dependents_test_runner', | 78 'xcode_create_dependents_test_runner', |
78 ] | 79 ] |
79 | 80 |
80 # We want to let any rules apply to files that are resources also. | 81 # We want to let any rules apply to files that are resources also. |
81 generator_extra_sources_for_rules = [ | 82 generator_extra_sources_for_rules = [ |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 # Set up the configurations for the target according to the list of names | 638 # Set up the configurations for the target according to the list of names |
638 # supplied. | 639 # supplied. |
639 xccl = CreateXCConfigurationList(configuration_names) | 640 xccl = CreateXCConfigurationList(configuration_names) |
640 | 641 |
641 # Create an XCTarget subclass object for the target. The type with | 642 # Create an XCTarget subclass object for the target. The type with |
642 # "+bundle" appended will be used if the target has "mac_bundle" set. | 643 # "+bundle" appended will be used if the target has "mac_bundle" set. |
643 # loadable_modules not in a mac_bundle are mapped to | 644 # loadable_modules not in a mac_bundle are mapped to |
644 # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets | 645 # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets |
645 # to create a single-file mh_bundle. | 646 # to create a single-file mh_bundle. |
646 _types = { | 647 _types = { |
647 'executable': 'com.apple.product-type.tool', | 648 'executable': 'com.apple.product-type.tool', |
648 'loadable_module': 'com.googlecode.gyp.xcode.bundle', | 649 'loadable_module': 'com.googlecode.gyp.xcode.bundle', |
649 'shared_library': 'com.apple.product-type.library.dynamic', | 650 'shared_library': 'com.apple.product-type.library.dynamic', |
650 'static_library': 'com.apple.product-type.library.static', | 651 'static_library': 'com.apple.product-type.library.static', |
651 'executable+bundle': 'com.apple.product-type.application', | 652 'executable+bundle': 'com.apple.product-type.application', |
652 'loadable_module+bundle': 'com.apple.product-type.bundle', | 653 'loadable_module+bundle': 'com.apple.product-type.bundle', |
653 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test', | 654 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test', |
654 'shared_library+bundle': 'com.apple.product-type.framework', | 655 'shared_library+bundle': 'com.apple.product-type.framework', |
| 656 'executable+extension+bundle': 'com.apple.product-type.app-extension', |
655 } | 657 } |
656 | 658 |
657 target_properties = { | 659 target_properties = { |
658 'buildConfigurationList': xccl, | 660 'buildConfigurationList': xccl, |
659 'name': target_name, | 661 'name': target_name, |
660 } | 662 } |
661 | 663 |
662 type = spec['type'] | 664 type = spec['type'] |
663 is_xctest = int(spec.get('mac_xctest_bundle', 0)) | 665 is_xctest = int(spec.get('mac_xctest_bundle', 0)) |
664 is_bundle = int(spec.get('mac_bundle', 0)) or is_xctest | 666 is_bundle = int(spec.get('mac_bundle', 0)) or is_xctest |
| 667 is_extension = int(spec.get('ios_app_extension', 0)) |
665 if type != 'none': | 668 if type != 'none': |
666 type_bundle_key = type | 669 type_bundle_key = type |
667 if is_xctest: | 670 if is_xctest: |
668 type_bundle_key += '+xctest' | 671 type_bundle_key += '+xctest' |
669 assert type == 'loadable_module', ( | 672 assert type == 'loadable_module', ( |
670 'mac_xctest_bundle targets must have type loadable_module ' | 673 'mac_xctest_bundle targets must have type loadable_module ' |
671 '(target %s)' % target_name) | 674 '(target %s)' % target_name) |
| 675 elif is_extension: |
| 676 assert is_bundle, ('ios_app_extension flag requires mac_bundle ' |
| 677 '(target %s)' % target_name) |
| 678 type_bundle_key += '+extension+bundle' |
672 elif is_bundle: | 679 elif is_bundle: |
673 type_bundle_key += '+bundle' | 680 type_bundle_key += '+bundle' |
674 | 681 |
675 xctarget_type = gyp.xcodeproj_file.PBXNativeTarget | 682 xctarget_type = gyp.xcodeproj_file.PBXNativeTarget |
676 try: | 683 try: |
677 target_properties['productType'] = _types[type_bundle_key] | 684 target_properties['productType'] = _types[type_bundle_key] |
678 except KeyError, e: | 685 except KeyError, e: |
679 gyp.common.ExceptionAppend(e, "-- unknown product type while " | 686 gyp.common.ExceptionAppend(e, "-- unknown product type while " |
680 "writing target %s" % target_name) | 687 "writing target %s" % target_name) |
681 raise | 688 raise |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 | 1234 |
1228 for build_file in build_files: | 1235 for build_file in build_files: |
1229 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) | 1236 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) |
1230 | 1237 |
1231 for build_file in build_files: | 1238 for build_file in build_files: |
1232 xcode_projects[build_file].Finalize2(xcode_targets, | 1239 xcode_projects[build_file].Finalize2(xcode_targets, |
1233 xcode_target_to_target_dict) | 1240 xcode_target_to_target_dict) |
1234 | 1241 |
1235 for build_file in build_files: | 1242 for build_file in build_files: |
1236 xcode_projects[build_file].Write() | 1243 xcode_projects[build_file].Write() |
OLD | NEW |