| 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 """ | 5 """ |
| 6 This module contains classes that help to emulate xcodebuild behavior on top of | 6 This module contains classes that help to emulate xcodebuild behavior on top of |
| 7 other build systems, such as make and ninja. | 7 other build systems, such as make and ninja. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import copy | 10 import copy |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 Chromium.app/Contents/Resources. Only valid for bundles.""" | 295 Chromium.app/Contents/Resources. Only valid for bundles.""" |
| 296 assert self._IsBundle() | 296 assert self._IsBundle() |
| 297 if self.isIOS: | 297 if self.isIOS: |
| 298 return self.GetBundleContentsFolderPath() | 298 return self.GetBundleContentsFolderPath() |
| 299 return os.path.join(self.GetBundleContentsFolderPath(), 'Resources') | 299 return os.path.join(self.GetBundleContentsFolderPath(), 'Resources') |
| 300 | 300 |
| 301 def GetBundlePlistPath(self): | 301 def GetBundlePlistPath(self): |
| 302 """Returns the qualified path to the bundle's plist file. E.g. | 302 """Returns the qualified path to the bundle's plist file. E.g. |
| 303 Chromium.app/Contents/Info.plist. Only valid for bundles.""" | 303 Chromium.app/Contents/Info.plist. Only valid for bundles.""" |
| 304 assert self._IsBundle() | 304 assert self._IsBundle() |
| 305 if self.spec['type'] in ('executable', 'loadable_module'): | 305 if self.isIOS or self.spec['type'] in ('executable', 'loadable_module'): |
| 306 return os.path.join(self.GetBundleContentsFolderPath(), 'Info.plist') | 306 return os.path.join(self.GetBundleContentsFolderPath(), 'Info.plist') |
| 307 else: | 307 else: |
| 308 return os.path.join(self.GetBundleContentsFolderPath(), | 308 return os.path.join(self.GetBundleContentsFolderPath(), |
| 309 'Resources', 'Info.plist') | 309 'Resources', 'Info.plist') |
| 310 | 310 |
| 311 def GetProductType(self): | 311 def GetProductType(self): |
| 312 """Returns the PRODUCT_TYPE of this target.""" | 312 """Returns the PRODUCT_TYPE of this target.""" |
| 313 if self._IsIosAppExtension(): | 313 if self._IsIosAppExtension(): |
| 314 assert self._IsBundle(), ('ios_app_extension flag requires mac_bundle ' | 314 assert self._IsBundle(), ('ios_app_extension flag requires mac_bundle ' |
| 315 '(target %s)' % self.spec['target_name']) | 315 '(target %s)' % self.spec['target_name']) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 if 'IPHONEOS_DEPLOYMENT_TARGET' in self._Settings(): | 457 if 'IPHONEOS_DEPLOYMENT_TARGET' in self._Settings(): |
| 458 # TODO: Implement this better? | 458 # TODO: Implement this better? |
| 459 sdk_path_basename = os.path.basename(self._SdkPath()) | 459 sdk_path_basename = os.path.basename(self._SdkPath()) |
| 460 if sdk_path_basename.lower().startswith('iphonesimulator'): | 460 if sdk_path_basename.lower().startswith('iphonesimulator'): |
| 461 self._Appendf(lst, 'IPHONEOS_DEPLOYMENT_TARGET', | 461 self._Appendf(lst, 'IPHONEOS_DEPLOYMENT_TARGET', |
| 462 '-mios-simulator-version-min=%s') | 462 '-mios-simulator-version-min=%s') |
| 463 else: | 463 else: |
| 464 self._Appendf(lst, 'IPHONEOS_DEPLOYMENT_TARGET', | 464 self._Appendf(lst, 'IPHONEOS_DEPLOYMENT_TARGET', |
| 465 '-miphoneos-version-min=%s') | 465 '-miphoneos-version-min=%s') |
| 466 | 466 |
| 467 def GetCflags(self, configname, arch=None): | 467 def GetCflags(self, configname, gyp_to_build_path, arch=None): |
| 468 """Returns flags that need to be added to .c, .cc, .m, and .mm | 468 """Returns flags that need to be added to .c, .cc, .m, and .mm |
| 469 compilations.""" | 469 compilations.""" |
| 470 # This functions (and the similar ones below) do not offer complete | 470 # This functions (and the similar ones below) do not offer complete |
| 471 # emulation of all xcode_settings keys. They're implemented on demand. | 471 # emulation of all xcode_settings keys. They're implemented on demand. |
| 472 | 472 |
| 473 self.configname = configname | 473 self.configname = configname |
| 474 cflags = [] | 474 cflags = [] |
| 475 | 475 |
| 476 sdk_root = self._SdkPath() | 476 sdk_root = self._SdkPath() |
| 477 if 'SDKROOT' in self._Settings() and sdk_root: | 477 if 'SDKROOT' in self._Settings() and sdk_root: |
| 478 cflags.append('-isysroot %s' % sdk_root) | 478 cflags.append('-isysroot %s' % sdk_root) |
| 479 | 479 |
| 480 if self._Test('CLANG_WARN_CONSTANT_CONVERSION', 'YES', default='NO'): | 480 if self._Test('CLANG_WARN_CONSTANT_CONVERSION', 'YES', default='NO'): |
| 481 cflags.append('-Wconstant-conversion') | 481 cflags.append('-Wconstant-conversion') |
| 482 | 482 |
| 483 if self._AreModulesEnabled(): |
| 484 cflags.append('-fmodules') |
| 485 module_cache_path = self._Settings().get( |
| 486 'CLANG_MODULE_CACHE_PATH', self._GetDefaultClangModuleCachePath()) |
| 487 if arch: |
| 488 module_cache_path = os.path.join(module_cache_path, arch) |
| 489 cflags.append('-fmodules-cache-path=\'%s\'' % module_cache_path) |
| 490 if self._IsModuleDefined(): |
| 491 cflags.append('-Xclang -fmodule-implementation-of -Xclang ' + |
| 492 self._GetProductModuleName()) |
| 493 cflags.append('-F.') |
| 494 |
| 483 if self._Test('GCC_CHAR_IS_UNSIGNED_CHAR', 'YES', default='NO'): | 495 if self._Test('GCC_CHAR_IS_UNSIGNED_CHAR', 'YES', default='NO'): |
| 484 cflags.append('-funsigned-char') | 496 cflags.append('-funsigned-char') |
| 485 | 497 |
| 486 if self._Test('GCC_CW_ASM_SYNTAX', 'YES', default='YES'): | 498 if self._Test('GCC_CW_ASM_SYNTAX', 'YES', default='YES'): |
| 487 cflags.append('-fasm-blocks') | 499 cflags.append('-fasm-blocks') |
| 488 | 500 |
| 489 if 'GCC_DYNAMIC_NO_PIC' in self._Settings(): | 501 if 'GCC_DYNAMIC_NO_PIC' in self._Settings(): |
| 490 if self._Settings()['GCC_DYNAMIC_NO_PIC'] == 'YES': | 502 if self._Settings()['GCC_DYNAMIC_NO_PIC'] == 'YES': |
| 491 cflags.append('-mdynamic-no-pic') | 503 cflags.append('-mdynamic-no-pic') |
| 492 else: | 504 else: |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 580 |
| 569 cflags += self._Settings().get('WARNING_CFLAGS', []) | 581 cflags += self._Settings().get('WARNING_CFLAGS', []) |
| 570 | 582 |
| 571 if sdk_root: | 583 if sdk_root: |
| 572 framework_root = sdk_root | 584 framework_root = sdk_root |
| 573 else: | 585 else: |
| 574 framework_root = '' | 586 framework_root = '' |
| 575 config = self.spec['configurations'][self.configname] | 587 config = self.spec['configurations'][self.configname] |
| 576 framework_dirs = config.get('mac_framework_dirs', []) | 588 framework_dirs = config.get('mac_framework_dirs', []) |
| 577 for directory in framework_dirs: | 589 for directory in framework_dirs: |
| 578 cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root)) | 590 cflags.append('-F' + gyp_to_build_path(directory)) |
| 579 | 591 |
| 580 self.configname = None | 592 self.configname = None |
| 581 return cflags | 593 return cflags |
| 582 | 594 |
| 595 def AreModulesEnabled(self, configname): |
| 596 self.configname = configname |
| 597 res = self._AreModulesEnabled() |
| 598 self.configname = None |
| 599 return res |
| 600 |
| 601 def _AreModulesEnabled(self): |
| 602 res = self._Test('CLANG_ENABLE_MODULES', 'YES', default='NO') |
| 603 return res |
| 604 |
| 605 def IsModuleDefined(self, configname): |
| 606 self.configname = configname |
| 607 res = self._IsModuleDefined() |
| 608 self.configname = None |
| 609 return res |
| 610 |
| 611 def _IsModuleDefined(self): |
| 612 res = self._Test('DEFINES_MODULE', 'YES', default='NO') |
| 613 return res |
| 614 |
| 615 def IsSwiftWMOEnabled(self, configname): |
| 616 self.configname = configname |
| 617 res = self._IsSwiftWMOEnabled() |
| 618 self.configname = None |
| 619 return res |
| 620 |
| 621 def _IsSwiftWMOEnabled(self): |
| 622 return self._Test('SWIFT_OPTIMIZATION_LEVEL', '-Owholemodule', default='-O') |
| 623 |
| 624 def GetProductModuleName(self, configname): |
| 625 self.configname = configname |
| 626 swift_module_name = self._GetProductModuleName() |
| 627 self.configname = None |
| 628 return swift_module_name |
| 629 |
| 630 def _GetProductModuleName(self): |
| 631 default_module_name = self.spec['target_name'].replace('-', '_') |
| 632 return self._Settings().get( |
| 633 'PRODUCT_MODULE_NAME', default_module_name) |
| 634 |
| 635 def GetSwiftHeaderPath(self, configname, gyp_path_to_build_path, arch=None): |
| 636 self.configname = configname |
| 637 swift_header_path = self._GetSwiftHeaderPath(gyp_path_to_build_path, arch) |
| 638 self.configname = None |
| 639 return swift_header_path |
| 640 |
| 641 def _GetSwiftHeaderPath(self, gyp_path_to_build_path, arch): |
| 642 swift_header_name = self._Settings().get( |
| 643 'SWIFT_OBJC_INTERFACE_HEADER_NAME', |
| 644 self._GetProductModuleName() + '-Swift.h') |
| 645 # SWIFT_OBJC_INTERFACE_HEADER_NAME must just a file name without path |
| 646 assert not os.path.dirname(swift_header_name) |
| 647 if arch: |
| 648 swift_header_name = re.sub(r'\.h$', '.' + arch + '.h', swift_header_name) |
| 649 swift_header_path = os.path.join('$!INTERMEDIATE_DIR', swift_header_name) |
| 650 swift_header_path = gyp_path_to_build_path(swift_header_path) |
| 651 return swift_header_path |
| 652 |
| 653 def _GetCommonLibsPath(self): |
| 654 developer_dir = subprocess.check_output(['xcode-select', '-p']).strip() |
| 655 base_toolchain_path = os.path.join( |
| 656 developer_dir, 'Toolchains/XcodeDefault.xctoolchain') |
| 657 base_toolchain_path = os.path.normpath(base_toolchain_path) |
| 658 |
| 659 libs_path = os.path.join(base_toolchain_path, 'usr', 'lib') |
| 660 assert os.path.exists(libs_path) |
| 661 return libs_path |
| 662 |
| 663 def GetPlatform(self, configname): |
| 664 sdk_path_basename = os.path.basename(self._SdkPath(configname)) |
| 665 if sdk_path_basename.lower().startswith('iphonesimulator'): |
| 666 platform = 'iphonesimulator' |
| 667 elif sdk_path_basename.lower().startswith('iphoneos'): |
| 668 platform = 'iphoneos' |
| 669 elif sdk_path_basename.lower().startswith('macosx'): |
| 670 platform = 'macosx' |
| 671 else: |
| 672 assert False, 'Unexpected platform' |
| 673 |
| 674 return platform |
| 675 |
| 676 def _GetDefaultClangModuleCachePath(self): |
| 677 return os.path.join(os.path.expanduser('~'), |
| 678 'Library/Developer/Xcode/DerivedData/ModuleCache') |
| 679 |
| 680 def _GetSwiftCommonFlags(self, gyp_path_to_build_path, arch): |
| 681 assert arch |
| 682 |
| 683 swift_flags = [] |
| 684 swift_flags.append('-enable-objc-interop') |
| 685 |
| 686 if self._IsModuleDefined(): |
| 687 swift_flags.append('-import-underlying-module') |
| 688 |
| 689 self._Appendf(swift_flags, 'IPHONEOS_DEPLOYMENT_TARGET', |
| 690 '-target ' + arch + '-apple-ios%s') |
| 691 self._Appendf(swift_flags, 'MACOSX_DEPLOYMENT_TARGET', |
| 692 '-target ' + arch + '-apple-macosx%s') |
| 693 |
| 694 swift_flags.append('-sdk ' + self._SdkPath()) |
| 695 |
| 696 swift_flags.append('-g') |
| 697 |
| 698 swift_flags.append('-parse-as-library') |
| 699 |
| 700 self._Appendf(swift_flags, |
| 701 'CLANG_MODULE_CACHE_PATH', |
| 702 '-module-cache-path \'%s\'', |
| 703 self._GetDefaultClangModuleCachePath()) |
| 704 |
| 705 swift_flags.append('-module-name ' + self._GetProductModuleName()) |
| 706 |
| 707 if self._Settings().get('SWIFT_OBJC_BRIDGING_HEADER'): |
| 708 import_header = self._Settings().get('SWIFT_OBJC_BRIDGING_HEADER') |
| 709 import_header = gyp_path_to_build_path(import_header) |
| 710 swift_flags.append('-import-objc-header \'' + import_header + '\'') |
| 711 |
| 712 config = self.spec['configurations'][self.configname] |
| 713 framework_dirs = config.get('mac_framework_dirs', []) |
| 714 sdk_root = self._SdkPath() |
| 715 for directory in framework_dirs: |
| 716 swift_flags.append('-F' + gyp_path_to_build_path(directory)) |
| 717 |
| 718 swift_flags.append('-F.') |
| 719 |
| 720 swift_flags.append('-I.') |
| 721 for i in config.get('include_dirs', []): |
| 722 swift_flags.append('-I' + gyp_path_to_build_path(i)) |
| 723 |
| 724 return swift_flags |
| 725 |
| 726 def GetBundleFrameworksFolderPath(self): |
| 727 return os.path.join(self.GetBundleContentsFolderPath(), 'Frameworks') |
| 728 |
| 729 def GetBundlePublicHeadersFolderPath(self): |
| 730 return os.path.join(self.GetBundleContentsFolderPath(), 'Headers') |
| 731 |
| 732 def GetBundlePrivateHeadersFolderPath(self): |
| 733 return os.path.join(self.GetBundleContentsFolderPath(), 'PrivateHeaders') |
| 734 |
| 735 def GetBundleModulesFolderPath(self): |
| 736 return os.path.join(self.GetBundleContentsFolderPath(), 'Modules') |
| 737 |
| 738 def GetSwiftCompileFlags(self, configname, gyp_path_to_build_path, arch): |
| 739 self.configname = configname |
| 740 |
| 741 swift_flags = self._GetSwiftCommonFlags(gyp_path_to_build_path, arch) |
| 742 |
| 743 if self._IsSwiftWMOEnabled(): |
| 744 swift_flags.append('-O') |
| 745 else: |
| 746 self._Appendf(swift_flags, 'SWIFT_OPTIMIZATION_LEVEL', '%s', '-O') |
| 747 |
| 748 self.configname = None |
| 749 return swift_flags |
| 750 |
| 751 def GetSwiftMergeFlags(self, configname, gyp_path_to_build_path, arch): |
| 752 self.configname = configname |
| 753 |
| 754 swift_flags = self._GetSwiftCommonFlags(gyp_path_to_build_path, arch) |
| 755 |
| 756 self.configname = None |
| 757 return swift_flags |
| 758 |
| 759 def GetSwiftLdflags(self, configname, arch_module_path): |
| 760 ldflags = [] |
| 761 platform = self.GetPlatform(configname) |
| 762 libs_path = self._GetCommonLibsPath() |
| 763 if self.isIOS: |
| 764 # Some crazy hack by Xcode for iOS7 Swift support |
| 765 arclib_path = os.path.join( |
| 766 libs_path, 'arc', 'libarclite_' + platform + '.a') |
| 767 assert os.path.isfile(arclib_path) |
| 768 ldflags.append('-Xlinker -force_load -Xlinker ' + arclib_path) |
| 769 |
| 770 swift_libs_path = os.path.join(libs_path, 'swift', platform) |
| 771 assert os.path.isdir(swift_libs_path) |
| 772 ldflags.append('-Xlinker -add_ast_path -Xlinker ' + arch_module_path) |
| 773 ldflags.append('-L' + swift_libs_path) |
| 774 return ldflags |
| 775 |
| 583 def GetCflagsC(self, configname): | 776 def GetCflagsC(self, configname): |
| 584 """Returns flags that need to be added to .c, and .m compilations.""" | 777 """Returns flags that need to be added to .c, and .m compilations.""" |
| 585 self.configname = configname | 778 self.configname = configname |
| 586 cflags_c = [] | 779 cflags_c = [] |
| 587 if self._Settings().get('GCC_C_LANGUAGE_STANDARD', '') == 'ansi': | 780 if self._Settings().get('GCC_C_LANGUAGE_STANDARD', '') == 'ansi': |
| 588 cflags_c.append('-ansi') | 781 cflags_c.append('-ansi') |
| 589 else: | 782 else: |
| 590 self._Appendf(cflags_c, 'GCC_C_LANGUAGE_STANDARD', '-std=%s') | 783 self._Appendf(cflags_c, 'GCC_C_LANGUAGE_STANDARD', '-std=%s') |
| 591 cflags_c += self._Settings().get('OTHER_CFLAGS', []) | 784 cflags_c += self._Settings().get('OTHER_CFLAGS', []) |
| 592 self.configname = None | 785 self.configname = None |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 ldflags.append('-isysroot ' + self._SdkPath()) | 988 ldflags.append('-isysroot ' + self._SdkPath()) |
| 796 | 989 |
| 797 for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []): | 990 for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []): |
| 798 ldflags.append('-L' + gyp_to_build_path(library_path)) | 991 ldflags.append('-L' + gyp_to_build_path(library_path)) |
| 799 | 992 |
| 800 if 'ORDER_FILE' in self._Settings(): | 993 if 'ORDER_FILE' in self._Settings(): |
| 801 ldflags.append('-Wl,-order_file ' + | 994 ldflags.append('-Wl,-order_file ' + |
| 802 '-Wl,' + gyp_to_build_path( | 995 '-Wl,' + gyp_to_build_path( |
| 803 self._Settings()['ORDER_FILE'])) | 996 self._Settings()['ORDER_FILE'])) |
| 804 | 997 |
| 998 if 'BUNDLE_LOADER' in self._Settings(): |
| 999 bundle_loader_path = gyp_to_build_path(self._Settings()['BUNDLE_LOADER']) |
| 1000 ldflags.append('-bundle_loader ' + bundle_loader_path) |
| 1001 |
| 805 if arch is not None: | 1002 if arch is not None: |
| 806 archs = [arch] | 1003 archs = [arch] |
| 807 else: | 1004 else: |
| 808 assert self.configname | 1005 assert self.configname |
| 809 archs = self.GetActiveArchs(self.configname) | 1006 archs = self.GetActiveArchs(self.configname) |
| 810 if len(archs) != 1: | 1007 if len(archs) != 1: |
| 811 # TODO: Supporting fat binaries will be annoying. | 1008 # TODO: Supporting fat binaries will be annoying. |
| 812 self._WarnUnimplemented('ARCHS') | 1009 self._WarnUnimplemented('ARCHS') |
| 813 archs = ['i386'] | 1010 archs = ['i386'] |
| 814 ldflags.append('-arch ' + archs[0]) | 1011 ldflags.append('-arch ' + archs[0]) |
| 815 | 1012 |
| 816 # Xcode adds the product directory by default. | 1013 # Xcode adds the product directory by default. |
| 817 ldflags.append('-L' + product_dir) | 1014 ldflags.append('-L' + product_dir) |
| 818 | 1015 |
| 819 install_name = self.GetInstallName() | 1016 install_name = self.GetInstallName() |
| 820 if install_name and self.spec['type'] != 'loadable_module': | 1017 if install_name and self.spec['type'] != 'loadable_module': |
| 821 ldflags.append('-install_name ' + install_name.replace(' ', r'\ ')) | 1018 ldflags.append('-install_name ' + install_name.replace(' ', r'\ ')) |
| 822 | 1019 |
| 823 for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []): | 1020 for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []): |
| 824 ldflags.append('-Wl,-rpath,' + rpath) | 1021 ldflags.append('-Xlinker -rpath -Xlinker ' + rpath) |
| 825 | 1022 |
| 826 sdk_root = self._SdkPath() | 1023 sdk_root = self._SdkPath() |
| 827 if not sdk_root: | 1024 if not sdk_root: |
| 828 sdk_root = '' | 1025 sdk_root = '' |
| 829 config = self.spec['configurations'][self.configname] | 1026 config = self.spec['configurations'][self.configname] |
| 830 framework_dirs = config.get('mac_framework_dirs', []) | 1027 framework_dirs = config.get('mac_framework_dirs', []) |
| 831 for directory in framework_dirs: | 1028 for directory in framework_dirs: |
| 832 ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) | 1029 ldflags.append('-F' + gyp_to_build_path(directory)) |
| 1030 |
| 1031 ldflags.append('-F.') |
| 833 | 1032 |
| 834 is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension() | 1033 is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension() |
| 835 if sdk_root and is_extension: | 1034 if sdk_root and is_extension: |
| 836 # Adds the link flags for extensions. These flags are common for all | 1035 # Adds the link flags for extensions. These flags are common for all |
| 837 # extensions and provide loader and main function. | 1036 # extensions and provide loader and main function. |
| 838 # These flags reflect the compilation options used by xcode to compile | 1037 # These flags reflect the compilation options used by xcode to compile |
| 839 # extensions. | 1038 # extensions. |
| 840 ldflags.append('-lpkstart') | 1039 ldflags.append('-lpkstart') |
| 841 if XcodeVersion() < '0900': | 1040 if XcodeVersion() < '0900': |
| 842 ldflags.append(sdk_root + | 1041 ldflags.append(sdk_root + |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 print 'Warning: Some codesign keys not implemented, ignoring: %s' % ( | 1186 print 'Warning: Some codesign keys not implemented, ignoring: %s' % ( |
| 988 ', '.join(sorted(unimpl))) | 1187 ', '.join(sorted(unimpl))) |
| 989 | 1188 |
| 990 return ['%s code-sign-bundle "%s" "%s" "%s" "%s"' % ( | 1189 return ['%s code-sign-bundle "%s" "%s" "%s" "%s"' % ( |
| 991 os.path.join('${TARGET_BUILD_DIR}', 'gyp-mac-tool'), key, | 1190 os.path.join('${TARGET_BUILD_DIR}', 'gyp-mac-tool'), key, |
| 992 settings.get('CODE_SIGN_RESOURCE_RULES_PATH', ''), | 1191 settings.get('CODE_SIGN_RESOURCE_RULES_PATH', ''), |
| 993 settings.get('CODE_SIGN_ENTITLEMENTS', ''), | 1192 settings.get('CODE_SIGN_ENTITLEMENTS', ''), |
| 994 settings.get('PROVISIONING_PROFILE', '')) | 1193 settings.get('PROVISIONING_PROFILE', '')) |
| 995 ] | 1194 ] |
| 996 | 1195 |
| 1196 def GetCodeSignIdentityKey(self, configname): |
| 1197 if not self.isIOS: |
| 1198 return None |
| 1199 |
| 1200 settings = self.xcode_settings[configname] |
| 1201 return self._GetIOSCodeSignIdentityKey(settings) |
| 1202 |
| 997 def _GetIOSCodeSignIdentityKey(self, settings): | 1203 def _GetIOSCodeSignIdentityKey(self, settings): |
| 998 identity = settings.get('CODE_SIGN_IDENTITY') | 1204 identity = settings.get('CODE_SIGN_IDENTITY') |
| 999 if not identity: | 1205 if not identity: |
| 1000 return None | 1206 return None |
| 1001 if identity not in XcodeSettings._codesigning_key_cache: | 1207 if identity not in XcodeSettings._codesigning_key_cache: |
| 1002 output = subprocess.check_output( | 1208 output = subprocess.check_output( |
| 1003 ['security', 'find-identity', '-p', 'codesigning', '-v']) | 1209 ['security', 'find-identity', '-p', 'codesigning', '-v']) |
| 1004 for line in output.splitlines(): | 1210 for line in output.splitlines(): |
| 1005 if identity in line: | 1211 if identity in line: |
| 1006 fingerprint = line.split()[1] | 1212 fingerprint = line.split()[1] |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 'INFOPLIST_PREPROCESSOR_DEFINITIONS', default='')) | 1612 'INFOPLIST_PREPROCESSOR_DEFINITIONS', default='')) |
| 1407 else: | 1613 else: |
| 1408 defines = [] | 1614 defines = [] |
| 1409 | 1615 |
| 1410 dest_plist = os.path.join(product_dir, xcode_settings.GetBundlePlistPath()) | 1616 dest_plist = os.path.join(product_dir, xcode_settings.GetBundlePlistPath()) |
| 1411 extra_env = xcode_settings.GetPerTargetSettings() | 1617 extra_env = xcode_settings.GetPerTargetSettings() |
| 1412 | 1618 |
| 1413 return info_plist, dest_plist, defines, extra_env | 1619 return info_plist, dest_plist, defines, extra_env |
| 1414 | 1620 |
| 1415 | 1621 |
| 1622 def IsSwiftSupported(): |
| 1623 xcode_version, _ = XcodeVersion() |
| 1624 # Xcode actually supports Swift since 0600, |
| 1625 # but here is least version supported by this script. |
| 1626 # You should not try compiling Swift with Xcode less than 6.3 at all. |
| 1627 return xcode_version >= '0630' |
| 1628 |
| 1629 |
| 1416 def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, | 1630 def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, |
| 1417 additional_settings=None): | 1631 additional_settings=None): |
| 1418 """Return the environment variables that Xcode would set. See | 1632 """Return the environment variables that Xcode would set. See |
| 1419 http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference
/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_r
ef/doc/uid/TP40003931-CH3-SW153 | 1633 http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference
/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_r
ef/doc/uid/TP40003931-CH3-SW153 |
| 1420 for a full list. | 1634 for a full list. |
| 1421 | 1635 |
| 1422 Args: | 1636 Args: |
| 1423 xcode_settings: An XcodeSettings object. If this is None, this function | 1637 xcode_settings: An XcodeSettings object. If this is None, this function |
| 1424 returns an empty dict. | 1638 returns an empty dict. |
| 1425 built_products_dir: Absolute path to the built products dir. | 1639 built_products_dir: Absolute path to the built products dir. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 if toolset == 'target': | 1815 if toolset == 'target': |
| 1602 iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' | 1816 iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' |
| 1603 return targets | 1817 return targets |
| 1604 | 1818 |
| 1605 def CloneConfigurationForDeviceAndEmulator(target_dicts): | 1819 def CloneConfigurationForDeviceAndEmulator(target_dicts): |
| 1606 """If |target_dicts| contains any iOS targets, automatically create -iphoneos | 1820 """If |target_dicts| contains any iOS targets, automatically create -iphoneos |
| 1607 targets for iOS device builds.""" | 1821 targets for iOS device builds.""" |
| 1608 if _HasIOSTarget(target_dicts): | 1822 if _HasIOSTarget(target_dicts): |
| 1609 return _AddIOSDeviceConfigurations(target_dicts) | 1823 return _AddIOSDeviceConfigurations(target_dicts) |
| 1610 return target_dicts | 1824 return target_dicts |
| OLD | NEW |