Support MacCatalyst in run-webkit-app
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jul 2019 00:41:43 +0000 (00:41 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jul 2019 00:41:43 +0000 (00:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199690

Reviewed by Tim Horton.

Add a --maccatalyst option to run-webkit-app that
can launch MacCatalyst applications with a built WebKit.

* Scripts/webkitdirs.pm:
(argumentsForConfiguration):
(determineXcodeSDK):
(xcodeSDKPlatformName):
(determineConfigurationProductDir):
(determinePortName):
(isCatalystWebKit):
(isAppleCocoaWebKit):
(willUseCatalystSDK):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247336 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitdirs.pm

index bba971f..7f92677 100644 (file)
@@ -1,3 +1,23 @@
+2019-07-10  Dean Jackson  <dino@apple.com>
+
+        Support MacCatalyst in run-webkit-app
+        https://bugs.webkit.org/show_bug.cgi?id=199690
+
+        Reviewed by Tim Horton.
+
+        Add a --maccatalyst option to run-webkit-app that
+        can launch MacCatalyst applications with a built WebKit.
+
+        * Scripts/webkitdirs.pm:
+        (argumentsForConfiguration):
+        (determineXcodeSDK):
+        (xcodeSDKPlatformName):
+        (determineConfigurationProductDir):
+        (determinePortName):
+        (isCatalystWebKit):
+        (isAppleCocoaWebKit):
+        (willUseCatalystSDK):
+
 2019-07-10  Ryan Haddad  <ryanhaddad@apple.com>
 
         [MacOS] Filter VPA info logged to stdout
index b2fafd7..1374b4b 100755 (executable)
@@ -109,6 +109,7 @@ use constant {
     tvOS        => "tvOS",
     watchOS     => "watchOS",
     Mac         => "Mac",
+    MacCatalyst => "MacCatalyst",
     JSCOnly     => "JSCOnly",
     PlayStation => "PlayStation",
     WinCairo    => "WinCairo",
@@ -489,6 +490,7 @@ sub argumentsForConfiguration()
     push(@args, '--release') if ($configuration =~ "^Release");
     push(@args, '--ios-device') if (defined $xcodeSDK && $xcodeSDK =~ /^iphoneos/);
     push(@args, '--ios-simulator') if (defined $xcodeSDK && $xcodeSDK =~ /^iphonesimulator/);
+    push(@args, '--maccatalyst') if (defined $xcodeSDK && $xcodeSDK =~ /^maccatalyst/);
     push(@args, '--32-bit') if ($architecture eq "x86" and !isWin64());
     push(@args, '--64-bit') if (isWin64());
     push(@args, '--gtk') if isGtk();
@@ -574,6 +576,9 @@ sub determineXcodeSDK
     if (checkForArgumentAndRemoveFromARGV("--watchos-simulator")) {
         $xcodeSDK ||= "watchsimulator";
     }
+    if (checkForArgumentAndRemoveFromARGV("--maccatalyst")) {
+        $xcodeSDK ||= "maccatalyst";
+    }
     return if !defined $xcodeSDK;
     
     # Prefer the internal version of an sdk, if it exists.
@@ -609,6 +614,7 @@ sub xcodeSDKPlatformName()
     return "macosx" if $xcodeSDK =~ /macosx/i;
     return "watchos" if $xcodeSDK =~ /watchos/i;
     return "watchsimulator" if $xcodeSDK =~ /watchsimulator/i;
+    return "maccatalyst" if $xcodeSDK =~ /maccatalyst/i;
     die "Couldn't determine platform name from Xcode SDK";
 }
 
@@ -720,7 +726,7 @@ sub determineConfigurationProductDir
             $configurationProductDir = "$baseProductDir";
         } else {
             $configurationProductDir = "$baseProductDir/$configuration";
-            $configurationProductDir .= "-" . xcodeSDKPlatformName() if isEmbeddedWebKit();
+            $configurationProductDir .= "-" . xcodeSDKPlatformName() if isEmbeddedWebKit() || isMacCatalystWebKit();
         }
     }
 }
@@ -1187,6 +1193,8 @@ sub determinePortName()
             $portName = tvOS;
         } elsif (willUseWatchDeviceSDK() || willUseWatchSimulatorSDK()) {
             $portName = watchOS;
+        } elsif (willUseMacCatalystSDK()) {
+            $portName = MacCatalyst;
         } else {
             $portName = Mac;
         }
@@ -1416,9 +1424,14 @@ sub isAppleMacWebKit()
     return portName() eq Mac;
 }
 
+sub isMacCatalystWebKit()
+{
+    return portName() eq MacCatalyst;
+}
+
 sub isAppleCocoaWebKit()
 {
-    return isAppleMacWebKit() || isEmbeddedWebKit();
+    return isAppleMacWebKit() || isEmbeddedWebKit() || isMacCatalystWebKit();
 }
 
 sub isAppleWinWebKit()
@@ -1504,6 +1517,11 @@ sub willUseWatchSimulatorSDK()
     return xcodeSDKPlatformName() eq "watchsimulator";
 }
 
+sub willUseMacCatalystSDK()
+{
+    return xcodeSDKPlatformName() eq "maccatalyst";
+}
+
 sub determineNmPath()
 {
     return if $nmPath;