@@ -2307,31 +2307,49 @@ function Build-ExperimentalRuntime {
23072307 }
23082308}
23092309
2310- function Write-SDKSettingsPlist ([Hashtable ] $Platform ) {
2310+ function Write-SDKSettingsPlist ([OS ] $OS ) {
23112311 $SDKSettings = @ {
23122312 DefaultProperties = @ {
23132313 }
23142314 }
2315- if ($Platform . OS -eq [OS ]::Windows) {
2315+ if ($OS -eq [OS ]::Windows) {
23162316 $SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = " MD"
23172317 }
2318- Write-PList - Settings $SDKSettings - Path " $ ( Get-SwiftSDK $Platform . OS ) \SDKSettings.plist"
2318+ Write-PList - Settings $SDKSettings - Path " $ ( Get-SwiftSDK $OS ) \SDKSettings.plist"
23192319
23202320 $SDKSettings = @ {
2321- CanonicalName = " $ ( $Platform .Triple ) "
2322- DisplayName = " $ ( $Platform . OS.ToString ()) "
2321+ CanonicalName = $OS .ToString ()
2322+ DisplayName = $ OS.ToString ()
23232323 IsBaseSDK = " NO"
23242324 Version = " ${ProductVersion} "
23252325 VersionMap = @ {}
23262326 DefaultProperties = @ {
2327- PLATFORM_NAME = " $ ( $Platform . OS.ToString ()) "
2327+ PLATFORM_NAME = $ OS.ToString ()
23282328 DEFAULT_COMPILER = " ${ToolchainIdentifier} "
23292329 }
2330+ SupportedTargets = @ {
2331+ $OS.ToString () = @ {
2332+ PlatformFamilyDisplayName = $OS.ToString ()
2333+ PlatformFamilyName = $OS.ToString ()
2334+ }
2335+ }
23302336 }
2331- if ($Platform.OS -eq [OS ]::Windows) {
2332- $SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = " MD"
2337+ switch ($OS ) {
2338+ Windows {
2339+ $SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = " MD"
2340+ $SDKSettings.SupportedTargets.Windows.LLVMTargetVendor = " unknown"
2341+ $SDKSettings.SupportedTargets.Windows.LLVMTargetSys = " windows"
2342+ $SDKSettings.SupportedTargets.Windows.LLVMTargetTripleEnvironment = " msvc"
2343+ $SDKSettings.SupportedTargets.Windows.Archs = $WindowsSDKPlatforms | ForEach-Object { $_.Architecture.LLVMName } | Sort-Object
2344+ }
2345+ Android {
2346+ $SDKSettings.SupportedTargets.Android.LLVMTargetVendor = " unknown"
2347+ $SDKSettings.SupportedTargets.Android.LLVMTargetSys = " linux"
2348+ $SDKSettings.SupportedTargets.Android.LLVMTargetTripleEnvironment = " android${AndroidAPILevel} "
2349+ $SDKSettings.SupportedTargets.Android.Archs = $AndroidSDKPlatforms | ForEach-Object { $_.Architecture.LLVMName } | Sort-Object
2350+ }
23332351 }
2334- $SDKSettings | ConvertTo-JSON | Out-FIle - FilePath " $ ( Get-SwiftSDK $Platform . OS ) \SDKSettings.json"
2352+ $SDKSettings | ConvertTo-JSON - Depth 4 | Out-FIle - FilePath " $ ( Get-SwiftSDK $OS ) \SDKSettings.json"
23352353}
23362354
23372355function Build-Dispatch ([Hashtable ] $Platform ) {
@@ -2518,18 +2536,18 @@ function Test-Testing {
25182536 throw " testing Testing is not supported"
25192537}
25202538
2521- function Write-PlatformInfoPlist ([Hashtable ] $Platform ) {
2539+ function Write-PlatformInfoPlist ([OS ] $OS ) {
25222540 $Settings = @ {
25232541 DefaultProperties = @ {
25242542 SWIFT_TESTING_VERSION = " $ProductVersion "
25252543 XCTEST_VERSION = " $ProductVersion "
25262544 }
25272545 }
2528- if ($Platform . OS -eq [OS ]::Windows) {
2546+ if ($OS -eq [OS ]::Windows) {
25292547 $Settings.DefaultProperties.SWIFTC_FLAGS = @ ( " -use-ld=lld" )
25302548 }
25312549
2532- Write-PList - Settings $Settings - Path " $ ( Get-PlatformRoot $Platform . OS ) \Info.plist"
2550+ Write-PList - Settings $Settings - Path " $ ( Get-PlatformRoot $OS ) \Info.plist"
25332551}
25342552
25352553# Copies files installed by CMake from the arch-specific platform root,
@@ -2549,12 +2567,44 @@ function Install-Platform([Hashtable[]] $Platforms, [OS] $OS) {
25492567 $PlatformResources = " $ ( Get-SwiftSDK $Platform.OS ) \usr\lib\swift\$ ( $Platform.OS.ToString ().ToLowerInvariant()) "
25502568 Get-ChildItem - Recurse " $PlatformResources \$ ( $Platform.Architecture.LLVMName ) " | ForEach-Object {
25512569 if (" .swiftmodule" , " .swiftdoc" , " .swiftinterface" -contains $_.Extension ) {
2570+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not in a thick module layout"
25522571 Copy-File $_.FullName " $PlatformResources \$ ( $_.BaseName ) .swiftmodule\$ ( Get-ModuleTriple $Platform ) $ ( $_.Extension ) "
25532572 }
25542573 }
25552574 }
25562575}
25572576
2577+ function Build-SDK ([Hashtable ] $Platform , [switch ] $IncludeMacros = $false ) {
2578+ if ($IncludeDS2 ) {
2579+ Invoke-BuildStep Build-DS2 $Platform
2580+ }
2581+
2582+ # Third Party Dependencies
2583+ Invoke-BuildStep Build-ZLib $Platform
2584+ Invoke-BuildStep Build-XML2 $Platform
2585+ Invoke-BuildStep Build-CURL $Platform
2586+ Invoke-BuildStep Build-LLVM $Platform
2587+
2588+ # Libraries
2589+ Invoke-BuildStep Build-Runtime $Platform
2590+ Invoke-BuildStep Build-Dispatch $Platform
2591+ if ($IncludeMacros ) {
2592+ Invoke-BuildStep Build-FoundationMacros $Platform
2593+ Invoke-BuildStep Build-TestingMacros $Platform
2594+ }
2595+ Invoke-BuildStep Build-Foundation $Platform
2596+ Invoke-BuildStep Build-Sanitizers $Platform
2597+ Invoke-BuildStep Build-XCTest $Platform
2598+ Invoke-BuildStep Build-Testing $Platform
2599+ }
2600+
2601+ function Build-ExperimentalSDK ([Hashtable ] $Platform ) {
2602+ # TODO(compnerd) we currently build the experimental SDK with just the static
2603+ # variant. We should aim to build both dynamic and static variants.
2604+ Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
2605+ Invoke-BuildStep Build-Foundation $Platform - Static
2606+ }
2607+
25582608function Build-SQLite ([Hashtable ] $Platform ) {
25592609 Build-CMakeProject `
25602610 - Src $SourceCache \swift- toolchain- sqlite `
@@ -3184,69 +3234,44 @@ if (-not $SkipBuild) {
31843234 Invoke-BuildStep Build-XML2 $HostPlatform
31853235 Invoke-BuildStep Build-Compilers $HostPlatform
31863236
3237+ Invoke-BuildStep Build-SDK $BuildPlatform - IncludeMacros
3238+
31873239 foreach ($Platform in $WindowsSDKPlatforms ) {
3188- Invoke-BuildStep Build-ZLib $Platform
3189- Invoke-BuildStep Build-XML2 $Platform
3190- Invoke-BuildStep Build-CURL $Platform
3191- Invoke-BuildStep Build-LLVM $Platform
3192-
3193- # Build platform: SDK, Redist and XCTest
3194- Invoke-BuildStep Build-Runtime $Platform
3195- Invoke-BuildStep Build-Dispatch $Platform
3196- # FIXME(compnerd) ensure that the _build_ is the first arch and don't rebuild on each arch
3197- if ($Platform -eq $BuildPlatform ) {
3198- Invoke-BuildStep Build-FoundationMacros $BuildPlatform
3199- Invoke-BuildStep Build-TestingMacros $BuildPlatform
3200- }
3201- Invoke-BuildStep Build-Foundation $Platform
3202- Invoke-BuildStep Build-Sanitizers $Platform
3203- Invoke-BuildStep Build-XCTest $Platform
3204- Invoke-BuildStep Build-Testing $Platform
3205- Invoke-BuildStep Write-SDKSettingsPlist $Platform
3206-
3207- Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
3208- Invoke-BuildStep Build-Foundation $Platform - Static
3209-
3210- Copy-File " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\*.lib" " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\$ ( $Platform.Architecture.LLVMName ) \"
3240+ Invoke-BuildStep Build-SDK $Platform
3241+ Invoke-BuildStep Build-ExperimentalSDK $Platform
3242+
3243+ Get-ChildItem " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows" - Filter " *.lib" - File - ErrorAction Ignore | ForEach-Object {
3244+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3245+ Move-Item $_.FullName " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
3246+ }
3247+
32113248 if ($Platform -eq $HostPlatform ) {
3212- Copy-Directory " $ ( Get-SwiftSDK Windows) \usr\bin" " $ ( [IO.Path ]::Combine((Get-InstallDir $HostPlatform ), " Runtimes" , $ProductVersion )) \usr"
3249+ Copy-Directory " $ ( Get-SwiftSDK Windows) \usr\bin" " $ ( [IO.Path ]::Combine((Get-InstallDir $Platform ), " Runtimes" , $ProductVersion )) \usr"
32133250 }
32143251 }
32153252 Install-Platform $WindowsSDKPlatforms Windows
3216- Invoke-BuildStep Write-PlatformInfoPlist $HostPlatform
3253+ Write-PlatformInfoPlist Windows
3254+ Write-SDKSettingsPlist Windows
32173255
32183256 if ($Android ) {
32193257 foreach ($Platform in $AndroidSDKPlatforms ) {
3220- if ($IncludeDS2 ) {
3221- Invoke-BuildStep Build-DS2 $Platform
3222- }
3223- Invoke-BuildStep Build-ZLib $Platform
3224- Invoke-BuildStep Build-XML2 $Platform
3225- Invoke-BuildStep Build-CURL $Platform
3226- Invoke-BuildStep Build-LLVM $Platform
3227-
3228- # Build platform: SDK, Redist and XCTest
3229- Invoke-BuildStep Build-Runtime $Platform
3230- Invoke-BuildStep Build-Dispatch $Platform
3231- Invoke-BuildStep Build-Foundation $Platform
3232- Invoke-BuildStep Build-Sanitizers $Platform
3233- Invoke-BuildStep Build-XCTest $Platform
3234- Invoke-BuildStep Build-Testing $Platform
3235-
3236- # Android swift-inspect only supports 64-bit platforms.
3237- if ($Platform.Architecture.ABI -in @ (" arm64-v8a" , " x86_64" )) {
3238- Invoke-BuildStep Build-Inspect $Platform
3258+ Invoke-BuildStep Build-SDK $Platform
3259+ Invoke-BuildStep Build-ExperimentalSDK $Platform
3260+
3261+ Get-ChildItem " $ ( Get-SwiftSDK Android) \usr\lib\swift\android" - File | Where-Object { $_.Name -match " .a$|.so$" } | ForEach-Object {
3262+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3263+ Move-Item $_.FullName " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
32393264 }
3240- Invoke-BuildStep Write-SDKSettingsPlist $Platform
3265+ }
32413266
3242- Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
3243- Invoke-BuildStep Build-Foundation $Platform - Static
3267+ Install-Platform $AndroidSDKPlatforms Android
3268+ Write-PlatformInfoPlist Android
3269+ Write-SDKSettingsPlist Android
32443270
3245- Move-Item " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\*.a" " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\$ ( $Platform.Architecture.LLVMName ) \"
3246- Move-Item " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\*.so" " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\$ ( $Platform.Architecture.LLVMName ) \"
3271+ # Android swift-inspect only supports 64-bit platforms.
3272+ $AndroidSDKPlatforms | Where-Object { @ (" arm64-v8a" , " x86_64" ) -contains $_.Architecture.ABI } | ForEach-Object {
3273+ Invoke-BuildStep Build-Inspect $_
32473274 }
3248- Install-Platform $AndroidSDKPlatforms Android
3249- Invoke-BuildStep Write-PlatformInfoPlist $Platform
32503275 }
32513276
32523277 # Build Macros for distribution
0 commit comments