@@ -2307,31 +2307,49 @@ function Build-ExperimentalRuntime {
2307
2307
}
2308
2308
}
2309
2309
2310
- function Write-SDKSettingsPlist ([Hashtable ] $Platform ) {
2310
+ function Write-SDKSettingsPlist ([OS ] $OS ) {
2311
2311
$SDKSettings = @ {
2312
2312
DefaultProperties = @ {
2313
2313
}
2314
2314
}
2315
- if ($Platform . OS -eq [OS ]::Windows) {
2315
+ if ($OS -eq [OS ]::Windows) {
2316
2316
$SDKSettings.DefaultProperties.DEFAULT_USE_RUNTIME = " MD"
2317
2317
}
2318
- Write-PList - Settings $SDKSettings - Path " $ ( Get-SwiftSDK $Platform . OS ) \SDKSettings.plist"
2318
+ Write-PList - Settings $SDKSettings - Path " $ ( Get-SwiftSDK $OS ) \SDKSettings.plist"
2319
2319
2320
2320
$SDKSettings = @ {
2321
- CanonicalName = " $ ( $Platform .Triple ) "
2322
- DisplayName = " $ ( $Platform . OS.ToString ()) "
2321
+ CanonicalName = $OS .ToString ()
2322
+ DisplayName = $ OS.ToString ()
2323
2323
IsBaseSDK = " NO"
2324
2324
Version = " ${ProductVersion} "
2325
2325
VersionMap = @ {}
2326
2326
DefaultProperties = @ {
2327
- PLATFORM_NAME = " $ ( $Platform . OS.ToString ()) "
2327
+ PLATFORM_NAME = $ OS.ToString ()
2328
2328
DEFAULT_COMPILER = " ${ToolchainIdentifier} "
2329
2329
}
2330
+ SupportedTargets = @ {
2331
+ $OS.ToString () = @ {
2332
+ PlatformFamilyDisplayName = $OS.ToString ()
2333
+ PlatformFamilyName = $OS.ToString ()
2334
+ }
2335
+ }
2330
2336
}
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
+ }
2333
2351
}
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"
2335
2353
}
2336
2354
2337
2355
function Build-Dispatch ([Hashtable ] $Platform ) {
@@ -2518,18 +2536,18 @@ function Test-Testing {
2518
2536
throw " testing Testing is not supported"
2519
2537
}
2520
2538
2521
- function Write-PlatformInfoPlist ([Hashtable ] $Platform ) {
2539
+ function Write-PlatformInfoPlist ([OS ] $OS ) {
2522
2540
$Settings = @ {
2523
2541
DefaultProperties = @ {
2524
2542
SWIFT_TESTING_VERSION = " $ProductVersion "
2525
2543
XCTEST_VERSION = " $ProductVersion "
2526
2544
}
2527
2545
}
2528
- if ($Platform . OS -eq [OS ]::Windows) {
2546
+ if ($OS -eq [OS ]::Windows) {
2529
2547
$Settings.DefaultProperties.SWIFTC_FLAGS = @ ( " -use-ld=lld" )
2530
2548
}
2531
2549
2532
- Write-PList - Settings $Settings - Path " $ ( Get-PlatformRoot $Platform . OS ) \Info.plist"
2550
+ Write-PList - Settings $Settings - Path " $ ( Get-PlatformRoot $OS ) \Info.plist"
2533
2551
}
2534
2552
2535
2553
# Copies files installed by CMake from the arch-specific platform root,
@@ -2549,12 +2567,44 @@ function Install-Platform([Hashtable[]] $Platforms, [OS] $OS) {
2549
2567
$PlatformResources = " $ ( Get-SwiftSDK $Platform.OS ) \usr\lib\swift\$ ( $Platform.OS.ToString ().ToLowerInvariant()) "
2550
2568
Get-ChildItem - Recurse " $PlatformResources \$ ( $Platform.Architecture.LLVMName ) " | ForEach-Object {
2551
2569
if (" .swiftmodule" , " .swiftdoc" , " .swiftinterface" -contains $_.Extension ) {
2570
+ Write-Host - BackgroundColor DarkRed - ForegroundColor White " $ ( $_.FullName ) is not in a thick module layout"
2552
2571
Copy-File $_.FullName " $PlatformResources \$ ( $_.BaseName ) .swiftmodule\$ ( Get-ModuleTriple $Platform ) $ ( $_.Extension ) "
2553
2572
}
2554
2573
}
2555
2574
}
2556
2575
}
2557
2576
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
+
2558
2608
function Build-SQLite ([Hashtable ] $Platform ) {
2559
2609
Build-CMakeProject `
2560
2610
- Src $SourceCache \swift- toolchain- sqlite `
@@ -3184,69 +3234,44 @@ if (-not $SkipBuild) {
3184
3234
Invoke-BuildStep Build-XML2 $HostPlatform
3185
3235
Invoke-BuildStep Build-Compilers $HostPlatform
3186
3236
3237
+ Invoke-BuildStep Build-SDK $BuildPlatform - IncludeMacros
3238
+
3187
3239
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
+
3211
3248
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"
3213
3250
}
3214
3251
}
3215
3252
Install-Platform $WindowsSDKPlatforms Windows
3216
- Invoke-BuildStep Write-PlatformInfoPlist $HostPlatform
3253
+ Write-PlatformInfoPlist Windows
3254
+ Write-SDKSettingsPlist Windows
3217
3255
3218
3256
if ($Android ) {
3219
3257
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
3239
3264
}
3240
- Invoke-BuildStep Write-SDKSettingsPlist $Platform
3265
+ }
3241
3266
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
3244
3270
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 $_
3247
3274
}
3248
- Install-Platform $AndroidSDKPlatforms Android
3249
- Invoke-BuildStep Write-PlatformInfoPlist $Platform
3250
3275
}
3251
3276
3252
3277
# Build Macros for distribution
0 commit comments