Skip to content

Commit bbf2ef1

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 6e9faa1 commit bbf2ef1

File tree

1 file changed

+7
-42
lines changed

1 file changed

+7
-42
lines changed

utils/build.ps1

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ $ArchX64 = @{
239239
LLVMTarget = "x86_64-unknown-windows-msvc";
240240
CMakeName = "AMD64";
241241
BinaryDir = "bin64";
242-
XCTestInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\XCTest-development";
243-
SwiftTestingInstallRoot = "$BinaryCache\x64\Windows.platform\Developer\Library\Testing-development";
244242
ToolchainInstallRoot = "$BinaryCache\x64\toolchains\$ProductVersion+$Variant";
245243
Cache = @{};
246244
}
@@ -252,8 +250,6 @@ $ArchX86 = @{
252250
LLVMTarget = "i686-unknown-windows-msvc";
253251
CMakeName = "i686";
254252
BinaryDir = "bin32";
255-
XCTestInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\XCTest-development";
256-
SwiftTestingInstallRoot = "$BinaryCache\x86\Windows.platform\Developer\Library\Testing-development";
257253
Cache = @{};
258254
}
259255

@@ -264,9 +260,7 @@ $ArchARM64 = @{
264260
LLVMTarget = "aarch64-unknown-windows-msvc";
265261
CMakeName = "ARM64";
266262
BinaryDir = "bin64a";
267-
XCTestInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\XCTest-development";
268263
ToolchainInstallRoot = "$BinaryCache\arm64\toolchains\$ProductVersion+$Variant";
269-
SwiftTestingInstallRoot = "$BinaryCache\arm64\Windows.platform\Developer\Library\Testing-development";
270264
Cache = @{};
271265
}
272266

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

@@ -289,8 +281,6 @@ $AndroidARMv7 = @{
289281
LLVMName = "armv7";
290282
LLVMTarget = "armv7-unknown-linux-androideabi$AndroidAPILevel";
291283
ShortName = "armv7";
292-
XCTestInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\XCTest-development";
293-
SwiftTestingInstallRoot = "$BinaryCache\armv7\Android.platform\Developer\Library\Testing-development";
294284
Cache = @{};
295285
}
296286

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

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

@@ -2381,15 +2367,18 @@ function Build-XCTest([Platform]$Platform, $Arch) {
23812367
Build-CMakeProject `
23822368
-Src $SourceCache\swift-corelibs-xctest `
23832369
-Bin $(Get-TargetProjectBinaryCache $Arch XCTest) `
2384-
-InstallTo "$($Arch.XCTestInstallRoot)\usr" `
2370+
-InstallTo "$([IO.Path]::Combine((Get-PlatformRoot $Platform), "Developer", "Library", "XCTest-development", "usr"))" `
23852371
-Arch $Arch `
23862372
-Platform $Platform `
23872373
-UseBuiltCompilers Swift `
23882374
-Defines @{
2375+
BUILD_SHARED_LIBS = "YES";
23892376
CMAKE_BUILD_WITH_INSTALL_RPATH = "YES";
2377+
CMAKE_INSTALL_BINDIR = $Arch.BinaryDir;
23902378
ENABLE_TESTING = "NO";
23912379
dispatch_DIR = $(Get-TargetProjectCMakeModules $Arch Dispatch);
23922380
Foundation_DIR = $(Get-TargetProjectCMakeModules $Arch DynamicFoundation);
2381+
XCTest_INSTALL_NESTED_SUBDIR = "YES";
23932382
}
23942383
}
23952384

@@ -2421,18 +2410,20 @@ function Build-Testing([Platform]$Platform, $Arch) {
24212410
Build-CMakeProject `
24222411
-Src $SourceCache\swift-testing `
24232412
-Bin (Get-TargetProjectBinaryCache $Arch Testing) `
2424-
-InstallTo "$($Arch.SwiftTestingInstallRoot)\usr" `
2413+
-InstallTo "$([IO.Path]::Combine((Get-PlatformRoot $Platform), "Developer", "Library", "Testing-development", "usr"))" `
24252414
-Arch $Arch `
24262415
-Platform $Platform `
24272416
-UseBuiltCompilers C,CXX,Swift `
24282417
-Defines @{
24292418
BUILD_SHARED_LIBS = "YES";
24302419
CMAKE_BUILD_WITH_INSTALL_RPATH = "YES";
2420+
CMAKE_INSTALL_BINDIR = $Arch.BinaryDir;
24312421
dispatch_DIR = (Get-TargetProjectCMakeModules $Arch Dispatch);
24322422
Foundation_DIR = (Get-TargetProjectCMakeModules $Arch DynamicFoundation);
24332423
# TODO: ensure that host and target platform match
24342424
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
24352425
SwiftTesting_MACRO = "$(Get-BuildProjectBinaryCache TestingMacros)\TestingMacros.dll";
2426+
SwiftTesting_INSTALL_NESTED_SUBDIR = "YES";
24362427
}
24372428
}
24382429

@@ -2470,32 +2461,6 @@ function Install-Platform([Platform]$Platform, $Archs) {
24702461
Copy-File $_.FullName "$PlatformResources\$($_.BaseName).swiftmodule\$(Get-ModuleTriple $Arch)$($_.Extension)"
24712462
}
24722463
}
2473-
2474-
# Copy XCTest
2475-
$XCTestInstallRoot = [IO.Path]::Combine((Get-PlatformRoot $Platform), "Developer", "Library", "XCTest-development")
2476-
switch ($Platform) {
2477-
Windows {
2478-
Copy-File "$($Arch.XCTestInstallRoot)\usr\bin\XCTest.dll" "$XCTestInstallRoot\usr\$($Arch.BinaryDir)\"
2479-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\windows\XCTest.lib" "$XCTestInstallRoot\usr\lib\swift\windows\$($Arch.LLVMName)\"
2480-
}
2481-
default {
2482-
Copy-File "$($Arch.XCTestInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\libXCTest.so" "$XCTestInstallRoot\usr\lib\$($Arch.BinaryDir)\"
2483-
}
2484-
}
2485-
Copy-Directory "$($Arch.XCTestInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\XCTest.swiftmodule" "$XCTestInstallRoot\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\"
2486-
2487-
# Copy Testing
2488-
$SwiftTestingInstallRoot = [IO.Path]::Combine((Get-PlatformRoot $Platform), "Developer", "Library", "Testing-development")
2489-
switch ($Platform) {
2490-
Windows {
2491-
Copy-File "$($Arch.SwiftTestingInstallRoot)\usr\bin\Testing.dll" "$SwiftTestingInstallRoot\usr\$($Arch.BinaryDir)\"
2492-
Copy-File "$($Arch.SwiftTestingInstallRoot)\usr\lib\swift\windows\Testing.lib" "$SwiftTestingInstallRoot\usr\lib\swift\windows\$($Arch.LLVMName)\"
2493-
}
2494-
default {
2495-
Copy-File "$($Arch.SwiftTestingInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\libTesting.so" "$SwiftTestingInstallRoot\usr\lib\$($Arch.BinaryDir)\"
2496-
}
2497-
}
2498-
Copy-Directory "$($Arch.SwiftTestingInstallRoot)\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\Testing.swiftmodule" "$SwiftTestingInstallRoot\usr\lib\swift\$($Platform.ToString().ToLowerInvariant())\"
24992464
}
25002465
}
25012466

0 commit comments

Comments
 (0)