Skip to content

Commit 63bf597

Browse files
committed
[WPE][GTK] Add port name to build dir path
https://bugs.webkit.org/show_bug.cgi?id=263117 Reviewed by Michael Catanzaro. This will let both builds coexist on one host which is useful for QA. * Tools/Scripts/webkitdirs.pm: (determineConfigurationProductDir): (cmakeCachePath): (shouldRemoveCMakeCache): (cmakeGeneratedBuildfile): (generateBuildSystemFromCMakeProject): (buildCMakeGeneratedProject): (cleanCMakeGeneratedProject): (productDirForCMake): Deleted. * Tools/glib/api_test_runner.py: (TestRunner.__init__): (TestRunner._setup_testing_environment): (TestRunner._run_test_qt): * Tools/glib/common.py: (library_build_path): (binary_build_path): (get_build_path): (build_path): Canonical link: https://commits.webkit.org/269647@main
1 parent d40154a commit 63bf597

4 files changed

Lines changed: 31 additions & 35 deletions

File tree

CMakePresets.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
{
1010
"name": "release",
1111
"hidden": true,
12-
"binaryDir": "WebKitBuild/Release",
1312
"cacheVariables": {
1413
"CMAKE_BUILD_TYPE": {
1514
"type": "STRING",
@@ -20,7 +19,6 @@
2019
{
2120
"name": "debug",
2221
"hidden": true,
23-
"binaryDir": "WebKitBuild/Debug",
2422
"cacheVariables": {
2523
"CMAKE_BUILD_TYPE": {
2624
"type": "STRING",
@@ -60,22 +58,24 @@
6058
{
6159
"name": "gtk-release",
6260
"displayName": "GTK Release",
63-
"inherits": ["gtk", "release"]
61+
"inherits": ["gtk", "release"],
62+
"binaryDir": "WebKitBuild/GTK/Release"
6463
},
6564
{
6665
"name": "gtk-debug",
6766
"displayName": "GTK Debug",
68-
"inherits": ["gtk", "debug"]
67+
"inherits": ["gtk", "debug"],
68+
"binaryDir": "WebKitBuild/GTK/Debug"
6969
},
7070
{
7171
"name": "gtk-dev-release",
7272
"displayName": "GTK Development Release",
73-
"inherits": ["gtk", "dev", "release"]
73+
"inherits": ["gtk-release", "dev"]
7474
},
7575
{
7676
"name": "gtk-dev-debug",
7777
"displayName": "GTK Development Debug",
78-
"inherits": ["gtk", "dev", "debug"]
78+
"inherits": ["gtk-debug", "dev"]
7979
}
8080
],
8181
"buildPresets": [
@@ -91,12 +91,12 @@
9191
},
9292
{
9393
"name": "gtk-dev-release",
94-
"displayName": "GTK Dev Release",
94+
"displayName": "GTK Development Release",
9595
"configurePreset": "gtk-dev-release"
9696
},
9797
{
9898
"name": "gtk-dev-debug",
99-
"displayName": "GTK Dev Debug",
99+
"displayName": "GTK Development Debug",
100100
"configurePreset": "gtk-dev-debug"
101101
}
102102
]

Tools/Scripts/webkitdirs.pm

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ BEGIN {
159159
&prependToEnvironmentVariableList
160160
&printHelpAndExitForRunAndDebugWebKitAppIfNeeded
161161
&productDir
162-
&productDirForCMake
163162
&prohibitUnknownPort
164163
&relativeScriptsDir
165164
&removeCMakeCache
@@ -1035,7 +1034,7 @@ sub determineConfigurationProductDir
10351034
if (usesPerConfigurationBuildDirectory()) {
10361035
$configurationProductDir = "$baseProductDir";
10371036
} else {
1038-
if (shouldUseFlatpak() or shouldBuildForCrossTarget() or inCrossTargetEnvironment()) {
1037+
if (isGtk() or isWPE() or isJSCOnly() or shouldUseFlatpak() or shouldBuildForCrossTarget() or inCrossTargetEnvironment()) {
10391038
$configurationProductDir = "$baseProductDir/$portName/$configuration";
10401039
} else {
10411040
$configurationProductDir = "$baseProductDir/$configuration";
@@ -2526,7 +2525,7 @@ sub shouldUseFlatpak()
25262525

25272526
sub cmakeCachePath()
25282527
{
2529-
return File::Spec->catdir(productDirForCMake(), "CMakeCache.txt");
2528+
return File::Spec->catdir(productDir(), "CMakeCache.txt");
25302529
}
25312530

25322531
sub shouldRemoveCMakeCache(@)
@@ -2537,7 +2536,7 @@ sub shouldRemoveCMakeCache(@)
25372536
my (@buildArgs) = grep(/^-/, sort(@_, @originalArgv));
25382537

25392538
# We check this first, because we always want to create this file for a fresh build.
2540-
my $productDir = productDirForCMake();
2539+
my $productDir = productDir();
25412540
my $optionsCache = File::Spec->catdir($productDir, "build-webkit-options.txt");
25422541
my $joinedBuildArgs = join(" ", @buildArgs);
25432542
if (isCachedArgumentfileOutOfDate($optionsCache, $joinedBuildArgs)) {
@@ -2643,11 +2642,11 @@ sub cmakeGeneratedBuildfile(@)
26432642
{
26442643
my ($willUseNinja) = @_;
26452644
if ($willUseNinja) {
2646-
return File::Spec->catfile(productDirForCMake(), "build.ninja")
2645+
return File::Spec->catfile(productDir(), "build.ninja")
26472646
} elsif (isAnyWindows()) {
2648-
return File::Spec->catfile(productDirForCMake(), "WebKit.sln")
2647+
return File::Spec->catfile(productDir(), "WebKit.sln")
26492648
} else {
2650-
return File::Spec->catfile(productDirForCMake(), "Makefile")
2649+
return File::Spec->catfile(productDir(), "Makefile")
26512650
}
26522651
}
26532652

@@ -2656,7 +2655,7 @@ sub generateBuildSystemFromCMakeProject
26562655
my ($prefixPath, @cmakeArgs) = @_;
26572656
my $config = configuration();
26582657
my $port = cmakeBasedPortName();
2659-
my $buildPath = productDirForCMake();
2658+
my $buildPath = productDir();
26602659
File::Path::mkpath($buildPath) unless -d $buildPath;
26612660
my $originalWorkingDirectory = getcwd();
26622661
chdir($buildPath) or die;
@@ -2736,18 +2735,11 @@ sub generateBuildSystemFromCMakeProject
27362735
return $returnCode;
27372736
}
27382737

2739-
sub productDirForCMake() {
2740-
if (shouldBuildForCrossTarget() or inCrossTargetEnvironment()) {
2741-
return productDir();
2742-
}
2743-
return File::Spec->catdir(baseProductDir(), configuration());
2744-
}
2745-
27462738
sub buildCMakeGeneratedProject($)
27472739
{
27482740
my (@makeArgs) = @_;
27492741
my $config = configuration();
2750-
my $buildPath = productDirForCMake();
2742+
my $buildPath = productDir();
27512743
if (! -d $buildPath) {
27522744
die "Must call generateBuildSystemFromCMakeProject() before building CMake project.";
27532745
}
@@ -2777,7 +2769,7 @@ sub buildCMakeGeneratedProject($)
27772769
sub cleanCMakeGeneratedProject()
27782770
{
27792771
my $config = configuration();
2780-
my $buildPath = productDirForCMake();
2772+
my $buildPath = productDir();
27812773
if (-d $buildPath) {
27822774
return systemVerbose("cmake", "--build", $buildPath, "--config", $config, "--target", "clean");
27832775
}

Tools/glib/api_test_runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, port, options, tests=[]):
5959
self._build_type = self._port.default_configuration()
6060
common.set_build_types((self._build_type,))
6161

62-
self._programs_path = common.binary_build_path()
62+
self._programs_path = common.binary_build_path(self._port)
6363
expectations_file = os.path.join(common.top_level_path(), "Tools", "TestWebKitAPI", "glib", "TestExpectations.json")
6464
self._expectations = TestExpectations(self._port.name(), expectations_file, self._build_type)
6565
self._tests = self._get_tests(tests)
@@ -115,7 +115,7 @@ def _create_driver(self, port_options=[]):
115115
def _setup_testing_environment(self):
116116
self._test_env = self._driver._setup_environ_for_test()
117117
self._test_env["TEST_WEBKIT_API_WEBKIT2_RESOURCES_PATH"] = common.top_level_path("Tools", "TestWebKitAPI", "Tests", "WebKit")
118-
self._test_env["TEST_WEBKIT_API_WEBKIT2_INJECTED_BUNDLE_PATH"] = common.library_build_path()
118+
self._test_env["TEST_WEBKIT_API_WEBKIT2_INJECTED_BUNDLE_PATH"] = common.library_build_path(self._port)
119119
self._test_env["WEBKIT_EXEC_PATH"] = self._programs_path
120120

121121
def _tear_down_testing_environment(self):
@@ -178,7 +178,7 @@ def is_slow_test(test, subtest):
178178
def _run_test_qt(self, test_program):
179179
env = self._test_env
180180
env['XDG_SESSION_TYPE'] = 'wayland'
181-
env['QML2_IMPORT_PATH'] = common.library_build_path('qt5', 'qml')
181+
env['QML2_IMPORT_PATH'] = common.library_build_path(self._port, 'qt5', 'qml')
182182

183183
name = os.path.basename(test_program)
184184
if not hasattr(subprocess, 'TimeoutExpired'):

Tools/glib/common.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ def set_build_types(new_build_types):
3737
build_types = new_build_types
3838

3939

40-
def library_build_path(*args):
41-
return build_path('lib', *args)
40+
def library_build_path(port, *args):
41+
return build_path(port, 'lib', *args)
4242

4343

44-
def binary_build_path(*args):
45-
return build_path('bin', *args)
44+
def binary_build_path(port, *args):
45+
return build_path(port, 'bin', *args)
4646

4747

48-
def get_build_path(fatal=True):
48+
def get_build_path(port, fatal=True):
4949
global build_dir
5050
if build_dir:
5151
return build_dir
@@ -68,6 +68,10 @@ def is_valid_build_directory(path):
6868

6969
global build_types
7070
for build_type in build_types:
71+
build_dir = port._config.build_directory(build_type)
72+
if is_valid_build_directory(build_dir):
73+
return build_dir
74+
7175
build_dir = top_level_path('WebKitBuild', build_type)
7276
if is_valid_build_directory(build_dir):
7377
return build_dir
@@ -90,8 +94,8 @@ def is_valid_build_directory(path):
9094
sys.exit(1)
9195

9296

93-
def build_path(*args):
94-
return os.path.join(*(get_build_path(),) + args)
97+
def build_path(port, *args):
98+
return os.path.join(*(get_build_path(port),) + args)
9599

96100

97101
def pkg_config_file_variable(package, variable):

0 commit comments

Comments
 (0)