@@ -2290,31 +2290,49 @@ function Build-ExperimentalRuntime {
2290
2290
}
2291
2291
}
2292
2292
2293
- function Write-SDKSettingsPlist ([Hashtable ] $Platform ) {
2293
+ function Write-SDKSettingsPlist ([OS ] $OS ) {
2294
2294
$SDKSettings = @ {
2295
2295
DefaultProperties = @ {
2296
2296
}
2297
2297
}
2298
- if ($Platform . OS -eq [OS ]::Windows) {
2298
+ if ($OS -eq [OS ]::Windows) {
2299
2299
$SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = " MD"
2300
2300
}
2301
- Write-PList - Settings $SDKSettings - Path " $ ( Get-SwiftSDK $Platform . OS ) \SDKSettings.plist"
2301
+ Write-PList - Settings $SDKSettings - Path " $ ( Get-SwiftSDK $OS ) \SDKSettings.plist"
2302
2302
2303
2303
$SDKSettings = @ {
2304
- CanonicalName = " $ ( $Platform .Triple ) "
2305
- DisplayName = " $ ( $Platform . OS.ToString ()) "
2304
+ CanonicalName = $OS .ToString ()
2305
+ DisplayName = $ OS.ToString ()
2306
2306
IsBaseSDK = " NO"
2307
2307
Version = " ${ProductVersion} "
2308
2308
VersionMap = @ {}
2309
2309
DefaultProperties = @ {
2310
- PLATFORM_NAME = " $ ( $Platform . OS.ToString ()) "
2310
+ PLATFORM_NAME = $ OS.ToString ()
2311
2311
DEFAULT_COMPILER = " ${ToolchainIdentifier} "
2312
2312
}
2313
+ SupportedTargets = @ {
2314
+ $OS.ToString () = @ {
2315
+ PlatformFamilyDisplayName = $OS.ToString ()
2316
+ PlatformFamilyName = $OS.ToString ()
2317
+ }
2318
+ }
2313
2319
}
2314
- if ($Platform.OS -eq [OS ]::Windows) {
2315
- $SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = " MD"
2320
+ switch ($OS ) {
2321
+ Windows {
2322
+ $SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = " MD"
2323
+ $SDKSettings.SupportedTargets.Windows.LLVMTargetVendor = " unknown"
2324
+ $SDKSettings.SupportedTargets.Windows.LLVMTargetSys = " windows"
2325
+ $SDKSettings.SupportedTargets.Windows.LLVMTargetTripleEnvironment = " msvc"
2326
+ $SDKSettings.SupportedTargets.Windows.Archs = $WindowsSDKPlatforms | ForEach-Object { $_.Architecture.LLVMName } | Sort-Object
2327
+ }
2328
+ Android {
2329
+ $SDKSettings.SupportedTargets.Android.LLVMTargetVendor = " unknown"
2330
+ $SDKSettings.SupportedTargets.Android.LLVMTargetSys = " linux"
2331
+ $SDKSettings.SupportedTargets.Android.LLVMTargetTripleEnvironment = " android${AndroidAPILevel} "
2332
+ $SDKSettings.SupportedTargets.Android.Archs = $AndroidSDKPlatforms | ForEach-Object { $_.Architecture.LLVMName } | Sort-Object
2333
+ }
2316
2334
}
2317
- $SDKSettings | ConvertTo-JSON | Out-FIle - FilePath " $ ( Get-SwiftSDK $Platform . OS ) \SDKSettings.json"
2335
+ $SDKSettings | ConvertTo-JSON - Depth 4 | Out-FIle - FilePath " $ ( Get-SwiftSDK $OS ) \SDKSettings.json"
2318
2336
}
2319
2337
2320
2338
function Build-Dispatch ([Hashtable ] $Platform ) {
@@ -2501,18 +2519,18 @@ function Test-Testing {
2501
2519
throw " testing Testing is not supported"
2502
2520
}
2503
2521
2504
- function Write-PlatformInfoPlist ([Hashtable ] $Platform ) {
2522
+ function Write-PlatformInfoPlist ([OS ] $OS ) {
2505
2523
$Settings = @ {
2506
2524
DefaultProperties = @ {
2507
2525
SWIFT_TESTING_VERSION = " $ProductVersion "
2508
2526
XCTEST_VERSION = " $ProductVersion "
2509
2527
}
2510
2528
}
2511
- if ($Platform . OS -eq [OS ]::Windows) {
2529
+ if ($OS -eq [OS ]::Windows) {
2512
2530
$Settings.DefaultProperties.SWIFTC_FLAGS = @ ( " -use-ld=lld" )
2513
2531
}
2514
2532
2515
- Write-PList - Settings $Settings - Path " $ ( Get-PlatformRoot $Platform . OS ) \Info.plist"
2533
+ Write-PList - Settings $Settings - Path " $ ( Get-PlatformRoot $OS ) \Info.plist"
2516
2534
}
2517
2535
2518
2536
# Copies files installed by CMake from the arch-specific platform root,
@@ -2532,12 +2550,44 @@ function Install-Platform([Hashtable[]] $Platforms, [OS] $OS) {
2532
2550
$PlatformResources = " $ ( Get-SwiftSDK $Platform.OS ) \usr\lib\swift\$ ( $Platform.OS.ToString ().ToLowerInvariant()) "
2533
2551
Get-ChildItem - Recurse " $PlatformResources \$ ( $Platform.Architecture.LLVMName ) " | ForEach-Object {
2534
2552
if (" .swiftmodule" , " .swiftdoc" , " .swiftinterface" -contains $_.Extension ) {
2553
+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not in a thick module layout"
2535
2554
Copy-File $_.FullName " $PlatformResources \$ ( $_.BaseName ) .swiftmodule\$ ( Get-ModuleTriple $Platform ) $ ( $_.Extension ) "
2536
2555
}
2537
2556
}
2538
2557
}
2539
2558
}
2540
2559
2560
+ function Build-SDK ([Hashtable ] $Platform , [switch ] $IncludeMacros = $false ) {
2561
+ if ($IncludeDS2 ) {
2562
+ Invoke-BuildStep Build-DS2 $Platform
2563
+ }
2564
+
2565
+ # Third Party Dependencies
2566
+ Invoke-BuildStep Build-ZLib $Platform
2567
+ Invoke-BuildStep Build-XML2 $Platform
2568
+ Invoke-BuildStep Build-CURL $Platform
2569
+ Invoke-BuildStep Build-LLVM $Platform
2570
+
2571
+ # Libraries
2572
+ Invoke-BuildStep Build-Runtime $Platform
2573
+ Invoke-BuildStep Build-Dispatch $Platform
2574
+ if ($IncludeMacros ) {
2575
+ Invoke-BuildStep Build-FoundationMacros $Platform
2576
+ Invoke-BuildStep Build-TestingMacros $Platform
2577
+ }
2578
+ Invoke-BuildStep Build-Foundation $Platform
2579
+ Invoke-BuildStep Build-Sanitizers $Platform
2580
+ Invoke-BuildStep Build-XCTest $Platform
2581
+ Invoke-BuildStep Build-Testing $Platform
2582
+ }
2583
+
2584
+ function Build-ExperimentalSDK ([Hashtable ] $Platform ) {
2585
+ # TODO(compnerd) we currently build the experimental SDK with just the static
2586
+ # variant. We should aim to build both dynamic and static variants.
2587
+ Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
2588
+ Invoke-BuildStep Build-Foundation $Platform - Static
2589
+ }
2590
+
2541
2591
function Build-SQLite ([Hashtable ] $Platform ) {
2542
2592
Build-CMakeProject `
2543
2593
- Src $SourceCache \swift- toolchain- sqlite `
@@ -3167,69 +3217,44 @@ if (-not $SkipBuild) {
3167
3217
Invoke-BuildStep Build-XML2 $HostPlatform
3168
3218
Invoke-BuildStep Build-Compilers $HostPlatform
3169
3219
3220
+ Invoke-BuildStep Build-SDK $BuildPlatform - IncludeMacros
3221
+
3170
3222
foreach ($Platform in $WindowsSDKPlatforms ) {
3171
- Invoke-BuildStep Build-ZLib $Platform
3172
- Invoke-BuildStep Build-XML2 $Platform
3173
- Invoke-BuildStep Build-CURL $Platform
3174
- Invoke-BuildStep Build-LLVM $Platform
3175
-
3176
- # Build platform: SDK, Redist and XCTest
3177
- Invoke-BuildStep Build-Runtime $Platform
3178
- Invoke-BuildStep Build-Dispatch $Platform
3179
- # FIXME(compnerd) ensure that the _build_ is the first arch and don't rebuild on each arch
3180
- if ($Platform -eq $BuildPlatform ) {
3181
- Invoke-BuildStep Build-FoundationMacros $BuildPlatform
3182
- Invoke-BuildStep Build-TestingMacros $BuildPlatform
3183
- }
3184
- Invoke-BuildStep Build-Foundation $Platform
3185
- Invoke-BuildStep Build-Sanitizers $Platform
3186
- Invoke-BuildStep Build-XCTest $Platform
3187
- Invoke-BuildStep Build-Testing $Platform
3188
- Invoke-BuildStep Write-SDKSettingsPlist $Platform
3189
-
3190
- Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
3191
- Invoke-BuildStep Build-Foundation $Platform - Static
3192
-
3193
- Copy-File " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\*.lib" " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\$ ( $Platform.Architecture.LLVMName ) \"
3223
+ Invoke-BuildStep Build-SDK $Platform
3224
+ Invoke-BuildStep Build-ExperimentalSDK $Platform
3225
+
3226
+ Get-ChildItem " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows" - Filter " *.lib" - File - ErrorAction Ignore | ForEach-Object {
3227
+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3228
+ Move-Item $_.FullName " $ ( Get-SwiftSDK Windows) \usr\lib\swift\windows\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
3229
+ }
3230
+
3194
3231
if ($Platform -eq $HostPlatform ) {
3195
- Copy-Directory " $ ( Get-SwiftSDK Windows) \usr\bin" " $ ( [IO.Path ]::Combine((Get-InstallDir $HostPlatform ), " Runtimes" , $ProductVersion )) \usr"
3232
+ Copy-Directory " $ ( Get-SwiftSDK Windows) \usr\bin" " $ ( [IO.Path ]::Combine((Get-InstallDir $Platform ), " Runtimes" , $ProductVersion )) \usr"
3196
3233
}
3197
3234
}
3198
3235
Install-Platform $WindowsSDKPlatforms Windows
3199
- Invoke-BuildStep Write-PlatformInfoPlist $HostPlatform
3236
+ Write-PlatformInfoPlist Windows
3237
+ Write-SDKSettingsPlist Windows
3200
3238
3201
3239
if ($Android ) {
3202
3240
foreach ($Platform in $AndroidSDKPlatforms ) {
3203
- if ($IncludeDS2 ) {
3204
- Invoke-BuildStep Build-DS2 $Platform
3205
- }
3206
- Invoke-BuildStep Build-ZLib $Platform
3207
- Invoke-BuildStep Build-XML2 $Platform
3208
- Invoke-BuildStep Build-CURL $Platform
3209
- Invoke-BuildStep Build-LLVM $Platform
3210
-
3211
- # Build platform: SDK, Redist and XCTest
3212
- Invoke-BuildStep Build-Runtime $Platform
3213
- Invoke-BuildStep Build-Dispatch $Platform
3214
- Invoke-BuildStep Build-Foundation $Platform
3215
- Invoke-BuildStep Build-Sanitizers $Platform
3216
- Invoke-BuildStep Build-XCTest $Platform
3217
- Invoke-BuildStep Build-Testing $Platform
3218
-
3219
- # Android swift-inspect only supports 64-bit platforms.
3220
- if ($Platform.Architecture.ABI -in @ (" arm64-v8a" , " x86_64" )) {
3221
- Invoke-BuildStep Build-Inspect $Platform
3241
+ Invoke-BuildStep Build-SDK $Platform
3242
+ Invoke-BuildStep Build-ExperimentalSDK $Platform
3243
+
3244
+ Get-ChildItem " $ ( Get-SwiftSDK Android) \usr\lib\swift\android" - File | Where-Object { $_.Name -match " .a$|.so$" } | ForEach-Object {
3245
+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not nested in an architecture directory"
3246
+ Move-Item $_.FullName " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\$ ( $Platform.Architecture.LLVMName ) \" | Out-Null
3222
3247
}
3223
- Invoke-BuildStep Write-SDKSettingsPlist $Platform
3248
+ }
3224
3249
3225
- Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
3226
- Invoke-BuildStep Build-Foundation $Platform - Static
3250
+ Install-Platform $AndroidSDKPlatforms Android
3251
+ Write-PlatformInfoPlist Android
3252
+ Write-SDKSettingsPlist Android
3227
3253
3228
- Move-Item " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\*.a" " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\$ ( $Platform.Architecture.LLVMName ) \"
3229
- Move-Item " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\*.so" " $ ( Get-SwiftSDK Android) \usr\lib\swift\android\$ ( $Platform.Architecture.LLVMName ) \"
3254
+ # Android swift-inspect only supports 64-bit platforms.
3255
+ $AndroidSDKPlatforms | Where-Object { @ (" arm64-v8a" , " x86_64" ) -contains $_.Architecture.ABI } | ForEach-Object {
3256
+ Invoke-BuildStep Build-Inspect $_
3230
3257
}
3231
- Install-Platform $AndroidSDKPlatforms Android
3232
- Invoke-BuildStep Write-PlatformInfoPlist $Platform
3233
3258
}
3234
3259
3235
3260
# Build Macros for distribution
0 commit comments