@@ -241,7 +241,6 @@ $ArchX64 = @{
241241 LLVMTarget = " x86_64-unknown-windows-msvc" ;
242242 CMakeName = " AMD64" ;
243243 BinaryDir = " bin64" ;
244- PlatformInstallRoot = " $BinaryCache \x64\Windows.platform" ;
245244 SDKInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\SDKs\Windows.sdk" ;
246245 ExperimentalSDKInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk" ;
247246 XCTestInstallRoot = " $BinaryCache \x64\Windows.platform\Developer\Library\XCTest-development" ;
@@ -257,7 +256,6 @@ $ArchX86 = @{
257256 LLVMTarget = " i686-unknown-windows-msvc" ;
258257 CMakeName = " i686" ;
259258 BinaryDir = " bin32" ;
260- PlatformInstallRoot = " $BinaryCache \x86\Windows.platform" ;
261259 SDKInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\SDKs\Windows.sdk" ;
262260 ExperimentalSDKInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\SDKs\WindowsExperimental.sdk" ;
263261 XCTestInstallRoot = " $BinaryCache \x86\Windows.platform\Developer\Library\XCTest-development" ;
@@ -272,7 +270,6 @@ $ArchARM64 = @{
272270 LLVMTarget = " aarch64-unknown-windows-msvc" ;
273271 CMakeName = " ARM64" ;
274272 BinaryDir = " bin64a" ;
275- PlatformInstallRoot = " $BinaryCache \arm64\Windows.platform" ;
276273 SDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\Windows.sdk" ;
277274 ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\SDKs\WindowsExperimental.sdk" ;
278275 XCTestInstallRoot = " $BinaryCache \arm64\Windows.platform\Developer\Library\XCTest-development" ;
@@ -288,7 +285,6 @@ $AndroidARM64 = @{
288285 LLVMName = " aarch64" ;
289286 LLVMTarget = " aarch64-unknown-linux-android$AndroidAPILevel " ;
290287 ShortName = " arm64" ;
291- PlatformInstallRoot = " $BinaryCache \arm64\Android.platform" ;
292288 SDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\Android.sdk" ;
293289 ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk" ;
294290 XCTestInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\Library\XCTest-development" ;
@@ -303,7 +299,6 @@ $AndroidARMv7 = @{
303299 LLVMName = " armv7" ;
304300 LLVMTarget = " armv7-unknown-linux-androideabi$AndroidAPILevel " ;
305301 ShortName = " armv7" ;
306- PlatformInstallRoot = " $BinaryCache \armv7\Android.platform" ;
307302 SDKInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\SDKs\Android.sdk" ;
308303 ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk" ;
309304 XCTestInstallRoot = " $BinaryCache \armv7\Android.platform\Developer\Library\XCTest-development" ;
@@ -318,7 +313,6 @@ $AndroidX86 = @{
318313 LLVMName = " i686" ;
319314 LLVMTarget = " i686-unknown-linux-android$AndroidAPILevel " ;
320315 ShortName = " x86" ;
321- PlatformInstallRoot = " $BinaryCache \x86\Android.platform" ;
322316 SDKInstallRoot = " $BinaryCache \x86\Android.platform\Developer\SDKs\Android.sdk" ;
323317 ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk" ;
324318 XCTestInstallRoot = " $BinaryCache \x86\Android.platform\Developer\Library\XCTest-development" ;
@@ -333,7 +327,6 @@ $AndroidX64 = @{
333327 LLVMName = " x86_64" ;
334328 LLVMTarget = " x86_64-unknown-linux-android$AndroidAPILevel " ;
335329 ShortName = " x64" ;
336- PlatformInstallRoot = " $BinaryCache \x64\Android.platform" ;
337330 SDKInstallRoot = " $BinaryCache \x64\Android.platform\Developer\SDKs\Android.sdk" ;
338331 ExperimentalSDKInstallRoot = " $BinaryCache \arm64\Android.platform\Developer\SDKs\AndroidExperimental.sdk" ;
339332 XCTestInstallRoot = " $BinaryCache \x64\Android.platform\Developer\Library\XCTest-development" ;
@@ -390,10 +383,6 @@ function Get-InstallDir($Arch) {
390383 return " $ImageRoot \$ProgramFilesName \Swift"
391384}
392385
393- function Get-HostSwiftSDK () {
394- return ([IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " Windows.platform" , " Developer" , " SDKs" , " Windows.sdk" ))
395- }
396-
397386$NugetRoot = " $BinaryCache \nuget"
398387$PinnedToolchain = [IO.Path ]::GetFileNameWithoutExtension($PinnedBuild )
399388
@@ -1003,6 +992,21 @@ enum Platform {
1003992 Android
1004993}
1005994
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+
10061010function Build-CMakeProject {
10071011 [CmdletBinding (PositionalBinding = $false )]
10081012 param (
@@ -1403,7 +1407,7 @@ function Build-SPMProject {
14031407 $Stopwatch = [Diagnostics.Stopwatch ]::StartNew()
14041408
14051409 Isolate- EnvVars {
1406- $SDKInstallRoot = [ IO.Path ]::Combine(( Get-InstallDir $HostArch ) , " Platforms " , " Windows.platform " , " Developer " , " SDKs " , " Windows.sdk " )
1410+ $SDKInstallRoot = ( Get-SwiftSDK Windows)
14071411 $RuntimeInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Runtimes" , $ProductVersion )
14081412
14091413 $env: Path = " $RuntimeInstallRoot \usr\bin;$ ( $HostArch.ToolchainInstallRoot ) \usr\bin;${env: Path} "
@@ -1916,7 +1920,7 @@ function Build-DS2([Platform]$Platform, $Arch) {
19161920 Build-CMakeProject `
19171921 - Src " $SourceCache \ds2" `
19181922 - Bin " $BinaryCache \$ ( $Arch.LLVMTarget ) \ds2" `
1919- - InstallTo " $ ( $Arch .PlatformInstallRoot ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) " `
1923+ - InstallTo " $ ( Get-PlatformRoot $Platform ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) " `
19201924 - Arch $Arch `
19211925 - Platform $Platform `
19221926 - BuildTargets default `
@@ -2392,10 +2396,9 @@ function Build-Testing([Platform]$Platform, $Arch, [switch]$Test = $false) {
23922396 }
23932397}
23942398
2395- function Write-PlatformInfoPlist ($Arch ) {
2396- $PList = Join-Path - Path $Arch.PlatformInstallRoot - ChildPath " Info.plist"
2399+ function Write-PlatformInfoPlist ([Platform ] $Platform ) {
23972400 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 " ))
23992402}
24002403
24012404# Copies files installed by CMake from the arch-specific platform root,
@@ -2404,7 +2407,7 @@ function Write-PlatformInfoPlist($Arch) {
24042407function Install-Platform ([Platform ]$Platform , $Arch ) {
24052408 if ($ToBatch ) { return }
24062409
2407- $SDKInstallRoot = [ IO.Path ]::Combine(( Get-InstallDir $HostArch ) , " Platforms " , " $ Platform.platform " , " Developer " , " SDKs " , " $Platform .sdk " )
2410+ $SDKInstallRoot = ( Get-SwiftSDK $ Platform )
24082411
24092412 New-Item - ItemType Directory - ErrorAction Ignore $SDKInstallRoot \usr | Out-Null
24102413
@@ -2456,9 +2459,8 @@ function Install-Platform([Platform]$Platform, $Arch) {
24562459 }
24572460
24582461 # 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 ) \"
24622464
24632465 # Copy XCTest
24642466 $XCTestInstallRoot = [IO.Path ]::Combine((Get-InstallDir $HostArch ), " Platforms" , " ${Platform} .platform" , " Developer" , " Library" , " XCTest-development" )
@@ -2507,7 +2509,7 @@ function Build-System($Arch) {
25072509 - Arch $Arch `
25082510 - Platform Windows `
25092511 - UseBuiltCompilers C, Swift `
2510- - SwiftSDK (Get-HostSwiftSDK ) `
2512+ - SwiftSDK (Get-SwiftSDK Windows ) `
25112513 - BuildTargets default `
25122514 - Defines @ {
25132515 BUILD_SHARED_LIBS = " NO" ;
@@ -2523,7 +2525,7 @@ function Build-ToolsSupportCore($Arch) {
25232525 - Arch $Arch `
25242526 - Platform Windows `
25252527 - UseBuiltCompilers C, Swift `
2526- - SwiftSDK (Get-HostSwiftSDK ) `
2528+ - SwiftSDK (Get-SwiftSDK Windows ) `
25272529 - Defines @ {
25282530 BUILD_SHARED_LIBS = " YES" ;
25292531 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2562,7 +2564,7 @@ function Build-LLBuild($Arch, [switch]$Test = $false) {
25622564 - Platform Windows `
25632565 - UseMSVCCompilers CXX `
25642566 - UseBuiltCompilers Swift `
2565- - SwiftSDK (Get-HostSwiftSDK ) `
2567+ - SwiftSDK (Get-SwiftSDK Windows ) `
25662568 - BuildTargets $Targets `
25672569 - Defines ($TestingDefines + @ {
25682570 BUILD_SHARED_LIBS = " YES" ;
@@ -2581,7 +2583,7 @@ function Build-ArgumentParser($Arch) {
25812583 - Arch $Arch `
25822584 - Platform Windows `
25832585 - UseBuiltCompilers Swift `
2584- - SwiftSDK (Get-HostSwiftSDK ) `
2586+ - SwiftSDK (Get-SwiftSDK Windows ) `
25852587 - Defines @ {
25862588 BUILD_SHARED_LIBS = " YES" ;
25872589 BUILD_TESTING = " NO" ;
@@ -2597,7 +2599,7 @@ function Build-Driver($Arch) {
25972599 - Arch $Arch `
25982600 - Platform Windows `
25992601 - UseBuiltCompilers C, CXX, Swift `
2600- - SwiftSDK (Get-HostSwiftSDK ) `
2602+ - SwiftSDK (Get-SwiftSDK Windows ) `
26012603 - Defines @ {
26022604 BUILD_SHARED_LIBS = " YES" ;
26032605 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2620,7 +2622,7 @@ function Build-Crypto($Arch) {
26202622 - Arch $Arch `
26212623 - Platform Windows `
26222624 - UseBuiltCompilers Swift `
2623- - SwiftSDK (Get-HostSwiftSDK ) `
2625+ - SwiftSDK (Get-SwiftSDK Windows ) `
26242626 - BuildTargets default `
26252627 - Defines @ {
26262628 BUILD_SHARED_LIBS = " NO" ;
@@ -2636,7 +2638,7 @@ function Build-Collections($Arch) {
26362638 - Arch $Arch `
26372639 - Platform Windows `
26382640 - UseBuiltCompilers C, Swift `
2639- - SwiftSDK (Get-HostSwiftSDK ) `
2641+ - SwiftSDK (Get-SwiftSDK Windows ) `
26402642 - Defines @ {
26412643 BUILD_SHARED_LIBS = " YES" ;
26422644 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2649,7 +2651,7 @@ function Build-ASN1($Arch) {
26492651 - Bin (Get-HostProjectBinaryCache ASN1) `
26502652 - Arch $Arch `
26512653 - UseBuiltCompilers Swift `
2652- - SwiftSDK (Get-HostSwiftSDK ) `
2654+ - SwiftSDK (Get-SwiftSDK Windows ) `
26532655 - BuildTargets default `
26542656 - Defines @ {
26552657 BUILD_SHARED_LIBS = " NO" ;
@@ -2664,7 +2666,7 @@ function Build-Certificates($Arch) {
26642666 - Arch $Arch `
26652667 - Platform Windows `
26662668 - UseBuiltCompilers Swift `
2667- - SwiftSDK (Get-HostSwiftSDK ) `
2669+ - SwiftSDK (Get-SwiftSDK Windows ) `
26682670 - BuildTargets default `
26692671 - Defines @ {
26702672 BUILD_SHARED_LIBS = " NO" ;
@@ -2688,7 +2690,7 @@ function Build-PackageManager($Arch) {
26882690 - Arch $Arch `
26892691 - Platform Windows `
26902692 - UseBuiltCompilers C, Swift `
2691- - SwiftSDK (Get-HostSwiftSDK ) `
2693+ - SwiftSDK (Get-SwiftSDK Windows ) `
26922694 - Defines @ {
26932695 BUILD_SHARED_LIBS = " YES" ;
26942696 CMAKE_Swift_FLAGS = @ (" -DCRYPTO_v2" );
@@ -2716,7 +2718,7 @@ function Build-Markdown($Arch) {
27162718 - Arch $Arch `
27172719 - Platform Windows `
27182720 - UseBuiltCompilers C, Swift `
2719- - SwiftSDK (Get-HostSwiftSDK ) `
2721+ - SwiftSDK (Get-SwiftSDK Windows ) `
27202722 - Defines @ {
27212723 BUILD_SHARED_LIBS = " NO" ;
27222724 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
@@ -2734,7 +2736,7 @@ function Build-Format($Arch) {
27342736 - Platform Windows `
27352737 - UseMSVCCompilers C `
27362738 - UseBuiltCompilers Swift `
2737- - SwiftSDK (Get-HostSwiftSDK ) `
2739+ - SwiftSDK (Get-SwiftSDK Windows ) `
27382740 - Defines @ {
27392741 BUILD_SHARED_LIBS = " YES" ;
27402742 ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
@@ -2792,7 +2794,7 @@ function Build-LMDB($Arch) {
27922794}
27932795
27942796function Build-IndexStoreDB ($Arch ) {
2795- $SDKInstallRoot = (Get-HostSwiftSDK );
2797+ $SDKInstallRoot = (Get-SwiftSDK Windows );
27962798
27972799 Build-CMakeProject `
27982800 - Src $SourceCache \indexstore- db `
@@ -2819,7 +2821,7 @@ function Build-SourceKitLSP($Arch) {
28192821 - Arch $Arch `
28202822 - Platform Windows `
28212823 - UseBuiltCompilers C, Swift `
2822- - SwiftSDK (Get-HostSwiftSDK ) `
2824+ - SwiftSDK (Get-SwiftSDK Windows ) `
28232825 - Defines @ {
28242826 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
28252827 SwiftSyntax_DIR = (Get-HostProjectCMakeModules Compilers);
@@ -3005,7 +3007,7 @@ function Build-Inspect([Platform]$Platform, $Arch) {
30053007 # since it is currently only built for the host and and cannot be built for Android until
30063008 # the pinned version is >= 1.5.0.
30073009 $ArgumentParserDir = " "
3008- $InstallPath = " $ ( $Arch .PlatformInstallRoot ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) "
3010+ $InstallPath = " $ ( Get-PlatformRoot $Platform ) \Developer\Library\$ ( Get-ModuleTriple $Arch ) "
30093011 }
30103012
30113013 Build-CMakeProject `
@@ -3082,7 +3084,7 @@ function Build-Installer($Arch) {
30823084
30833085 foreach ($SDK in $WindowsSDKArchs ) {
30843086 $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 ) \" ;
30863088 $Properties [" SDK_ROOT_$ ( $SDK.VSName.ToUpperInvariant ()) " ] = " $ ( $SDK.SDKInstallRoot ) \"
30873089 }
30883090
@@ -3170,7 +3172,6 @@ if (-not $SkipBuild) {
31703172 Invoke-BuildStep Build-XCTest Windows $Arch
31713173 Invoke-BuildStep Build-Testing Windows $Arch
31723174 Invoke-BuildStep Write-SDKSettingsPlist Windows $Arch
3173- Invoke-BuildStep Write-PlatformInfoPlist $Arch
31743175
31753176 Invoke-BuildStep Build-ExperimentalRuntime - Static Windows $Arch
31763177 Invoke-BuildStep Build-Foundation - Static Windows $Arch
@@ -3199,7 +3200,6 @@ if (-not $SkipBuild) {
31993200 Invoke-BuildStep Build-Inspect - Platform Android - Arch $Arch
32003201 }
32013202 Invoke-BuildStep Write-SDKSettingsPlist Android $Arch
3202- Invoke-BuildStep Write-PlatformInfoPlist $Arch
32033203
32043204 Invoke-BuildStep Build-ExperimentalRuntime - Static Android $Arch
32053205 Invoke-BuildStep Build-Foundation - Static Android $Arch
@@ -3222,10 +3222,14 @@ if (-not $ToBatch) {
32223222 foreach ($Arch in $WindowsSDKArchs ) {
32233223 Install-Platform Windows $Arch
32243224 }
3225+ Invoke-BuildStep Write-PlatformInfoPlist Windows
32253226
32263227 foreach ($Arch in $AndroidSDKArchs ) {
32273228 Install-Platform Android $Arch
32283229 }
3230+ if ($Android ) {
3231+ Invoke-BuildStep Write-PlatformInfoPlist Android
3232+ }
32293233}
32303234
32313235if (-not $SkipBuild ) {
0 commit comments