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