Bug 199852

Summary: run-safari --ios-simulator is no longer working with Xcode 11
Product: WebKit Reporter: Frédéric Wang (:fredw) <fred.wang>
Component: Tools / TestsAssignee: Frédéric Wang (:fredw) <fred.wang>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dbates, ews-watchlist, jbedard, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=177595
https://bugs.webkit.org/show_bug.cgi?id=178203
Bug Depends on:    
Bug Blocks: 202263    
Attachments:
Description Flags
Patch none

Description Frédéric Wang (:fredw) 2019-07-17 03:17:43 PDT
XCode relase and beta use different paths for MobileSafari.app:

$ find Xcode.app -name MobileSafari.app
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Applications/MobileSafari.app

$ find Xcode-beta.app -name MobileSafari.app
Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Applications/MobileSafari.app

(note that "Developer" and "Library" have been switched)

A trivial patch to make things work again is:

diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm
index 1374b4b3f2..c011655669 100755
--- a/Tools/Scripts/webkitdirs.pm
+++ b/Tools/Scripts/webkitdirs.pm
@@ -2503,7 +2503,7 @@ sub setupIOSWebKitEnvironment($)
 sub iosSimulatorApplicationsPath()
 {
     # FIXME: We should ask simctl for this information, instead of guessing from available runtimes.
-    my $runtimePath = File::Spec->catdir(sdkPlatformDirectory("iphoneos"), "Developer", "Library", "CoreSimulator", "Profiles", "Runtimes");
+    my $runtimePath = File::Spec->catdir(sdkPlatformDirectory("iphoneos"), "Library", "Developer", "CoreSimulator", "Profiles", "Runtimes");
     opendir(RUNTIMES, $runtimePath);
     my @runtimes = grep {/.*\.simruntime/} readdir(RUNTIMES);
     close(RUNTIMES);

but of course that will break backward compatibility...
Comment 1 Radar WebKit Bug Importer 2019-09-26 03:26:17 PDT
<rdar://problem/55738122>
Comment 2 Frédéric Wang (:fredw) 2019-09-26 05:27:03 PDT
This bug now happens on Mojave with the recent XCode 11 release.
Comment 3 Jonathan Bedard 2019-09-26 07:22:13 PDT
We can totally break iOS 12 at this point, so the 'trivial patch' is probably the way to go.
Comment 4 Frédéric Wang (:fredw) 2019-09-26 13:54:22 PDT
Created attachment 379676 [details]
Patch

OK let's do that.
Comment 5 WebKit Commit Bot 2019-09-26 14:54:37 PDT
Comment on attachment 379676 [details]
Patch

Clearing flags on attachment: 379676

Committed r250400: <https://trac.webkit.org/changeset/250400>
Comment 6 WebKit Commit Bot 2019-09-26 14:54:39 PDT
All reviewed patches have been landed.  Closing bug.