Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1963,10 +1963,6 @@ function Build-SPMProject {
$Stopwatch = [Diagnostics.Stopwatch]::StartNew()

Invoke-IsolatingEnvVars {
$RuntimeInstallRoot = [IO.Path]::Combine((Get-InstallDir $BuildPlatform), "Runtimes", $ProductVersion)

$env:Path = "$RuntimeInstallRoot\usr\bin;$($BuildPlatform.ToolchainInstallRoot)\usr\bin;${env:Path}"
$env:SDKROOT = (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK)
$env:SWIFTCI_USE_LOCAL_DEPS = "1"

$Arguments = @(
Expand Down Expand Up @@ -1997,6 +1993,18 @@ function Build-SPMProject {
}
}

if ($ActionName -eq "build") {
# For building, we are cross-compiling content using the pinned to ship as part of the toolchain
$env:Path = "$(Get-PinnedToolchainRuntime);$(Get-PinnedToolchainToolsDir);${env:Path}"
$env:SDKROOT = (Get-PinnedToolchainSDK -OS $BuildPlatform.OS)
$Arguments += @("--triple", "$($Platform.Triple)")
} else {
# For testing, we are doing this using the just-built toolchain and only when NOT cross-compiling
$RuntimeInstallRoot = [IO.Path]::Combine((Get-InstallDir $BuildPlatform), "Runtimes", $ProductVersion)
$env:Path = "$RuntimeInstallRoot\usr\bin;$($BuildPlatform.ToolchainInstallRoot)\usr\bin;${env:Path}"
$env:SDKROOT = (Get-SwiftSDK -OS $Platform.OS -Identifier $Platform.DefaultSDK)
}

Invoke-Program swift $ActionName @Arguments @AdditionalArguments
}

Expand Down Expand Up @@ -4322,7 +4330,7 @@ if (-not $SkipBuild -and $IncludeNoAsserts) {
Build-NoAssertsToolchain
}

if (-not $SkipBuild -and -not $IsCrossCompiling) {
if (-not $SkipBuild) {
Invoke-BuildStep Build-DocC $HostPlatform
}

Expand Down