Title: [223234] trunk/Tools
Revision
223234
Author
[email protected]
Date
2017-10-12 01:37:53 -0700 (Thu, 12 Oct 2017)

Log 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 <[email protected]> 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().

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (223233 => 223234)


--- trunk/Tools/ChangeLog	2017-10-12 06:46:24 UTC (rev 223233)
+++ trunk/Tools/ChangeLog	2017-10-12 08:37:53 UTC (rev 223234)
@@ -1,3 +1,26 @@
+2017-10-11  Frederic Wang  <[email protected]>
+
+        run-safari --ios-simulator is no longer working with Xcode 9
+        https://bugs.webkit.org/show_bug.cgi?id=177595
+
+        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().
+
 2017-10-11  Dewei Zhu  <[email protected]>
 
         run-benchmark script should set '__XPC_DYLD_FRAMEWORK_PATH' while launching local-built Safari on Mac.

Modified: trunk/Tools/Scripts/configure-xcode-for-ios-development (223233 => 223234)


--- trunk/Tools/Scripts/configure-xcode-for-ios-development	2017-10-12 06:46:24 UTC (rev 223233)
+++ trunk/Tools/Scripts/configure-xcode-for-ios-development	2017-10-12 08:37:53 UTC (rev 223234)
@@ -45,8 +45,6 @@
 sub createLegacyXcodeSpecificationFilesForSDKIfNeeded($);
 sub mergeXcodeSpecificationWithSpecificationAndId($$$);
 sub readXcodeSpecificationById($$);
-sub sdkDirectory($);
-sub sdkPlatformDirectory($);
 sub updateXcode7SpecificationFile($);
 sub updateXcodeSpecificationFilesForSDKIfNeeded($);
 sub xcodeSDKSpecificationsPath($);
@@ -212,22 +210,6 @@
     }
 }
 
-sub sdkDirectory($)
-{
-    my ($sdkName) = @_;
-    chomp(my $sdkDirectory = `xcrun --sdk '$sdkName' --show-sdk-path`);
-    die "Failed to get SDK path from xcrun: $!" if exitStatus($?);
-    return $sdkDirectory;
-}
-
-sub sdkPlatformDirectory($)
-{
-    my ($sdkName) = @_;
-    chomp(my $sdkPlatformDirectory = `xcrun --sdk '$sdkName' --show-sdk-platform-path`);
-    die "Failed to get SDK platform path from xcrun: $!" if exitStatus($?);
-    return $sdkPlatformDirectory;
-}
-
 sub writeXcodeSpecification($$)
 {
     my ($xcodeSpecificationFile, $specification) = @_;

Modified: trunk/Tools/Scripts/webkitdirs.pm (223233 => 223234)


--- trunk/Tools/Scripts/webkitdirs.pm	2017-10-12 06:46:24 UTC (rev 223233)
+++ trunk/Tools/Scripts/webkitdirs.pm	2017-10-12 08:37:53 UTC (rev 223234)
@@ -71,6 +71,7 @@
        &extractNonHostConfiguration
        &findOrCreateSimulatorForIOSDevice
        &iosSimulatorDeviceByName
+       &iosVersion
        &nmPath
        &passedConfiguration
        &prependToEnvironmentVariableList
@@ -82,7 +83,8 @@
        &runIOSWebKitApp
        &runMacWebKitApp
        &safariPath
-       &iosVersion
+       &sdkDirectory
+       &sdkPlatformDirectory
        &setConfiguration
        &setupMacWebKitEnvironment
        &sharedCommandLineOptions
@@ -165,6 +167,22 @@
 sub findMatchingArguments($$);
 sub hasArgument($$);
 
+sub sdkDirectory($)
+{
+    my ($sdkName) = @_;
+    chomp(my $sdkDirectory = `xcrun --sdk '$sdkName' --show-sdk-path`);
+    die "Failed to get SDK path from xcrun: $!" if exitStatus($?);
+    return $sdkDirectory;
+}
+
+sub sdkPlatformDirectory($)
+{
+    my ($sdkName) = @_;
+    chomp(my $sdkPlatformDirectory = `xcrun --sdk '$sdkName' --show-sdk-platform-path`);
+    die "Failed to get SDK platform path from xcrun: $!" if exitStatus($?);
+    return $sdkPlatformDirectory;
+}
+
 sub determineSourceDir
 {
     return if $sourceDir;
@@ -540,12 +558,7 @@
     determineXcodeSDK();
 
     die "Can't find the SDK path because no Xcode SDK was specified" if not $xcodeSDK;
-
-    my $sdkPath = `xcrun --sdk $xcodeSDK --show-sdk-path` if $xcodeSDK;
-    die 'Failed to get SDK path from xcrun' if $?;
-    chomp $sdkPath;
-
-    return $sdkPath;
+    return sdkDirectory($xcodeSDK);
 }
 
 sub xcodeSDKVersion
@@ -2310,7 +2323,13 @@
 
 sub iosSimulatorApplicationsPath()
 {
-    return File::Spec->catdir(XcodeSDKPath(), "Applications");
+    determineXcodeVersion();
+    if (eval "v$xcodeVersion" lt v9.0) {
+        return File::Spec->catdir(XcodeSDKPath(), "Applications");
+    }
+
+    my $iphoneOSPlatformPath = sdkPlatformDirectory("iphoneos");
+    return File::Spec->catdir($iphoneOSPlatformPath, "Developer", "Library", "CoreSimulator", "Profiles", "Runtimes", "iOS.simruntime", "Contents", "Resources", "RuntimeRoot", "Applications");
 }
 
 sub installedMobileSafariBundle()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to