Changeset 275081 in webkit
- Timestamp:
- Mar 25, 2021, 11:57:35 PM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitdirs.pm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r275078 r275081 1 2021-03-25 Cameron McCormack <heycam@apple.com> 2 3 Avoid calling `xcodebuild -showsdks` where possible. 4 https://bugs.webkit.org/show_bug.cgi?id=223727 5 6 Reviewed by Sam Weinig. 7 8 run-minibrowser needs to know what port it's running on, since that 9 affects the build directory to look in to find the MiniBrowser binary. 10 On macOS, webkitdirs.pm's determinePortName ends up running 11 `xcodebuild -showsdks` to see if the current SDK has an internal 12 variant available, but this is slow. But we don't need to know the 13 exact SDK name here, just the SDK platform name, to determine the 14 port name. 15 16 So we shuffle some code around to avoid calling `xcodebuild -showsdks` 17 where we can. This reduces the time spent in run-minibrowser before 18 MiniBrowser is launched (crudely measured with `time run-minibrowser 19 --help`) from 2s to 0.6s on this machine. 20 21 * Scripts/webkitdirs.pm: 22 (readXcodeUserDefault): 23 (determineArchitecture): 24 (argumentsForConfiguration): 25 (availableXcodeSDKs): 26 (isValidXcodeSDKPlatformName): 27 (determineXcodeSDKPlatformName): 28 (determineXcodeSDK): 29 (xcodeSDKPlatformName): 30 (determinePortName): 31 1 32 2021-03-25 Alex Christensen <achristensen@webkit.org> 2 33 -
trunk/Tools/Scripts/webkitdirs.pm
r271614 r275081 141 141 my $configuration; 142 142 my $xcodeSDK; 143 my $xcodeSDKPlatformName; 143 144 my $simulatorIdiom; 144 145 my $configurationForVisualStudio; … … 401 402 chomp $architecture; 402 403 } else { 403 if ($xcodeSDK =~ /^iphoneos/) {404 if ($xcodeSDK eq /iphoneos/) { 404 405 $architecture = 'arm64'; 405 } elsif ($xcodeSDK =~ /^watchsimulator/) {406 } elsif ($xcodeSDK eq /watchsimulator/) { 406 407 $architecture = 'i386'; 407 } elsif ($xcodeSDK =~ /^watchos/) {408 } elsif ($xcodeSDK eq /watchos/) { 408 409 $architecture = 'arm64_32 arm64e armv7k'; 409 } elsif ($xcodeSDK =~ /^appletvos/) {410 } elsif ($xcodeSDK eq /appletvos/) { 410 411 $architecture = 'arm64'; 411 412 } … … 550 551 determineArchitecture(); 551 552 if (isAppleCocoaWebKit()) { 552 determineXcodeSDK ();553 determineXcodeSDKPlatformName(); 553 554 } 554 555 … … 558 559 push(@args, '--debug') if ($configuration =~ "^Debug"); 559 560 push(@args, '--release') if ($configuration =~ "^Release"); 560 push(@args, '--ios-device') if (defined $xcodeSDK && $xcodeSDK =~/^iphoneos/);561 push(@args, '--ios-simulator') if (defined $xcodeSDK && $xcodeSDK =~/^iphonesimulator/ && $simulatorIdiom eq "iPhone");562 push(@args, '--ipad-simulator') if (defined $xcodeSDK && $xcodeSDK =~/^iphonesimulator/ && $simulatorIdiom eq "iPad");563 push(@args, '--tvos-device') if (defined $xcodeSDK && $xcodeSDK =~/^appletvos/);564 push(@args, '--tvos-simulator') if (defined $xcodeSDK && $xcodeSDK =~/^appletvsimulator/);565 push(@args, '--watchos-device') if (defined $xcodeSDK && $xcodeSDK =~/^watchos/);566 push(@args, '--watchos-simulator') if (defined $xcodeSDK && $xcodeSDK =~/^watchsimulator/);567 push(@args, '--maccatalyst') if (defined $xcodeSDK && $xcodeSDK =~/^maccatalyst/);561 push(@args, '--ios-device') if (defined $xcodeSDKPlatformName && $xcodeSDKPlatformName eq /^iphoneos/); 562 push(@args, '--ios-simulator') if (defined $xcodeSDKPlatformName && $xcodeSDKPlatformName eq /^iphonesimulator/ && $simulatorIdiom eq "iPhone"); 563 push(@args, '--ipad-simulator') if (defined $xcodeSDKPlatformName && $xcodeSDKPlatformName eq /^iphonesimulator/ && $simulatorIdiom eq "iPad"); 564 push(@args, '--tvos-device') if (defined $xcodeSDKPlatformName && $xcodeSDKPlatformName eq /^appletvos/); 565 push(@args, '--tvos-simulator') if (defined $xcodeSDKPlatformName && $xcodeSDKPlatformName eq /^appletvsimulator/); 566 push(@args, '--watchos-device') if (defined $xcodeSDKPlatformName && $xcodeSDKPlatformName eq /^watchos/); 567 push(@args, '--watchos-simulator') if (defined $xcodeSDKPlatformName && $xcodeSDKPlatformName eq /^watchsimulator/); 568 push(@args, '--maccatalyst') if (defined $xcodeSDKPlatformName && $xcodeSDKPlatformName eq /^maccatalyst/); 568 569 push(@args, '--32-bit') if ($architecture eq "x86" and !isWin64()); 569 570 push(@args, '--64-bit') if (isWin64()); … … 623 624 } 624 625 625 sub determineXcodeSDK 626 { 627 return if defined $xcodeSDK; 626 sub isValidXcodeSDKPlatformName($) { 627 my $name = shift; 628 my @platforms = qw( 629 appletvos 630 appletvsimulator 631 iphoneos 632 iphonesimulator 633 macosx 634 watchos 635 watchsimulator 636 maccatalyst 637 ); 638 return grep { $_ eq $name } @platforms; 639 } 640 641 sub determineXcodeSDKPlatformName { 642 return if defined $xcodeSDKPlatformName; 628 643 my $sdk; 629 644 630 645 # The user explicitly specified the sdk, don't assume anything 631 646 if (checkForArgumentAndRemoveFromARGVGettingValue("--sdk", \$sdk)) { 632 $xcodeSDK = $sdk; 647 $xcodeSDK = lc $sdk; 648 $xcodeSDKPlatformName = $sdk; 649 $xcodeSDKPlatformName =~ s/\.internal$//; 650 die "Couldn't determine platform name from Xcode SDK" unless isValidXcodeSDKPlatformName($xcodeSDKPlatformName); 633 651 return; 634 652 } 635 653 if (checkForArgumentAndRemoveFromARGV("--device") || checkForArgumentAndRemoveFromARGV("--ios-device")) { 636 $xcodeSDK ||= "iphoneos";654 $xcodeSDKPlatformName ||= "iphoneos"; 637 655 } 638 656 if (checkForArgumentAndRemoveFromARGV("--simulator") || checkForArgumentAndRemoveFromARGV("--ios-simulator")) { 639 $xcodeSDK ||= 'iphonesimulator';657 $xcodeSDKPlatformName ||= 'iphonesimulator'; 640 658 $simulatorIdiom = 'iPhone'; 641 659 } 642 660 if (checkForArgumentAndRemoveFromARGV("--ipad-simulator")) { 643 $xcodeSDK ||= 'iphonesimulator';661 $xcodeSDKPlatformName ||= 'iphonesimulator'; 644 662 $simulatorIdiom = 'iPad'; 645 663 } 646 664 if (checkForArgumentAndRemoveFromARGV("--tvos-device")) { 647 $xcodeSDK ||="appletvos";665 $xcodeSDKPlatformName ||= "appletvos"; 648 666 } 649 667 if (checkForArgumentAndRemoveFromARGV("--tvos-simulator")) { 650 $xcodeSDK ||= "appletvsimulator";668 $xcodeSDKPlatformName ||= "appletvsimulator"; 651 669 } 652 670 if (checkForArgumentAndRemoveFromARGV("--watchos-device")) { 653 $xcodeSDK ||="watchos";671 $xcodeSDKPlatformName ||= "watchos"; 654 672 } 655 673 if (checkForArgumentAndRemoveFromARGV("--watchos-simulator")) { 656 $xcodeSDK ||= "watchsimulator";674 $xcodeSDKPlatformName ||= "watchsimulator"; 657 675 } 658 676 if (checkForArgumentAndRemoveFromARGV("--maccatalyst")) { 659 $xcodeSDK ||= "maccatalyst";677 $xcodeSDKPlatformName ||= "maccatalyst"; 660 678 } 661 679 662 680 # Finally, fall back to macOS if no platform is specified. 663 if (!defined $xcodeSDK) { 664 $xcodeSDK = "macosx"; 665 } 666 681 $xcodeSDKPlatformName ||= "macosx"; 682 } 683 684 sub determineXcodeSDK 685 { 686 determineXcodeSDKPlatformName(); # This can set $xcodeSDK if --sdk was used. 687 return if defined $xcodeSDK; 688 689 $xcodeSDK = $xcodeSDKPlatformName; 690 667 691 # Prefer the internal version of an sdk, if it exists. 668 692 my @availableSDKs = availableXcodeSDKs(); 669 693 670 694 foreach my $sdk (@availableSDKs) { 671 next if $sdk ne "$xcodeSDK .internal";695 next if $sdk ne "$xcodeSDKPlatformName.internal"; 672 696 $xcodeSDK = $sdk; 673 697 last; … … 686 710 } 687 711 688 689 sub xcodeSDKPlatformName() 690 { 691 determineXcodeSDK(); 692 return "" if !defined $xcodeSDK; 693 return "appletvos" if $xcodeSDK =~ /appletvos/i; 694 return "appletvsimulator" if $xcodeSDK =~ /appletvsimulator/i; 695 return "iphoneos" if $xcodeSDK =~ /iphoneos/i; 696 return "iphonesimulator" if $xcodeSDK =~ /iphonesimulator/i; 697 return "macosx" if $xcodeSDK =~ /macosx/i; 698 return "watchos" if $xcodeSDK =~ /watchos/i; 699 return "watchsimulator" if $xcodeSDK =~ /watchsimulator/i; 700 return "maccatalyst" if $xcodeSDK =~ /maccatalyst/i; 701 die "Couldn't determine platform name from Xcode SDK"; 712 sub xcodeSDKPlatformName 713 { 714 determineXcodeSDKPlatformName(); 715 return $xcodeSDKPlatformName; 702 716 } 703 717 … … 1345 1359 $portName = AppleWin; 1346 1360 } elsif (isDarwin()) { 1347 determineXcodeSDK ();1361 determineXcodeSDKPlatformName(); 1348 1362 if (willUseIOSDeviceSDK() || willUseIOSSimulatorSDK()) { 1349 1363 $portName = iOS;
Note:
See TracChangeset
for help on using the changeset viewer.