Skip to content

Commit

Permalink
Build scripts should default to the Internal workspace using the inte…
Browse files Browse the repository at this point in the history
…rnal SDK

https://bugs.webkit.org/show_bug.cgi?id=271245
rdar://125015308

Reviewed by Elliott Williams.

Right now in order to get WebKitAdditions when using these scripts you have to already have started a build
from Internal. This is annoying for clean builds or when WebKitBuild has a stale WebKitAdditions. This patch
changes the build scripts to default to the Internal workspace when building for a .internal SDK and the
regular workspace when building for a public SDK. If there's already a configured workspace then we just
use that.

* Tools/Scripts/webkitdirs.pm:
(determineConfiguredXcodeWorkspaceOrDefault):
(configuredXcodeWorkspace):
(XcodeOptions):
(determineConfiguredXcodeWorkspace): Deleted.
* Tools/Scripts/webkitperl/BuildSubproject.pm:
(buildUpToProject):

Canonical link: https://commits.webkit.org/276366@main
  • Loading branch information
kmiller68 committed Mar 19, 2024
1 parent 56adf02 commit 29536a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
20 changes: 15 additions & 5 deletions Tools/Scripts/webkitdirs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ sub argumentsForXcode()
return @args;
}

sub determineConfiguredXcodeWorkspace()
sub determineConfiguredXcodeWorkspaceOrDefault()
{
return if defined $configuredXcodeWorkspace;
determineBaseProductDir();
Expand All @@ -1271,12 +1271,23 @@ sub determineConfiguredXcodeWorkspace()
$configuredXcodeWorkspace = <WORKSPACE>;
close WORKSPACE;
chomp $configuredXcodeWorkspace;
return;
}

# No configured workspace, time to find the default one.
# If we're using an internal SDK use the internal workspace.
if (xcodeSDK() =~ /\.internal$/) {
$configuredXcodeWorkspace = Cwd::realpath(sourceDir() . "/../Internal/Safari.xcworkspace");
die "using internal SDK but unable to find adjacent Internal directory: $configuredXcodeWorkspace. SDK: $xcodeSDK" unless -e $configuredXcodeWorkspace;
return;
}

$configuredXcodeWorkspace = sourceDir() . "/WebKit.xcworkspace";
}

sub configuredXcodeWorkspace()
{
determineConfiguredXcodeWorkspace();
determineConfiguredXcodeWorkspaceOrDefault();
return $configuredXcodeWorkspace;
}

Expand All @@ -1301,15 +1312,14 @@ sub XcodeOptions
determineLTOMode();
if (isAppleCocoaWebKit()) {
determineXcodeSDK();
determineConfiguredXcodeWorkspace();
determineConfiguredXcodeWorkspaceOrDefault();
}

my @options;
push @options, "-UseSanitizedBuildSystemEnvironment=YES";
push @options, "-ShowBuildOperationDuration=YES";
if (!checkForArgumentAndRemoveFromARGV("--no-use-workspace")) {
my $workspace = $configuredXcodeWorkspace // sourceDir() . "/WebKit.xcworkspace";
push @options, ("-workspace", $workspace) if $workspace;
push @options, ("-workspace", $configuredXcodeWorkspace) if $configuredXcodeWorkspace;
}
push @options, ("-configuration", $configuration);
push @options, ("-destination", $destination) if $destination;
Expand Down
8 changes: 4 additions & 4 deletions Tools/Scripts/webkitperl/BuildSubproject.pm
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ sub buildUpToProject
{
my ($projectDirectory, $projectName) = @_;
my $result;

chdir $projectDirectory or die "Can't find $projectName directory to build from";
if (isAppleCocoaWebKit()) {
if (!configuredXcodeWorkspace()) {
system("$FindBin::Bin/set-webkit-configuration", "--workspace=" . sourceDir() . "/WebKit.xcworkspace") == 0 or die;
}
configuredXcodeWorkspace() or die "Can't determine configured Xcode workspace";

# By convention, projects that support this build workflow
# (JavaScriptCore, WebGPU) have a scheme which builds that project
# and its implicit dependencies.
Expand Down Expand Up @@ -256,7 +256,7 @@ sub buildUpToProject

print "\n";
print "building ", $projectName, "\n";
print "running build command '", $command, "' in ", $projectDirectory, "\n\n";
print "running build command '", $command, "' in ", Cwd::cwd(), "\n\n";

$result = system $command;
} else {
Expand Down

0 comments on commit 29536a5

Please sign in to comment.