Skip to content
Permalink
Browse files
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().

Canonical link: https://commits.webkit.org/194458@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fred-wang committed Oct 12, 2017
1 parent 3c6437b commit 6cdaf7cda84b099c04599b563cb8300fc6536686
Showing 3 changed files with 50 additions and 26 deletions.
@@ -1,3 +1,26 @@
2017-10-11 Frederic Wang <fwang@igalia.com>

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 <dewei_zhu@apple.com>

run-benchmark script should set '__XPC_DYLD_FRAMEWORK_PATH' while launching local-built Safari on Mac.
@@ -45,8 +45,6 @@ sub copyMissingXSLTHeadersToSDKIfNeeded($);
sub createLegacyXcodeSpecificationFilesForSDKIfNeeded($);
sub mergeXcodeSpecificationWithSpecificationAndId($$$);
sub readXcodeSpecificationById($$);
sub sdkDirectory($);
sub sdkPlatformDirectory($);
sub updateXcode7SpecificationFile($);
sub updateXcodeSpecificationFilesForSDKIfNeeded($);
sub xcodeSDKSpecificationsPath($);
@@ -212,22 +210,6 @@ sub createLegacyXcodeSpecificationFilesForSDKIfNeeded($)
}
}

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) = @_;
@@ -71,6 +71,7 @@ BEGIN {
&extractNonHostConfiguration
&findOrCreateSimulatorForIOSDevice
&iosSimulatorDeviceByName
&iosVersion
&nmPath
&passedConfiguration
&prependToEnvironmentVariableList
@@ -82,7 +83,8 @@ BEGIN {
&runIOSWebKitApp
&runMacWebKitApp
&safariPath
&iosVersion
&sdkDirectory
&sdkPlatformDirectory
&setConfiguration
&setupMacWebKitEnvironment
&sharedCommandLineOptions
@@ -165,6 +167,22 @@ sub exitStatus($);
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 @@ sub XcodeSDKPath
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 setupIOSWebKitEnvironment($)

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()

0 comments on commit 6cdaf7c

Please sign in to comment.