Skip to content

Commit 3897b89

Browse files
committed
build.ps1: extract SDKROOT in Build-ExperimentalSDK
Extract a variable for the re-computed value of the SDKROOT.
1 parent 185ff12 commit 3897b89

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

utils/build.ps1

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,16 +3169,18 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
31693169
Invoke-BuildStep Build-ExperimentalRuntime $Platform
31703170
Invoke-BuildStep Build-ExperimentalRuntime $Platform -Static
31713171

3172+
$SDKROOT = Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental"
3173+
31723174
Invoke-IsolatingEnvVars {
31733175
$env:Path = "$(Get-CMarkBinaryCache $Platform)\src;$(Get-PinnedToolchainRuntime);${env:Path}"
31743176

31753177
Build-CMakeProject `
31763178
-Src $SourceCache\swift-corelibs-libdispatch `
31773179
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicDispatch) `
3178-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3180+
-InstallTo "${SDKROOT}\usr" `
31793181
-Platform $Platform `
31803182
-UseBuiltCompilers C,CXX,Swift `
3181-
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3183+
-SwiftSDK "${SDKROOT}" `
31823184
-Defines @{
31833185
BUILD_SHARED_LIBS = "YES";
31843186
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
@@ -3190,10 +3192,10 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
31903192
Build-CMakeProject `
31913193
-Src $SourceCache\swift-corelibs-libdispatch `
31923194
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticDispatch) `
3193-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3195+
-InstallTo "${SDKROOT}\usr" `
31943196
-Platform $Platform `
31953197
-UseBuiltCompilers C,CXX,Swift `
3196-
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3198+
-SwiftSDK "${SDKROOT}" `
31973199
-Defines @{
31983200
BUILD_SHARED_LIBS = "NO";
31993201
CMAKE_Swift_FLAGS = @("-static-stdlib", "-Xfrontend", "-use-static-resource-dir");
@@ -3206,10 +3208,10 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
32063208
Build-CMakeProject `
32073209
-Src $SourceCache\swift-corelibs-foundation `
32083210
-Bin (Get-ProjectBinaryCache $Platform ExperimentalDynamicFoundation) `
3209-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3211+
-InstallTo "${SDKROOT}\usr" `
32103212
-Platform $Platform `
32113213
-UseBuiltCompilers ASM,C,CXX,Swift `
3212-
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3214+
-SwiftSDK "${SDKROOT}" `
32133215
-Defines @{
32143216
BUILD_SHARED_LIBS = "YES";
32153217
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
@@ -3237,10 +3239,10 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
32373239
Build-CMakeProject `
32383240
-Src $SourceCache\swift-corelibs-foundation `
32393241
-Bin (Get-ProjectBinaryCache $Platform ExperimentalStaticFoundation) `
3240-
-InstallTo "$(Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental")\usr" `
3242+
-InstallTo "${SDKROOT}\usr" `
32413243
-Platform $Platform `
32423244
-UseBuiltCompilers ASM,C,CXX,Swift `
3243-
-SwiftSDK (Get-SwiftSDK $Platform.OS -Identifier "$($Platform.OS)Experimental") `
3245+
-SwiftSDK ${SDKROOT} `
32443246
-Defines @{
32453247
BUILD_SHARED_LIBS = "NO";
32463248
CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES";
@@ -3986,14 +3988,16 @@ if (-not $SkipBuild) {
39863988
foreach ($Build in $WindowsSDKBuilds) {
39873989
Invoke-BuildStep Build-ExperimentalSDK $Build
39883990

3991+
$SDKROOT = Get-SwiftSDK Windows -Identifier WindowsExperimental
3992+
39893993
Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object {
39903994
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3991-
Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null
3995+
Move-Item $_.FullName "$SDKROOT\usr\lib\swift\windows\$($Build.Architecture.LLVMName)\" | Out-Null
39923996
}
39933997

39943998
Get-ChildItem "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows" -Filter "*.lib" -File -ErrorAction Ignore | ForEach-Object {
39953999
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
3996-
Move-Item $_.FullName "$(Get-SwiftSDK Windows -Identifier WindowsExperimental)\usr\lib\swift_static\windows\$($Build.Architecture.LLVMName)\" | Out-Null
4000+
Move-Item $_.FullName "$SDKROOT\usr\lib\swift_static\windows\$($Build.Architecture.LLVMName)\" | Out-Null
39974001
}
39984002

39994003
# FIXME(compnerd) how do we select which SDK is meant to be re-distributed?
@@ -4029,14 +4033,16 @@ if (-not $SkipBuild) {
40294033
foreach ($Build in $AndroidSDKBuilds) {
40304034
Invoke-BuildStep Build-ExperimentalSDK $Build
40314035

4036+
$SDKROOT = Get-SwiftSDK Android -Identifier AndroidExperimental
4037+
40324038
Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object {
40334039
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
4034-
Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null
4040+
Move-Item $_.FullName "$SDKROOT\usr\lib\swift\android\$($Build.Architecture.LLVMName)\" | Out-Null
40354041
}
40364042

40374043
Get-ChildItem "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android" -File | Where-Object { $_.Name -match ".a$|.so$" } | ForEach-Object {
40384044
Write-Host -BackgroundColor DarkRed -ForegroundColor White "$($_.FullName) is not nested in an architecture directory"
4039-
Move-Item $_.FullName "$(Get-SwiftSDK Android -Identifier AndroidExperimental)\usr\lib\swift_static\android\$($Build.Architecture.LLVMName)\" | Out-Null
4045+
Move-Item $_.FullName "$SDKROOT\usr\lib\swift_static\android\$($Build.Architecture.LLVMName)\" | Out-Null
40404046
}
40414047
}
40424048

0 commit comments

Comments
 (0)