Changeset 190333 in webkit


Ignore:
Timestamp:
Sep 29, 2015 5:21:39 PM (9 years ago)
Author:
dbates@webkit.org
Message:

configure-xcode-for-ios-development does not work with Xcode 7
https://bugs.webkit.org/show_bug.cgi?id=149640

Reviewed by Alexey Proskuryakov.

When Xcode 7 is installed, running configure-xcode-for-ios-development dies with an error
because it cannot find the Xcode specification files for iOS simulator and device. These
files have moved to a new location in Xcode 7 distribution. Moreover we must add the
relevant definitions to the Xcode 7 specification files directly as opposed to creating
new specification files with the added definitions (as we did in older versions of Xcode)
in order for Xcode 7 to honor these definitions.

  • Scripts/configure-xcode-for-ios-development: Sorted forward declarations.

(updateXcodeSpecificationFilesForSDKIfNeeded): Added.
(updateXcode7SpecificationFile): Added.
(createLegacyXcodeSpecificationFilesForSDKIfNeeded): Formerly named createXcodeSpecificationFilesForSDKIfNeeded.
(writeXcodeSpecification): Moved congratulations line to caller so as to write out the
appropriate success message.
(mergeXcodeSpecificationWithSpecificationAndId): Formerly named createXcodeSpecificationFromSpecificationAndId.
(createXcodeSpecificationFilesForSDKIfNeeded): Deleted.
(createXcodeSpecificationFromSpecificationAndId): Deleted.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r190328 r190333  
     12015-09-29  Daniel Bates  <dabates@apple.com>
     2
     3        configure-xcode-for-ios-development does not work with Xcode 7
     4        https://bugs.webkit.org/show_bug.cgi?id=149640
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        When Xcode 7 is installed, running configure-xcode-for-ios-development dies with an error
     9        because it cannot find the Xcode specification files for iOS simulator and device. These
     10        files have moved to a new location in Xcode 7 distribution. Moreover we must add the
     11        relevant definitions to the Xcode 7 specification files directly as opposed to creating
     12        new specification files with the added definitions (as we did in older versions of Xcode)
     13        in order for Xcode 7 to honor these definitions.
     14
     15        * Scripts/configure-xcode-for-ios-development: Sorted forward declarations.
     16        (updateXcodeSpecificationFilesForSDKIfNeeded): Added.
     17        (updateXcode7SpecificationFile): Added.
     18        (createLegacyXcodeSpecificationFilesForSDKIfNeeded): Formerly named createXcodeSpecificationFilesForSDKIfNeeded.
     19        (writeXcodeSpecification): Moved congratulations line to caller so as to write out the
     20        appropriate success message.
     21        (mergeXcodeSpecificationWithSpecificationAndId): Formerly named createXcodeSpecificationFromSpecificationAndId.
     22        (createXcodeSpecificationFilesForSDKIfNeeded): Deleted.
     23        (createXcodeSpecificationFromSpecificationAndId): Deleted.
     24
    1252015-09-29  Brent Fulgham  <bfulgham@apple.com>
    226
  • trunk/Tools/Scripts/configure-xcode-for-ios-development

    r178979 r190333  
    2424
    2525# Checks if Xcode supports building a command line tool for the iOS Simulator.
    26 # If not, then creates xcspec files in the iOS Simulator SDK for a command line
     26# If not, then updates/creates xcspec files in the iOS SDK for a command line
    2727# tool product- and package- type using the definitions in the OS X SDK for the
    2828# same types.
     
    3131use warnings;
    3232
     33use Cwd qw(realpath);
    3334use English;
    3435use File::Basename;
     
    4142
    4243sub copyMissingHeadersToIPhoneOSSDKIfNeeded();
    43 sub createXcodeSpecificationFilesForSDKIfNeeded($);
    44 sub createXcodeSpecificationFromSpecificationAndId($$$);
     44sub createLegacyXcodeSpecificationFilesForSDKIfNeeded($);
     45sub mergeXcodeSpecificationWithSpecificationAndId($$$);
     46sub readXcodeSpecificationById($$);
    4547sub sdkDirectory($);
    4648sub sdkPlatformDirectory($);
    47 sub readXcodeSpecificationById($$);
     49sub updateXcode7SpecificationFile($);
     50sub updateXcodeSpecificationFilesForSDKIfNeeded($);
    4851sub xcodeSDKSpecificationsPath($);
    4952
     
    5154use constant COMMAND_LINE_PRODUCT_TYPE => "com.apple.product-type.tool";
    5255use constant SDK_TO_XCSPEC_NAME_MAP => +{ "iphoneos" => "iPhoneOS", "iphonesimulator" => "iPhone Simulator " };
     56use constant SDK_TO_PLUGIN_XCSPEC_NAME_MAP => +{ "iphoneos" => "Embedded-Device.xcspec", "iphonesimulator" => "Embedded-Simulator.xcspec" };
    5357
    5458# FIXME: We should only require running as root if needed. It's not necessary to run as root if
     
    6064
    6165for my $sdk (qw(iphoneos iphonesimulator)) {
    62     createXcodeSpecificationFilesForSDKIfNeeded($sdk);
     66    updateXcodeSpecificationFilesForSDKIfNeeded($sdk);
    6367}
    6468
     
    97101}
    98102
    99 sub createXcodeSpecificationFilesForSDKIfNeeded($)
     103sub updateXcodeSpecificationFilesForSDKIfNeeded($)
     104{
     105    my ($sdkName) = @_;
     106    my $xcode7SpecificationFile = realpath(File::Spec->catfile(sdkPlatformDirectory($sdkName), "..", "..", "..", "PlugIns", "IDEiOSSupportCore.ideplugin", "Contents", "Resources", SDK_TO_PLUGIN_XCSPEC_NAME_MAP->{$sdkName}));
     107    if (-f $xcode7SpecificationFile) {
     108        updateXcode7SpecificationFile($xcode7SpecificationFile);
     109    } else {
     110        createLegacyXcodeSpecificationFilesForSDKIfNeeded($sdkName);
     111    }
     112}
     113
     114sub updateXcode7SpecificationFile($)
     115{
     116    my ($specificationFile) = @_;
     117
     118    my $hasPackageTypeForCommandLineTool = !!readXcodeSpecificationById($specificationFile, COMMAND_LINE_PACKAGE_TYPE);
     119    my $hasProductTypeForCommandLineTool = !!readXcodeSpecificationById($specificationFile, COMMAND_LINE_PRODUCT_TYPE);
     120    if ($hasPackageTypeForCommandLineTool && $hasProductTypeForCommandLineTool) {
     121        return; # Xcode knows how to build a command line tool for $sdkName.
     122    }
     123
     124    my $macosxSDKSpecificationsPath = xcodeSDKSpecificationsPath("macosx");
     125    if (!$hasPackageTypeForCommandLineTool) {
     126        my $packageTypesForMacOSXPath = File::Spec->catfile($macosxSDKSpecificationsPath, "MacOSX Package Types.xcspec");
     127        mergeXcodeSpecificationWithSpecificationAndId($specificationFile, $packageTypesForMacOSXPath, COMMAND_LINE_PACKAGE_TYPE);
     128    }
     129
     130    if (!$hasProductTypeForCommandLineTool) {
     131        my $productTypesForMacOSXPath = File::Spec->catfile($macosxSDKSpecificationsPath, "MacOSX Product Types.xcspec");
     132        mergeXcodeSpecificationWithSpecificationAndId($specificationFile, $productTypesForMacOSXPath, COMMAND_LINE_PRODUCT_TYPE);
     133    }
     134    print "Successfully updated '$specificationFile'.\n";
     135}
     136
     137sub createLegacyXcodeSpecificationFilesForSDKIfNeeded($)
    100138{
    101139    my ($sdk) = @_;
     
    146184        my $packageTypesForMacOSXPath = File::Spec->catfile($macosxSDKSpecificationsPath, "MacOSX Package Types.xcspec");
    147185        my $packageTypesForWebKitDevelopmentPath = File::Spec->catfile($sdkSpecificationsPath, "${fileNamePrefix}PackageTypes For WebKit Development.xcspec");
    148         createXcodeSpecificationFromSpecificationAndId($packageTypesForWebKitDevelopmentPath, $packageTypesForMacOSXPath, COMMAND_LINE_PACKAGE_TYPE);
     186        mergeXcodeSpecificationWithSpecificationAndId($packageTypesForWebKitDevelopmentPath, $packageTypesForMacOSXPath, COMMAND_LINE_PACKAGE_TYPE);
     187        print "Successfully created '$packageTypesForWebKitDevelopmentPath'.\n";
    149188    }
    150189
     
    152191        my $productTypesForMacOSXPath = File::Spec->catfile($macosxSDKSpecificationsPath, "MacOSX Product Types.xcspec");
    153192        my $productTypesForWebKitDevelopmentPath = File::Spec->catfile($sdkSpecificationsPath, "${fileNamePrefix}ProductTypes For WebKit Development.xcspec");
    154         createXcodeSpecificationFromSpecificationAndId($productTypesForWebKitDevelopmentPath, $productTypesForMacOSXPath, COMMAND_LINE_PRODUCT_TYPE);
     193        mergeXcodeSpecificationWithSpecificationAndId($productTypesForWebKitDevelopmentPath, $productTypesForMacOSXPath, COMMAND_LINE_PRODUCT_TYPE);
     194        print "Successfully created '$productTypesForWebKitDevelopmentPath'.\n";
    155195    }
    156196}
     
    178218    print $tempFileHandle $specification;
    179219    close($tempFileHandle);
    180     system("/usr/libexec/PlistBuddy -x -c 'clear array' '$xcodeSpecificationFile' > /dev/null") == 0 or die "PlistBuddy exited with $?: $!";
     220    if (!-f $xcodeSpecificationFile) {
     221        system("/usr/libexec/PlistBuddy -x -c 'clear array' '$xcodeSpecificationFile' > /dev/null") == 0 or die "PlistBuddy exited with $?: $!";
     222    }
    181223    system("/usr/libexec/PlistBuddy -x -c 'add 0 dict' '$xcodeSpecificationFile' > /dev/null") == 0 or die "PlistBuddy exited with $?: $!";
    182224    system("/usr/libexec/PlistBuddy -x -c 'merge $tempFilename 0' '$xcodeSpecificationFile' > /dev/null") == 0 or die "PlistBuddy exited with $?: $!";
     
    234276}
    235277
    236 sub createXcodeSpecificationFromSpecificationAndId($$$)
     278sub mergeXcodeSpecificationWithSpecificationAndId($$$)
    237279{
    238280    my ($targetXcodeSpecificationFile, $sourceXcodeSpecificationFile, $id) = @_;
     
    242284    }
    243285    writeXcodeSpecification($targetXcodeSpecificationFile, $specification);
    244     print "Successfully created '$targetXcodeSpecificationFile'.\n";
    245 }
     286}
Note: See TracChangeset for help on using the changeset viewer.