Skip to content

Commit ba82e88

Browse files
authored
Merge pull request #81775 from compnerd/sdk-layout
utils: adjust the "platform" install rules
2 parents 0520206 + 9040fab commit ba82e88

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

utils/build.ps1

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,22 +2637,26 @@ function Write-PlatformInfoPlist([OS] $OS) {
26372637
# Copies files installed by CMake from the arch-specific platform root,
26382638
# where they follow the layout expected by the installer,
26392639
# to the final platform root, following the installer layout.
2640-
function Install-Platform([Hashtable[]] $Platforms, [OS] $OS) {
2640+
function Install-SDK([Hashtable[]] $Platforms, [OS] $OS = $Platforms[0].OS, [string] $Identifier = $OS.ToString()) {
26412641
# Copy SDK header files
26422642
foreach ($Module in ("Block", "dispatch", "os", "_foundation_unicode", "_FoundationCShims")) {
2643-
$ModuleDirectory = "$(Get-SwiftSDK $OS)\usr\lib\swift\$Module"
2644-
if (Test-Path $ModuleDirectory) {
2645-
Move-Directory $ModuleDirectory "$(Get-SwiftSDK $OS)\usr\include\"
2643+
foreach ($ResourceType in ("swift", "swift_static")) {
2644+
$ModuleDirectory = "$(Get-SwiftSDK $OS -Identifier $Identifier)\usr\lib\$ResourceType\$Module"
2645+
if (Test-Path $ModuleDirectory) {
2646+
Move-Directory $ModuleDirectory "$(Get-SwiftSDK $OS -Identifier $Identifier)\usr\include\"
2647+
}
26462648
}
26472649
}
26482650

26492651
# Copy files from the arch subdirectory, including "*.swiftmodule" which need restructuring
26502652
foreach ($Platform in $Platforms) {
2651-
$PlatformResources = "$(Get-SwiftSDK $Platform.OS)\usr\lib\swift\$($Platform.OS.ToString().ToLowerInvariant())"
2652-
Get-ChildItem -Recurse "$PlatformResources\$($Platform.Architecture.LLVMName)" | ForEach-Object {
2653-
if (".swiftmodule", ".swiftdoc", ".swiftinterface" -contains $_.Extension) {
2654-
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not in a thick module layout"
2655-
Copy-File $_.FullName "$PlatformResources\$($_.BaseName).swiftmodule\$(Get-ModuleTriple $Platform)$($_.Extension)"
2653+
foreach ($ResourceType in ("swift", "swift_static")) {
2654+
$PlatformResources = "$(Get-SwiftSDK $OS -Identifier $Identifier)\usr\lib\$ResourceType\$($OS.ToString().ToLowerInvariant())"
2655+
Get-ChildItem -Recurse "$PlatformResources\$($Platform.Architecture.LLVMName)" | ForEach-Object {
2656+
if (".swiftmodule", ".swiftdoc", ".swiftinterface" -contains $_.Extension) {
2657+
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not in a thick module layout"
2658+
Copy-File $_.FullName "$PlatformResources\$($_.BaseName).swiftmodule\$(Get-ModuleTriple $Platform)$($_.Extension)"
2659+
}
26562660
}
26572661
}
26582662
}
@@ -3334,9 +3338,10 @@ if (-not $SkipBuild) {
33343338
Copy-Directory "$(Get-SwiftSDK Windows)\usr\bin" "$([IO.Path]::Combine((Get-InstallDir $Platform), "Runtimes", $ProductVersion, "usr"))"
33353339
}
33363340

3337-
Install-Platform $WindowsSDKPlatforms Windows
33383341
Write-PlatformInfoPlist Windows
3342+
Install-SDK $WindowsSDKPlatforms
33393343
Write-SDKSettings Windows
3344+
Install-SDK $WindowsSDKPlatforms -Identifier WindowsExperimental
33403345
Write-SDKSettings Windows -Identifier WindowsExperimental
33413346

33423347
if ($Android) {
@@ -3350,9 +3355,10 @@ if (-not $SkipBuild) {
33503355
}
33513356
}
33523357

3353-
Install-Platform $AndroidSDKPlatforms Android
33543358
Write-PlatformInfoPlist Android
3359+
Install-SDK $AndroidSDKPlatforms
33553360
Write-SDKSettings Android
3361+
Install-SDK $AndroidSDKPlatforms -Identifiers AndroidExperimental
33563362
Write-SDKSettings Android -Identifier AndroidExperimental
33573363

33583364
# Android swift-inspect only supports 64-bit platforms.

0 commit comments

Comments
 (0)