Skip to content

Commit d8ea601

Browse files
committed
utils: adjust for new install rules for testing frameworks
Clean up the testing framework installation to take advantage of the new install rules and avoid double staging.
1 parent 19c51e2 commit d8ea601

File tree

1 file changed

+7
-43
lines changed

1 file changed

+7
-43
lines changed

utils/build.ps1

Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ $ArchX64 = @{
238238
LLVMTarget = "x86_64-unknown-windows-msvc";
239239
CMakeName = "AMD64";
240240
BinaryDir = "bin64";
241-
XCTestInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\XCTest-development";
242-
SwiftTestingInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\Testing-development";
243241
ToolchainInstallRoot = "$BinaryCache\x64\toolchains\$ProductVersion+$Variant";
244242
Cache = @{};
245243
}
@@ -251,8 +249,6 @@ $ArchX86 = @{
251249
LLVMTarget = "i686-unknown-windows-msvc";
252250
CMakeName = "i686";
253251
BinaryDir = "bin32";
254-
XCTestInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\XCTest-development";
255-
SwiftTestingInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\Testing-development";
256252
Cache = @{};
257253
}
258254

@@ -263,9 +259,7 @@ $ArchARM64 = @{
263259
LLVMTarget = "aarch64-unknown-windows-msvc";
264260
CMakeName = "ARM64";
265261
BinaryDir = "bin64a";
266-
XCTestInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\XCTest-development";
267262
ToolchainInstallRoot = "$BinaryCache\arm64\toolchains\$ProductVersion+$Variant";
268-
SwiftTestingInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\Testing-development";
269263
Cache = @{};
270264
}
271265

@@ -276,8 +270,6 @@ $AndroidARM64 = @{
276270
LLVMName = "aarch64";
277271
LLVMTarget = "aarch64-unknown-linux-android$AndroidAPILevel";
278272
ShortName = "arm64";
279-
XCTestInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\Library\XCTest-development";
280-
SwiftTestingInstallRoot = "$BinaryCache\arm64\Android.platform\Developer\Library\Testing-development";
281273
Cache = @{};
282274
}
283275

@@ -288,8 +280,6 @@ $AndroidARMv7 = @{
288280
LLVMName = "armv7";
289281
LLVMTarget = "armv7-unknown-linux-androideabi$AndroidAPILevel";
290282
ShortName = "armv7";
291-
XCTestInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\XCTest-development";
292-
SwiftTestingInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\Testing-development";
293283
Cache = @{};
294284
}
295285

@@ -300,8 +290,6 @@ $AndroidX86 = @{
300290
LLVMName = "i686";
301291
LLVMTarget = "i686-unknown-linux-android$AndroidAPILevel";
302292
ShortName = "x86";
303-
XCTestInstallRoot = "$BinaryCache\x86\Android.platform\Developer\Library\XCTest-development";
304-
SwiftTestingInstallRoot = "$BinaryCache\x86\Android.platform\Developer\Library\Testing-development";
305293
Cache = @{};
306294
}
307295

@@ -312,8 +300,6 @@ $AndroidX64 = @{
312300
LLVMName = "x86_64";
313301
LLVMTarget = "x86_64-unknown-linux-android$AndroidAPILevel";
314302
ShortName = "x64";
315-
XCTestInstallRoot = "$BinaryCache\x64\Android.platform\Developer\Library\XCTest-development";
316-
SwiftTestingInstallRoot = "$BinaryCache\x64\Android.platform\Developer\Library\Testing-development";
317303
Cache = @{};
318304
}
319305

@@ -2349,15 +2335,18 @@ function Build-XCTest([Platform]$Platform, $Arch) {
23492335
Build-CMakeProject `
23502336
-Src $SourceCache\swift-corelibs-xctest `
23512337
-Bin $(Get-TargetProjectBinaryCache $Arch XCTest) `
2352-
-InstallTo "$($Arch.XCTestInstallRoot)\usr" `
2338+
-InstallTo "$([IO.Path]::Combine((Get-PlatformRoot $Platform), "Developer", "Library", "XCTest-development", "usr"))" `
23532339
-Arch $Arch `
23542340
-Platform $Platform `
23552341
-UseBuiltCompilers Swift `
23562342
-Defines @{
2343+
BUILD_SHARED_LIBS = "YES";
23572344
CMAKE_BUILD_WITH_INSTALL_RPATH = "YES";
2345+
CMAKE_INSTALL_BINDIR = $Arch.BinaryDir;
23582346
ENABLE_TESTING = "NO";
23592347
dispatch_DIR = $(Get-TargetProjectCMakeModules $Arch Dispatch);
23602348
Foundation_DIR = $(Get-TargetProjectCMakeModules $Arch DynamicFoundation);
2349+
XCTest_INSTALL_NESTED_SUBDIR = "YES";
23612350
}
23622351
}
23632352

@@ -2389,18 +2378,20 @@ function Build-Testing([Platform]$Platform, $Arch) {
23892378
Build-CMakeProject `
23902379
-Src $SourceCache\swift-testing `
23912380
-Bin (Get-TargetProjectBinaryCache $Arch Testing) `
2392-
-InstallTo "$($Arch.SwiftTestingInstallRoot)\usr" `
2381+
-InstallTo "$([IO.Path]::Combine((Get-PlatformRoot $Platform), "Developer", "Library", "Testing-development", "usr"))" `
23932382
-Arch $Arch `
23942383
-Platform $Platform `
23952384
-UseBuiltCompilers C,CXX,Swift `
23962385
-Defines @{
23972386
BUILD_SHARED_LIBS = "YES";
23982387
CMAKE_BUILD_WITH_INSTALL_RPATH = "YES";
2388+
CMAKE_INSTALL_BINDIR = $Arch.BinaryDir;
23992389
dispatch_DIR = (Get-TargetProjectCMakeModules $Arch Dispatch);
24002390
Foundation_DIR = (Get-TargetProjectCMakeModules $Arch DynamicFoundation);
24012391
# TODO: ensure that host and target platform match
24022392
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
24032393
SwiftTesting_MACRO = "$(Get-BuildProjectBinaryCache TestingMacros)\TestingMacros.dll";
2394+
SwiftTesting_INSTALL_NESTED_SUBDIR = "YES";
24042395
}
24052396
}
24062397

@@ -2438,33 +2429,6 @@ function Install-Platform([Platform]$Platform, $Archs) {
24382429
Copy-File $_.FullName "$PlatformResources\$($_.BaseName).swiftmodule\$(Get-ModuleTriple $Arch)$($_.Extension)"
24392430
}
24402431
}
2441-
2442-
# Copy XCTest
2443-
$XCTestInstallRoot = [IO.Path]::Combine((Get-PlatformRoot $Platform), "Developer", "Library", "XCTest-development")
2444-
switch ($Platform) {
2445-
Windows {
2446-
Copy-File "$($Arch.XCTestInstallRoot)\usr\bin\XCTest.dll" "$XCTestInstallRoot\usr\$($Arch.BinaryDir)\"
2447-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\windows\XCTest.lib" "$XCTestInstallRoot\usr\lib\swift\windows\$($Arch.LLVMName)\"
2448-
}
2449-
default {
2450-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\libXCTest.so" "$XCTestInstallRoot\usr\lib\$($Arch.BinaryDir)\"
2451-
}
2452-
}
2453-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\$($Arch.LLVMName)\XCTest.swiftmodule" "$XCTestInstallRoot\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\XCTest.swiftmodule\$($Arch.LLVMTarget).swiftmodule"
2454-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\$($Arch.LLVMName)\XCTest.swiftdoc" "$XCTestInstallRoot\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\XCTest.swiftmodule\$($Arch.LLVMTarget).swiftdoc"
2455-
2456-
# Copy Testing
2457-
$SwiftTestingInstallRoot = [IO.Path]::Combine((Get-PlatformRoot $Platform), "Developer", "Library", "Testing-development")
2458-
switch ($Platform) {
2459-
Windows {
2460-
Copy-File "$($Arch.SwiftTestingInstallRoot)\usr\bin\Testing.dll" "$SwiftTestingInstallRoot\usr\$($Arch.BinaryDir)\"
2461-
Copy-File "$($Arch.SwiftTestingInstallRoot)\usr\lib\swift\windows\Testing.lib" "$SwiftTestingInstallRoot\usr\lib\swift\windows\$($Arch.LLVMName)\"
2462-
}
2463-
default {
2464-
Copy-File "$($Arch.SwiftTestingInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\libTesting.so" "$SwiftTestingInstallRoot\usr\lib\$($Arch.BinaryDir)\"
2465-
}
2466-
}
2467-
Copy-Directory "$($Arch.SwiftTestingInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\Testing.swiftmodule" "$SwiftTestingInstallRoot\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\"
24682432
}
24692433
}
24702434

0 commit comments

Comments
 (0)