@@ -241,7 +241,6 @@ $ArchX64 = @{
241
241
LLVMTarget = " x86_64-unknown-windows-msvc" ;
242
242
CMakeName = " AMD64" ;
243
243
BinaryDir = " bin64" ;
244
- PlatformInstallRoot = " $BinaryCache \x64\Windows.platform" ;
245
244
SDKInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\SDKs\Windows.sdk" ;
246
245
ExperimentalSDKInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk" ;
247
246
XCTestInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\XCTest-development" ;
@@ -257,7 +256,6 @@ $ArchX86 = @{
257
256
LLVMTarget = " i686-unknown-windows-msvc" ;
258
257
CMakeName = " i686" ;
259
258
BinaryDir = " bin32" ;
260
- PlatformInstallRoot = " $BinaryCache \x86\Windows.platform" ;
261
259
SDKInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\SDKs\Windows.sdk" ;
262
260
ExperimentalSDKInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\SDKs\WindowsExperimental.sdk" ;
263
261
XCTestInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\Library\XCTest-development" ;
@@ -272,7 +270,6 @@ $ArchARM64 = @{
272
270
LLVMTarget = " aarch64-unknown-windows-msvc" ;
273
271
CMakeName = " ARM64" ;
274
272
BinaryDir = " bin64a" ;
275
- PlatformInstallRoot = " $BinaryCache \arm64\Windows.platform" ;
276
273
SDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\Windows.sdk" ;
277
274
ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk" ;
278
275
XCTestInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\XCTest-development" ;
@@ -288,7 +285,6 @@ $AndroidARM64 = @{
288
285
LLVMName = " aarch64" ;
289
286
LLVMTarget = " aarch64-unknown-linux-android$AndroidAPILevel " ;
290
287
ShortName = " arm64" ;
291
- PlatformInstallRoot = " $BinaryCache \arm64\Android.platform" ;
292
288
SDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\Android.sdk" ;
293
289
ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk" ;
294
290
XCTestInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\Library\XCTest-development" ;
@@ -303,7 +299,6 @@ $AndroidARMv7 = @{
303
299
LLVMName = " armv7" ;
304
300
LLVMTarget = " armv7-unknown-linux-androideabi$AndroidAPILevel " ;
305
301
ShortName = " armv7" ;
306
- PlatformInstallRoot = " $BinaryCache \armv7\Android.platform" ;
307
302
SDKInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\SDKs\Android.sdk" ;
308
303
ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk" ;
309
304
XCTestInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\Library\XCTest-development" ;
@@ -318,7 +313,6 @@ $AndroidX86 = @{
318
313
LLVMName = " i686" ;
319
314
LLVMTarget = " i686-unknown-linux-android$AndroidAPILevel " ;
320
315
ShortName = " x86" ;
321
- PlatformInstallRoot = " $BinaryCache \x86\Android.platform" ;
322
316
SDKInstallRoot = " $BinaryCache \x86\Android.platform\Developer\SDKs\Android.sdk" ;
323
317
ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk" ;
324
318
XCTestInstallRoot = " $BinaryCache \x86\Android.platform\Developer\Library\XCTest-development" ;
@@ -333,7 +327,6 @@ $AndroidX64 = @{
333
327
LLVMName = " x86_64" ;
334
328
LLVMTarget = " x86_64-unknown-linux-android$AndroidAPILevel " ;
335
329
ShortName = " x64" ;
336
- PlatformInstallRoot = " $BinaryCache \x64\Android.platform" ;
337
330
SDKInstallRoot = " $BinaryCache \x64\Android.platform\Developer\SDKs\Android.sdk" ;
338
331
ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk" ;
339
332
XCTestInstallRoot = " $BinaryCache \x64\Android.platform\Developer\Library\XCTest-development" ;
@@ -390,10 +383,6 @@ function Get-InstallDir($Arch) {
390
383
return " $ImageRoot \$ProgramFilesName \Swift"
391
384
}
392
385
393
- function Get-HostSwiftSDK () {
394
- return ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " Windows.platform" , " Developer" , " SDKs" , " Windows.sdk" ))
395
- }
396
-
397
386
$NugetRoot = " $BinaryCache \nuget"
398
387
$PinnedToolchain = [IO.Path ]::GetFileNameWithoutExtension($PinnedBuild )
399
388
@@ -1003,6 +992,21 @@ enum Platform {
1003
992
Android
1004
993
}
1005
994
995
+ function Get-PlatformRoot ([Platform ] $Platform ) {
996
+ return ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" ))
997
+ }
998
+
999
+ function Get-SwiftSDK {
1000
+ [CmdletBinding (PositionalBinding = $false )]
1001
+ param
1002
+ (
1003
+ [Parameter (Position = 0 , Mandatory = $true )]
1004
+ [Platform ] $Platform ,
1005
+ [switch ] $Experimental = $false
1006
+ )
1007
+ return ([IO.Path ]::Combine((Get-PlatformRoot $Platform ), " Developer" , " SDKs" , " ${Platform} .sdk" ))
1008
+ }
1009
+
1006
1010
function Build-CMakeProject {
1007
1011
[CmdletBinding (PositionalBinding = $false )]
1008
1012
param (
@@ -1403,7 +1407,7 @@ function Build-SPMProject {
1403
1407
$Stopwatch = [Diagnostics.Stopwatch ]::StartNew()
1404
1408
1405
1409
Isolate- EnvVars {
1406
- $SDKInstallRoot = [ IO.Path ]::Combine(( Get-InstallDir $HostArch ) , " Platforms " , " Windows.platform " , " Developer " , " SDKs " , " Windows.sdk " )
1410
+ $SDKInstallRoot = ( Get-SwiftSDK Windows)
1407
1411
$RuntimeInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Runtimes" , $ProductVersion )
1408
1412
1409
1413
$env: Path = " $RuntimeInstallRoot \usr\bin;$ ( $HostArch.ToolchainInstallRoot ) \usr\bin;${env: Path} "
@@ -1912,7 +1916,7 @@ function Build-DS2([Platform]$Platform, $Arch) {
1912
1916
Build-CMakeProject `
1913
1917
- Src " $SourceCache \ds2" `
1914
1918
- Bin " $BinaryCache \$ ( $Arch.LLVMTarget ) \ds2" `
1915
- - InstallTo " $ ( $Arch .PlatformInstallRoot ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) " `
1919
+ - InstallTo " $ ( Get-PlatformRoot $Platform ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) " `
1916
1920
- Arch $Arch `
1917
1921
- Platform $Platform `
1918
1922
- BuildTargets default `
@@ -2382,10 +2386,9 @@ function Build-Testing([Platform]$Platform, $Arch, [switch]$Test = $false) {
2382
2386
}
2383
2387
}
2384
2388
2385
- function Write-PlatformInfoPlist ($Arch ) {
2386
- $PList = Join-Path - Path $Arch.PlatformInstallRoot - ChildPath " Info.plist"
2389
+ function Write-PlatformInfoPlist ([Platform ] $Platform ) {
2387
2390
Invoke-Program " $ ( Get-PythonExecutable ) " - c " import plistlib; print(str(plistlib.dumps({ 'DefaultProperties': { 'XCTEST_VERSION': 'development', 'SWIFT_TESTING_VERSION': 'development', 'SWIFTC_FLAGS': ['-use-ld=lld'] } }), encoding='utf-8'))" `
2388
- - OutFile " $PList "
2391
+ - OutFile ([ IO.Path ]::Combine(( Get-PlatformRoot $Platform ) , " Info.plist " ))
2389
2392
}
2390
2393
2391
2394
# Copies files installed by CMake from the arch-specific platform root,
@@ -2394,7 +2397,7 @@ function Write-PlatformInfoPlist($Arch) {
2394
2397
function Install-Platform ([Platform ]$Platform , $Arch ) {
2395
2398
if ($ToBatch ) { return }
2396
2399
2397
- $SDKInstallRoot = [ IO.Path ]::Combine(( Get-InstallDir $HostArch ) , " Platforms " , " $ Platform.platform " , " Developer " , " SDKs " , " $Platform .sdk " )
2400
+ $SDKInstallRoot = ( Get-SwiftSDK $ Platform )
2398
2401
2399
2402
New-Item - ItemType Directory - ErrorAction Ignore $SDKInstallRoot \usr | Out-Null
2400
2403
@@ -2446,9 +2449,8 @@ function Install-Platform([Platform]$Platform, $Arch) {
2446
2449
}
2447
2450
2448
2451
# Copy plist files (same across architectures)
2449
- Copy-File " $ ( $Arch.PlatformInstallRoot ) \Info.plist" ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" ))
2450
- Copy-File " $ ( $Arch.SDKInstallRoot ) \SDKSettings.json" ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" , " Developer" , " SDKs" , " ${Platform} .sdk" ))
2451
- Copy-File " $ ( $Arch.SDKInstallRoot ) \SDKSettings.plist" ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" , " Developer" , " SDKs" , " ${Platform} .sdk" ))
2452
+ Copy-File " $ ( $Arch.SDKInstallRoot ) \SDKSettings.json" " $ ( Get-SwiftSDK $Platform ) \"
2453
+ Copy-File " $ ( $Arch.SDKInstallRoot ) \SDKSettings.plist" " $ ( Get-SwiftSDK $Platform ) \"
2452
2454
2453
2455
# Copy XCTest
2454
2456
$XCTestInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" , " Developer" , " Library" , " XCTest-development" )
@@ -2497,7 +2499,7 @@ function Build-System($Arch) {
2497
2499
- Arch $Arch `
2498
2500
- Platform Windows `
2499
2501
- UseBuiltCompilers C, Swift `
2500
- - SwiftSDK (Get-HostSwiftSDK ) `
2502
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2501
2503
- BuildTargets default `
2502
2504
- Defines @ {
2503
2505
BUILD_SHARED_LIBS = " NO" ;
@@ -2513,7 +2515,7 @@ function Build-ToolsSupportCore($Arch) {
2513
2515
- Arch $Arch `
2514
2516
- Platform Windows `
2515
2517
- UseBuiltCompilers C, Swift `
2516
- - SwiftSDK (Get-HostSwiftSDK ) `
2518
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2517
2519
- Defines @ {
2518
2520
BUILD_SHARED_LIBS = " YES" ;
2519
2521
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2552,7 +2554,7 @@ function Build-LLBuild($Arch, [switch]$Test = $false) {
2552
2554
- Platform Windows `
2553
2555
- UseMSVCCompilers CXX `
2554
2556
- UseBuiltCompilers Swift `
2555
- - SwiftSDK (Get-HostSwiftSDK ) `
2557
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2556
2558
- BuildTargets $Targets `
2557
2559
- Defines ($TestingDefines + @ {
2558
2560
BUILD_SHARED_LIBS = " YES" ;
@@ -2571,7 +2573,7 @@ function Build-ArgumentParser($Arch) {
2571
2573
- Arch $Arch `
2572
2574
- Platform Windows `
2573
2575
- UseBuiltCompilers Swift `
2574
- - SwiftSDK (Get-HostSwiftSDK ) `
2576
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2575
2577
- Defines @ {
2576
2578
BUILD_SHARED_LIBS = " YES" ;
2577
2579
BUILD_TESTING = " NO" ;
@@ -2587,7 +2589,7 @@ function Build-Driver($Arch) {
2587
2589
- Arch $Arch `
2588
2590
- Platform Windows `
2589
2591
- UseBuiltCompilers C, CXX, Swift `
2590
- - SwiftSDK (Get-HostSwiftSDK ) `
2592
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2591
2593
- Defines @ {
2592
2594
BUILD_SHARED_LIBS = " YES" ;
2593
2595
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2610,7 +2612,7 @@ function Build-Crypto($Arch) {
2610
2612
- Arch $Arch `
2611
2613
- Platform Windows `
2612
2614
- UseBuiltCompilers Swift `
2613
- - SwiftSDK (Get-HostSwiftSDK ) `
2615
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2614
2616
- BuildTargets default `
2615
2617
- Defines @ {
2616
2618
BUILD_SHARED_LIBS = " NO" ;
@@ -2626,7 +2628,7 @@ function Build-Collections($Arch) {
2626
2628
- Arch $Arch `
2627
2629
- Platform Windows `
2628
2630
- UseBuiltCompilers C, Swift `
2629
- - SwiftSDK (Get-HostSwiftSDK ) `
2631
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2630
2632
- Defines @ {
2631
2633
BUILD_SHARED_LIBS = " YES" ;
2632
2634
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2639,7 +2641,7 @@ function Build-ASN1($Arch) {
2639
2641
- Bin (Get-HostProjectBinaryCache ASN1) `
2640
2642
- Arch $Arch `
2641
2643
- UseBuiltCompilers Swift `
2642
- - SwiftSDK (Get-HostSwiftSDK ) `
2644
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2643
2645
- BuildTargets default `
2644
2646
- Defines @ {
2645
2647
BUILD_SHARED_LIBS = " NO" ;
@@ -2654,7 +2656,7 @@ function Build-Certificates($Arch) {
2654
2656
- Arch $Arch `
2655
2657
- Platform Windows `
2656
2658
- UseBuiltCompilers Swift `
2657
- - SwiftSDK (Get-HostSwiftSDK ) `
2659
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2658
2660
- BuildTargets default `
2659
2661
- Defines @ {
2660
2662
BUILD_SHARED_LIBS = " NO" ;
@@ -2678,7 +2680,7 @@ function Build-PackageManager($Arch) {
2678
2680
- Arch $Arch `
2679
2681
- Platform Windows `
2680
2682
- UseBuiltCompilers C, Swift `
2681
- - SwiftSDK (Get-HostSwiftSDK ) `
2683
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2682
2684
- Defines @ {
2683
2685
BUILD_SHARED_LIBS = " YES" ;
2684
2686
CMAKE_Swift_FLAGS = @ (" -DCRYPTO_v2" );
@@ -2706,7 +2708,7 @@ function Build-Markdown($Arch) {
2706
2708
- Arch $Arch `
2707
2709
- Platform Windows `
2708
2710
- UseBuiltCompilers C, Swift `
2709
- - SwiftSDK (Get-HostSwiftSDK ) `
2711
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2710
2712
- Defines @ {
2711
2713
BUILD_SHARED_LIBS = " NO" ;
2712
2714
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2724,7 +2726,7 @@ function Build-Format($Arch) {
2724
2726
- Platform Windows `
2725
2727
- UseMSVCCompilers C `
2726
2728
- UseBuiltCompilers Swift `
2727
- - SwiftSDK (Get-HostSwiftSDK ) `
2729
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2728
2730
- Defines @ {
2729
2731
BUILD_SHARED_LIBS = " YES" ;
2730
2732
ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
@@ -2782,7 +2784,7 @@ function Build-LMDB($Arch) {
2782
2784
}
2783
2785
2784
2786
function Build-IndexStoreDB ($Arch ) {
2785
- $SDKInstallRoot = (Get-HostSwiftSDK );
2787
+ $SDKInstallRoot = (Get-SwiftSDK Windows );
2786
2788
2787
2789
Build-CMakeProject `
2788
2790
- Src $SourceCache \indexstore- db `
@@ -2809,7 +2811,7 @@ function Build-SourceKitLSP($Arch) {
2809
2811
- Arch $Arch `
2810
2812
- Platform Windows `
2811
2813
- UseBuiltCompilers C, Swift `
2812
- - SwiftSDK (Get-HostSwiftSDK ) `
2814
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2813
2815
- Defines @ {
2814
2816
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2815
2817
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
@@ -2995,7 +2997,7 @@ function Build-Inspect([Platform]$Platform, $Arch) {
2995
2997
# since it is currently only built for the host and and cannot be built for Android until
2996
2998
# the pinned version is >= 1.5.0.
2997
2999
$ArgumentParserDir = " "
2998
- $InstallPath = " $ ( $Arch .PlatformInstallRoot ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) "
3000
+ $InstallPath = " $ ( Get-PlatformRoot $Platform ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) "
2999
3001
}
3000
3002
3001
3003
Build-CMakeProject `
@@ -3072,7 +3074,7 @@ function Build-Installer($Arch) {
3072
3074
3073
3075
foreach ($SDK in $WindowsSDKArchs ) {
3074
3076
$Properties [" INCLUDE_WINDOWS_$ ( $SDK.VSName.ToUpperInvariant ()) _SDK" ] = " true"
3075
- $Properties [" PLATFORM_ROOT_$ ( $SDK.VSName.ToUpperInvariant ()) " ] = " $ ( $SDK .PlatformInstallRoot ) \"
3077
+ $Properties [" PLATFORM_ROOT_$ ( $SDK.VSName.ToUpperInvariant ()) " ] = " $ ( Get-PlatformRoot Windows ) \" ;
3076
3078
$Properties [" SDK_ROOT_$ ( $SDK.VSName.ToUpperInvariant ()) " ] = " $ ( $SDK.SDKInstallRoot ) \"
3077
3079
}
3078
3080
@@ -3160,7 +3162,6 @@ if (-not $SkipBuild) {
3160
3162
Invoke-BuildStep Build-XCTest Windows $Arch
3161
3163
Invoke-BuildStep Build-Testing Windows $Arch
3162
3164
Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
3163
- Invoke-BuildStep Write-PlatformInfoPlist $Arch
3164
3165
3165
3166
Invoke-BuildStep Build-ExperimentalRuntime - Static Windows $Arch
3166
3167
Invoke-BuildStep Build-Foundation - Static Windows $Arch
@@ -3189,7 +3190,6 @@ if (-not $SkipBuild) {
3189
3190
Invoke-BuildStep Build-Inspect - Platform Android - Arch $Arch
3190
3191
}
3191
3192
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
3192
- Invoke-BuildStep Write-PlatformInfoPlist $Arch
3193
3193
3194
3194
Invoke-BuildStep Build-ExperimentalRuntime - Static Android $Arch
3195
3195
Invoke-BuildStep Build-Foundation - Static Android $Arch
@@ -3212,10 +3212,14 @@ if (-not $ToBatch) {
3212
3212
foreach ($Arch in $WindowsSDKArchs ) {
3213
3213
Install-Platform Windows $Arch
3214
3214
}
3215
+ Invoke-BuildStep Write-PlatformInfoPlist Windows
3215
3216
3216
3217
foreach ($Arch in $AndroidSDKArchs ) {
3217
3218
Install-Platform Android $Arch
3218
3219
}
3220
+ if ($Android ) {
3221
+ Invoke-BuildStep Write-PlatformInfoPlist Android
3222
+ }
3219
3223
}
3220
3224
3221
3225
if (-not $SkipBuild ) {
0 commit comments