@@ -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} "
@@ -1916,7 +1920,7 @@ function Build-DS2([Platform]$Platform, $Arch) {
1916
1920
Build-CMakeProject `
1917
1921
- Src " $SourceCache \ds2" `
1918
1922
- Bin " $BinaryCache \$ ( $Arch.LLVMTarget ) \ds2" `
1919
- - InstallTo " $ ( $Arch .PlatformInstallRoot ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) " `
1923
+ - InstallTo " $ ( Get-PlatformRoot $Platform ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) " `
1920
1924
- Arch $Arch `
1921
1925
- Platform $Platform `
1922
1926
- BuildTargets default `
@@ -2392,10 +2396,9 @@ function Build-Testing([Platform]$Platform, $Arch, [switch]$Test = $false) {
2392
2396
}
2393
2397
}
2394
2398
2395
- function Write-PlatformInfoPlist ($Arch ) {
2396
- $PList = Join-Path - Path $Arch.PlatformInstallRoot - ChildPath " Info.plist"
2399
+ function Write-PlatformInfoPlist ([Platform ] $Platform ) {
2397
2400
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'))" `
2398
- - OutFile " $PList "
2401
+ - OutFile ([ IO.Path ]::Combine(( Get-PlatformRoot $Platform ) , " Info.plist " ))
2399
2402
}
2400
2403
2401
2404
# Copies files installed by CMake from the arch-specific platform root,
@@ -2404,7 +2407,7 @@ function Write-PlatformInfoPlist($Arch) {
2404
2407
function Install-Platform ([Platform ]$Platform , $Arch ) {
2405
2408
if ($ToBatch ) { return }
2406
2409
2407
- $SDKInstallRoot = [ IO.Path ]::Combine(( Get-InstallDir $HostArch ) , " Platforms " , " $ Platform.platform " , " Developer " , " SDKs " , " $Platform .sdk " )
2410
+ $SDKInstallRoot = ( Get-SwiftSDK $ Platform )
2408
2411
2409
2412
New-Item - ItemType Directory - ErrorAction Ignore $SDKInstallRoot \usr | Out-Null
2410
2413
@@ -2456,9 +2459,8 @@ function Install-Platform([Platform]$Platform, $Arch) {
2456
2459
}
2457
2460
2458
2461
# Copy plist files (same across architectures)
2459
- Copy-File " $ ( $Arch.PlatformInstallRoot ) \Info.plist" ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" ))
2460
- Copy-File " $ ( $Arch.SDKInstallRoot ) \SDKSettings.json" ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" , " Developer" , " SDKs" , " ${Platform} .sdk" ))
2461
- Copy-File " $ ( $Arch.SDKInstallRoot ) \SDKSettings.plist" ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" , " Developer" , " SDKs" , " ${Platform} .sdk" ))
2462
+ Copy-File " $ ( $Arch.SDKInstallRoot ) \SDKSettings.json" " $ ( Get-SwiftSDK $Platform ) \"
2463
+ Copy-File " $ ( $Arch.SDKInstallRoot ) \SDKSettings.plist" " $ ( Get-SwiftSDK $Platform ) \"
2462
2464
2463
2465
# Copy XCTest
2464
2466
$XCTestInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" , " Developer" , " Library" , " XCTest-development" )
@@ -2507,7 +2509,7 @@ function Build-System($Arch) {
2507
2509
- Arch $Arch `
2508
2510
- Platform Windows `
2509
2511
- UseBuiltCompilers C, Swift `
2510
- - SwiftSDK (Get-HostSwiftSDK ) `
2512
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2511
2513
- BuildTargets default `
2512
2514
- Defines @ {
2513
2515
BUILD_SHARED_LIBS = " NO" ;
@@ -2523,7 +2525,7 @@ function Build-ToolsSupportCore($Arch) {
2523
2525
- Arch $Arch `
2524
2526
- Platform Windows `
2525
2527
- UseBuiltCompilers C, Swift `
2526
- - SwiftSDK (Get-HostSwiftSDK ) `
2528
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2527
2529
- Defines @ {
2528
2530
BUILD_SHARED_LIBS = " YES" ;
2529
2531
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2562,7 +2564,7 @@ function Build-LLBuild($Arch, [switch]$Test = $false) {
2562
2564
- Platform Windows `
2563
2565
- UseMSVCCompilers CXX `
2564
2566
- UseBuiltCompilers Swift `
2565
- - SwiftSDK (Get-HostSwiftSDK ) `
2567
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2566
2568
- BuildTargets $Targets `
2567
2569
- Defines ($TestingDefines + @ {
2568
2570
BUILD_SHARED_LIBS = " YES" ;
@@ -2581,7 +2583,7 @@ function Build-ArgumentParser($Arch) {
2581
2583
- Arch $Arch `
2582
2584
- Platform Windows `
2583
2585
- UseBuiltCompilers Swift `
2584
- - SwiftSDK (Get-HostSwiftSDK ) `
2586
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2585
2587
- Defines @ {
2586
2588
BUILD_SHARED_LIBS = " YES" ;
2587
2589
BUILD_TESTING = " NO" ;
@@ -2597,7 +2599,7 @@ function Build-Driver($Arch) {
2597
2599
- Arch $Arch `
2598
2600
- Platform Windows `
2599
2601
- UseBuiltCompilers C, CXX, Swift `
2600
- - SwiftSDK (Get-HostSwiftSDK ) `
2602
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2601
2603
- Defines @ {
2602
2604
BUILD_SHARED_LIBS = " YES" ;
2603
2605
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2620,7 +2622,7 @@ function Build-Crypto($Arch) {
2620
2622
- Arch $Arch `
2621
2623
- Platform Windows `
2622
2624
- UseBuiltCompilers Swift `
2623
- - SwiftSDK (Get-HostSwiftSDK ) `
2625
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2624
2626
- BuildTargets default `
2625
2627
- Defines @ {
2626
2628
BUILD_SHARED_LIBS = " NO" ;
@@ -2636,7 +2638,7 @@ function Build-Collections($Arch) {
2636
2638
- Arch $Arch `
2637
2639
- Platform Windows `
2638
2640
- UseBuiltCompilers C, Swift `
2639
- - SwiftSDK (Get-HostSwiftSDK ) `
2641
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2640
2642
- Defines @ {
2641
2643
BUILD_SHARED_LIBS = " YES" ;
2642
2644
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2649,7 +2651,7 @@ function Build-ASN1($Arch) {
2649
2651
- Bin (Get-HostProjectBinaryCache ASN1) `
2650
2652
- Arch $Arch `
2651
2653
- UseBuiltCompilers Swift `
2652
- - SwiftSDK (Get-HostSwiftSDK ) `
2654
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2653
2655
- BuildTargets default `
2654
2656
- Defines @ {
2655
2657
BUILD_SHARED_LIBS = " NO" ;
@@ -2664,7 +2666,7 @@ function Build-Certificates($Arch) {
2664
2666
- Arch $Arch `
2665
2667
- Platform Windows `
2666
2668
- UseBuiltCompilers Swift `
2667
- - SwiftSDK (Get-HostSwiftSDK ) `
2669
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2668
2670
- BuildTargets default `
2669
2671
- Defines @ {
2670
2672
BUILD_SHARED_LIBS = " NO" ;
@@ -2688,7 +2690,7 @@ function Build-PackageManager($Arch) {
2688
2690
- Arch $Arch `
2689
2691
- Platform Windows `
2690
2692
- UseBuiltCompilers C, Swift `
2691
- - SwiftSDK (Get-HostSwiftSDK ) `
2693
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2692
2694
- Defines @ {
2693
2695
BUILD_SHARED_LIBS = " YES" ;
2694
2696
CMAKE_Swift_FLAGS = @ (" -DCRYPTO_v2" );
@@ -2716,7 +2718,7 @@ function Build-Markdown($Arch) {
2716
2718
- Arch $Arch `
2717
2719
- Platform Windows `
2718
2720
- UseBuiltCompilers C, Swift `
2719
- - SwiftSDK (Get-HostSwiftSDK ) `
2721
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2720
2722
- Defines @ {
2721
2723
BUILD_SHARED_LIBS = " NO" ;
2722
2724
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2734,7 +2736,7 @@ function Build-Format($Arch) {
2734
2736
- Platform Windows `
2735
2737
- UseMSVCCompilers C `
2736
2738
- UseBuiltCompilers Swift `
2737
- - SwiftSDK (Get-HostSwiftSDK ) `
2739
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2738
2740
- Defines @ {
2739
2741
BUILD_SHARED_LIBS = " YES" ;
2740
2742
ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
@@ -2792,7 +2794,7 @@ function Build-LMDB($Arch) {
2792
2794
}
2793
2795
2794
2796
function Build-IndexStoreDB ($Arch ) {
2795
- $SDKInstallRoot = (Get-HostSwiftSDK );
2797
+ $SDKInstallRoot = (Get-SwiftSDK Windows );
2796
2798
2797
2799
Build-CMakeProject `
2798
2800
- Src $SourceCache \indexstore- db `
@@ -2819,7 +2821,7 @@ function Build-SourceKitLSP($Arch) {
2819
2821
- Arch $Arch `
2820
2822
- Platform Windows `
2821
2823
- UseBuiltCompilers C, Swift `
2822
- - SwiftSDK (Get-HostSwiftSDK ) `
2824
+ - SwiftSDK (Get-SwiftSDK Windows ) `
2823
2825
- Defines @ {
2824
2826
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2825
2827
SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
@@ -3005,7 +3007,7 @@ function Build-Inspect([Platform]$Platform, $Arch) {
3005
3007
# since it is currently only built for the host and and cannot be built for Android until
3006
3008
# the pinned version is >= 1.5.0.
3007
3009
$ArgumentParserDir = " "
3008
- $InstallPath = " $ ( $Arch .PlatformInstallRoot ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) "
3010
+ $InstallPath = " $ ( Get-PlatformRoot $Platform ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) "
3009
3011
}
3010
3012
3011
3013
Build-CMakeProject `
@@ -3082,7 +3084,7 @@ function Build-Installer($Arch) {
3082
3084
3083
3085
foreach ($SDK in $WindowsSDKArchs ) {
3084
3086
$Properties [" INCLUDE_WINDOWS_$ ( $SDK.VSName.ToUpperInvariant ()) _SDK" ] = " true"
3085
- $Properties [" PLATFORM_ROOT_$ ( $SDK.VSName.ToUpperInvariant ()) " ] = " $ ( $SDK .PlatformInstallRoot ) \"
3087
+ $Properties [" PLATFORM_ROOT_$ ( $SDK.VSName.ToUpperInvariant ()) " ] = " $ ( Get-PlatformRoot Windows ) \" ;
3086
3088
$Properties [" SDK_ROOT_$ ( $SDK.VSName.ToUpperInvariant ()) " ] = " $ ( $SDK.SDKInstallRoot ) \"
3087
3089
}
3088
3090
@@ -3170,7 +3172,6 @@ if (-not $SkipBuild) {
3170
3172
Invoke-BuildStep Build-XCTest Windows $Arch
3171
3173
Invoke-BuildStep Build-Testing Windows $Arch
3172
3174
Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
3173
- Invoke-BuildStep Write-PlatformInfoPlist $Arch
3174
3175
3175
3176
Invoke-BuildStep Build-ExperimentalRuntime - Static Windows $Arch
3176
3177
Invoke-BuildStep Build-Foundation - Static Windows $Arch
@@ -3199,7 +3200,6 @@ if (-not $SkipBuild) {
3199
3200
Invoke-BuildStep Build-Inspect - Platform Android - Arch $Arch
3200
3201
}
3201
3202
Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
3202
- Invoke-BuildStep Write-PlatformInfoPlist $Arch
3203
3203
3204
3204
Invoke-BuildStep Build-ExperimentalRuntime - Static Android $Arch
3205
3205
Invoke-BuildStep Build-Foundation - Static Android $Arch
@@ -3222,10 +3222,14 @@ if (-not $ToBatch) {
3222
3222
foreach ($Arch in $WindowsSDKArchs ) {
3223
3223
Install-Platform Windows $Arch
3224
3224
}
3225
+ Invoke-BuildStep Write-PlatformInfoPlist Windows
3225
3226
3226
3227
foreach ($Arch in $AndroidSDKArchs ) {
3227
3228
Install-Platform Android $Arch
3228
3229
}
3230
+ if ($Android ) {
3231
+ Invoke-BuildStep Write-PlatformInfoPlist Android
3232
+ }
3229
3233
}
3230
3234
3231
3235
if (-not $SkipBuild ) {
0 commit comments