| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 # configurations. | 70 # configurations. |
| 71 generator_additional_non_configuration_keys = [ | 71 generator_additional_non_configuration_keys = [ |
| 72 'ios_app_extension', | 72 'ios_app_extension', |
| 73 'ios_watch_app', | 73 'ios_watch_app', |
| 74 'ios_watchkit_extension', | 74 'ios_watchkit_extension', |
| 75 'mac_bundle', | 75 'mac_bundle', |
| 76 'mac_bundle_resources', | 76 'mac_bundle_resources', |
| 77 'mac_framework_headers', | 77 'mac_framework_headers', |
| 78 'mac_framework_private_headers', | 78 'mac_framework_private_headers', |
| 79 'mac_xctest_bundle', | 79 'mac_xctest_bundle', |
| 80 'mac_xcuitest_bundle', |
| 80 'xcode_create_dependents_test_runner', | 81 'xcode_create_dependents_test_runner', |
| 81 ] | 82 ] |
| 82 | 83 |
| 83 # We want to let any rules apply to files that are resources also. | 84 # We want to let any rules apply to files that are resources also. |
| 84 generator_extra_sources_for_rules = [ | 85 generator_extra_sources_for_rules = [ |
| 85 'mac_bundle_resources', | 86 'mac_bundle_resources', |
| 86 'mac_framework_headers', | 87 'mac_framework_headers', |
| 87 'mac_framework_private_headers', | 88 'mac_framework_private_headers', |
| 88 ] | 89 ] |
| 89 | 90 |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 # to create a single-file mh_bundle. | 685 # to create a single-file mh_bundle. |
| 685 _types = { | 686 _types = { |
| 686 'executable': 'com.apple.product-type.tool', | 687 'executable': 'com.apple.product-type.tool', |
| 687 'loadable_module': 'com.googlecode.gyp.xcode.bundle', | 688 'loadable_module': 'com.googlecode.gyp.xcode.bundle', |
| 688 'shared_library': 'com.apple.product-type.library.dynamic', | 689 'shared_library': 'com.apple.product-type.library.dynamic', |
| 689 'static_library': 'com.apple.product-type.library.static', | 690 'static_library': 'com.apple.product-type.library.static', |
| 690 'mac_kernel_extension': 'com.apple.product-type.kernel-extension', | 691 'mac_kernel_extension': 'com.apple.product-type.kernel-extension', |
| 691 'executable+bundle': 'com.apple.product-type.application', | 692 'executable+bundle': 'com.apple.product-type.application', |
| 692 'loadable_module+bundle': 'com.apple.product-type.bundle', | 693 'loadable_module+bundle': 'com.apple.product-type.bundle', |
| 693 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test', | 694 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test', |
| 695 'loadable_module+xcuitest': 'com.apple.product-type.bundle.ui-testing', |
| 694 'shared_library+bundle': 'com.apple.product-type.framework', | 696 'shared_library+bundle': 'com.apple.product-type.framework', |
| 695 'executable+extension+bundle': 'com.apple.product-type.app-extension', | 697 'executable+extension+bundle': 'com.apple.product-type.app-extension', |
| 696 'executable+watch+extension+bundle': | 698 'executable+watch+extension+bundle': |
| 697 'com.apple.product-type.watchkit-extension', | 699 'com.apple.product-type.watchkit-extension', |
| 698 'executable+watch+bundle': | 700 'executable+watch+bundle': |
| 699 'com.apple.product-type.application.watchapp', | 701 'com.apple.product-type.application.watchapp', |
| 700 'mac_kernel_extension+bundle': 'com.apple.product-type.kernel-extension', | 702 'mac_kernel_extension+bundle': 'com.apple.product-type.kernel-extension', |
| 701 } | 703 } |
| 702 | 704 |
| 703 target_properties = { | 705 target_properties = { |
| 704 'buildConfigurationList': xccl, | 706 'buildConfigurationList': xccl, |
| 705 'name': target_name, | 707 'name': target_name, |
| 706 } | 708 } |
| 707 | 709 |
| 708 type = spec['type'] | 710 type = spec['type'] |
| 709 is_xctest = int(spec.get('mac_xctest_bundle', 0)) | 711 is_xctest = int(spec.get('mac_xctest_bundle', 0)) |
| 712 is_xcuitest = int(spec.get('mac_xcuitest_bundle', 0)) |
| 710 is_bundle = int(spec.get('mac_bundle', 0)) or is_xctest | 713 is_bundle = int(spec.get('mac_bundle', 0)) or is_xctest |
| 711 is_app_extension = int(spec.get('ios_app_extension', 0)) | 714 is_app_extension = int(spec.get('ios_app_extension', 0)) |
| 712 is_watchkit_extension = int(spec.get('ios_watchkit_extension', 0)) | 715 is_watchkit_extension = int(spec.get('ios_watchkit_extension', 0)) |
| 713 is_watch_app = int(spec.get('ios_watch_app', 0)) | 716 is_watch_app = int(spec.get('ios_watch_app', 0)) |
| 714 if type != 'none': | 717 if type != 'none': |
| 715 type_bundle_key = type | 718 type_bundle_key = type |
| 716 if is_xctest: | 719 if is_xcuitest: |
| 720 type_bundle_key += '+xcuitest' |
| 721 assert type == 'loadable_module', ( |
| 722 'mac_xcuitest_bundle targets must have type loadable_module ' |
| 723 '(target %s)' % target_name) |
| 724 elif is_xctest: |
| 717 type_bundle_key += '+xctest' | 725 type_bundle_key += '+xctest' |
| 718 assert type == 'loadable_module', ( | 726 assert type == 'loadable_module', ( |
| 719 'mac_xctest_bundle targets must have type loadable_module ' | 727 'mac_xctest_bundle targets must have type loadable_module ' |
| 720 '(target %s)' % target_name) | 728 '(target %s)' % target_name) |
| 721 elif is_app_extension: | 729 elif is_app_extension: |
| 722 assert is_bundle, ('ios_app_extension flag requires mac_bundle ' | 730 assert is_bundle, ('ios_app_extension flag requires mac_bundle ' |
| 723 '(target %s)' % target_name) | 731 '(target %s)' % target_name) |
| 724 type_bundle_key += '+extension+bundle' | 732 type_bundle_key += '+extension+bundle' |
| 725 elif is_watchkit_extension: | 733 elif is_watchkit_extension: |
| 726 assert is_bundle, ('ios_watchkit_extension flag requires mac_bundle ' | 734 assert is_bundle, ('ios_watchkit_extension flag requires mac_bundle ' |
| (...skipping 11 matching lines...) Expand all Loading... |
| 738 target_properties['productType'] = _types[type_bundle_key] | 746 target_properties['productType'] = _types[type_bundle_key] |
| 739 except KeyError, e: | 747 except KeyError, e: |
| 740 gyp.common.ExceptionAppend(e, "-- unknown product type while " | 748 gyp.common.ExceptionAppend(e, "-- unknown product type while " |
| 741 "writing target %s" % target_name) | 749 "writing target %s" % target_name) |
| 742 raise | 750 raise |
| 743 else: | 751 else: |
| 744 xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget | 752 xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget |
| 745 assert not is_bundle, ( | 753 assert not is_bundle, ( |
| 746 'mac_bundle targets cannot have type none (target "%s")' % | 754 'mac_bundle targets cannot have type none (target "%s")' % |
| 747 target_name) | 755 target_name) |
| 756 assert not is_xcuitest, ( |
| 757 'mac_xcuitest_bundle targets cannot have type none (target "%s")' % |
| 758 target_name) |
| 748 assert not is_xctest, ( | 759 assert not is_xctest, ( |
| 749 'mac_xctest_bundle targets cannot have type none (target "%s")' % | 760 'mac_xctest_bundle targets cannot have type none (target "%s")' % |
| 750 target_name) | 761 target_name) |
| 751 | 762 |
| 752 target_product_name = spec.get('product_name') | 763 target_product_name = spec.get('product_name') |
| 753 if target_product_name is not None: | 764 if target_product_name is not None: |
| 754 target_properties['productName'] = target_product_name | 765 target_properties['productName'] = target_product_name |
| 755 | 766 |
| 756 xct = xctarget_type(target_properties, parent=pbxp, | 767 xct = xctarget_type(target_properties, parent=pbxp, |
| 757 force_outdir=spec.get('product_dir'), | 768 force_outdir=spec.get('product_dir'), |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 | 1302 |
| 1292 for build_file in build_files: | 1303 for build_file in build_files: |
| 1293 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) | 1304 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) |
| 1294 | 1305 |
| 1295 for build_file in build_files: | 1306 for build_file in build_files: |
| 1296 xcode_projects[build_file].Finalize2(xcode_targets, | 1307 xcode_projects[build_file].Finalize2(xcode_targets, |
| 1297 xcode_target_to_target_dict) | 1308 xcode_target_to_target_dict) |
| 1298 | 1309 |
| 1299 for build_file in build_files: | 1310 for build_file in build_files: |
| 1300 xcode_projects[build_file].Write() | 1311 xcode_projects[build_file].Write() |
| OLD | NEW |