Changeset 223234 in webkit


Ignore:
Timestamp:
Oct 12, 2017 1:37:53 AM (7 years ago)
Author:
fred.wang@free.fr
Message:

run-safari --ios-simulator is no longer working with Xcode 9
https://bugs.webkit.org/show_bug.cgi?id=177595

Patch by Frederic Wang <fwang@igalia.com> on 2017-10-11
Reviewed by Daniel Bates.

In Xcode 9, the path of the simulator application is now in a new CoreSimulator subdirectory
of the iphoneOS SDK platform. This patch updates webkitdirs.pm to use the new path in
Xcode 9 or higher so that it is possible to run Safari on the iOS simulator again. It also
does some minor code refactoring to improve code reuse.

  • Scripts/configure-xcode-for-ios-development: Move sdkDirectory() and sdkPlatformDirectory()

into webkitdirs.
(sdkDirectory): Deleted.
(sdkPlatformDirectory): Deleted.

  • Scripts/webkitdirs.pm: Expose new sdkDirectory() and sdkPlatformDirectory().

(sdkDirectory): Moved from configure-xcode-for-ios-development.
(sdkPlatformDirectory): Ditto.
(XcodeSDKPath): Rely on sdkDirectory() to implement this function.
(iosSimulatorApplicationsPath): In Xcode 9 or higher use the new path. It is calculated
by relying on sdkPlatformDirectory().

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r223226 r223234  
     12017-10-11  Frederic Wang  <fwang@igalia.com>
     2
     3        run-safari --ios-simulator is no longer working with Xcode 9
     4        https://bugs.webkit.org/show_bug.cgi?id=177595
     5
     6        Reviewed by Daniel Bates.
     7
     8        In Xcode 9, the path of the simulator application is now in a new CoreSimulator subdirectory
     9        of the iphoneOS SDK platform. This patch updates webkitdirs.pm to use the new path in
     10        Xcode 9 or higher so that it is possible to run Safari on the iOS simulator again. It also
     11        does some minor code refactoring to improve code reuse.
     12
     13        * Scripts/configure-xcode-for-ios-development: Move sdkDirectory() and sdkPlatformDirectory()
     14        into webkitdirs.
     15        (sdkDirectory): Deleted.
     16        (sdkPlatformDirectory): Deleted.
     17        * Scripts/webkitdirs.pm: Expose new sdkDirectory() and sdkPlatformDirectory().
     18        (sdkDirectory): Moved from configure-xcode-for-ios-development.
     19        (sdkPlatformDirectory): Ditto.
     20        (XcodeSDKPath): Rely on sdkDirectory() to implement this function.
     21        (iosSimulatorApplicationsPath): In Xcode 9 or higher use the new path. It is calculated
     22        by relying on sdkPlatformDirectory().
     23
    1242017-10-11  Dewei Zhu  <dewei_zhu@apple.com>
    225
  • trunk/Tools/Scripts/configure-xcode-for-ios-development

    r221168 r223234  
    4646sub mergeXcodeSpecificationWithSpecificationAndId($$$);
    4747sub readXcodeSpecificationById($$);
    48 sub sdkDirectory($);
    49 sub sdkPlatformDirectory($);
    5048sub updateXcode7SpecificationFile($);
    5149sub updateXcodeSpecificationFilesForSDKIfNeeded($);
     
    213211}
    214212
    215 sub sdkDirectory($)
    216 {
    217     my ($sdkName) = @_;
    218     chomp(my $sdkDirectory = `xcrun --sdk '$sdkName' --show-sdk-path`);
    219     die "Failed to get SDK path from xcrun: $!" if exitStatus($?);
    220     return $sdkDirectory;
    221 }
    222 
    223 sub sdkPlatformDirectory($)
    224 {
    225     my ($sdkName) = @_;
    226     chomp(my $sdkPlatformDirectory = `xcrun --sdk '$sdkName' --show-sdk-platform-path`);
    227     die "Failed to get SDK platform path from xcrun: $!" if exitStatus($?);
    228     return $sdkPlatformDirectory;
    229 }
    230 
    231213sub writeXcodeSpecification($$)
    232214{
  • trunk/Tools/Scripts/webkitdirs.pm

    r222538 r223234  
    7272       &findOrCreateSimulatorForIOSDevice
    7373       &iosSimulatorDeviceByName
     74       &iosVersion
    7475       &nmPath
    7576       &passedConfiguration
     
    8384       &runMacWebKitApp
    8485       &safariPath
    85        &iosVersion
     86       &sdkDirectory
     87       &sdkPlatformDirectory
    8688       &setConfiguration
    8789       &setupMacWebKitEnvironment
     
    166168sub hasArgument($$);
    167169
     170sub sdkDirectory($)
     171{
     172    my ($sdkName) = @_;
     173    chomp(my $sdkDirectory = `xcrun --sdk '$sdkName' --show-sdk-path`);
     174    die "Failed to get SDK path from xcrun: $!" if exitStatus($?);
     175    return $sdkDirectory;
     176}
     177
     178sub sdkPlatformDirectory($)
     179{
     180    my ($sdkName) = @_;
     181    chomp(my $sdkPlatformDirectory = `xcrun --sdk '$sdkName' --show-sdk-platform-path`);
     182    die "Failed to get SDK platform path from xcrun: $!" if exitStatus($?);
     183    return $sdkPlatformDirectory;
     184}
     185
    168186sub determineSourceDir
    169187{
     
    541559
    542560    die "Can't find the SDK path because no Xcode SDK was specified" if not $xcodeSDK;
    543 
    544     my $sdkPath = `xcrun --sdk $xcodeSDK --show-sdk-path` if $xcodeSDK;
    545     die 'Failed to get SDK path from xcrun' if $?;
    546     chomp $sdkPath;
    547 
    548     return $sdkPath;
     561    return sdkDirectory($xcodeSDK);
    549562}
    550563
     
    23112324sub iosSimulatorApplicationsPath()
    23122325{
    2313     return File::Spec->catdir(XcodeSDKPath(), "Applications");
     2326    determineXcodeVersion();
     2327    if (eval "v$xcodeVersion" lt v9.0) {
     2328        return File::Spec->catdir(XcodeSDKPath(), "Applications");
     2329    }
     2330
     2331    my $iphoneOSPlatformPath = sdkPlatformDirectory("iphoneos");
     2332    return File::Spec->catdir($iphoneOSPlatformPath, "Developer", "Library", "CoreSimulator", "Profiles", "Runtimes", "iOS.simruntime", "Contents", "Resources", "RuntimeRoot", "Applications");
    23142333}
    23152334
Note: See TracChangeset for help on using the changeset viewer.