Skip to content

Commit 3cd1d6c

Browse files
committed
build: adjust the installer build and artifact staging
Adjust the installer to allow it to be built for foreign architectures. Additionally, adjust the artifact staging to include additional content that was missed previously in order to enable code signing.
1 parent 978a227 commit 3cd1d6c

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

utils/build.ps1

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,46 +1546,52 @@ function Build-DocC() {
15461546
}
15471547
}
15481548

1549-
function Build-Installer() {
1549+
function Build-Installer($Arch) {
15501550
$Properties = @{
15511551
BundleFlavor = "offline";
1552-
DEVTOOLS_ROOT = "$($HostArch.ToolchainInstallRoot)\";
1553-
TOOLCHAIN_ROOT = "$($HostArch.ToolchainInstallRoot)\";
1552+
DEVTOOLS_ROOT = "$($Arch.ToolchainInstallRoot)\";
1553+
TOOLCHAIN_ROOT = "$($Arch.ToolchainInstallRoot)\";
15541554
INCLUDE_SWIFT_FORMAT = "true";
1555-
SWIFT_FORMAT_BUILD = "$($HostArch.BinaryCache)\swift-format\release";
1555+
SWIFT_FORMAT_BUILD = "$($Arch.BinaryCache)\swift-format\release";
15561556
INCLUDE_SWIFT_INSPECT = "true";
1557-
SWIFT_INSPECT_BUILD = "$($HostArch.BinaryCache)\swift-inspect\release";
1557+
SWIFT_INSPECT_BUILD = "$($Arch.BinaryCache)\swift-inspect\release";
15581558
INCLUDE_SWIFT_DOCC = "true";
1559-
SWIFT_DOCC_BUILD = "$($HostArch.BinaryCache)\swift-docc\release";
1559+
SWIFT_DOCC_BUILD = "$($Arch.BinaryCache)\swift-docc\release";
15601560
SWIFT_DOCC_RENDER_ARTIFACT_ROOT = "${SourceCache}\swift-docc-render-artifact";
15611561
}
15621562

15631563
Isolate-EnvVars {
1564-
Invoke-VsDevShell $HostArch
1565-
$VCRedistInstallerPath = "${env:VCToolsRedistDir}\vc_redist.$($HostArch.ShortName).exe"
1564+
Invoke-VsDevShell $Arch
1565+
$VCRedistInstallerPath = "${env:VCToolsRedistDir}\vc_redist.$($Arch.ShortName).exe"
15661566
if (Test-Path $VCRedistInstallerPath) {
15671567
$Properties["VCRedistInstaller"] = $VCRedistInstallerPath
15681568
$Properties["VSVersion"] = $env:VSCMD_VER
15691569
}
15701570
}
15711571

1572-
foreach ($Arch in $SDKArchs) {
1573-
$Properties["INCLUDE_$($Arch.VSName.ToUpperInvariant())_SDK"] = "true"
1574-
$Properties["PLATFORM_ROOT_$($Arch.VSName.ToUpperInvariant())"] = "$($Arch.PlatformInstallRoot)\"
1575-
$Properties["SDK_ROOT_$($Arch.VSName.ToUpperInvariant())"] = "$($Arch.SDKInstallRoot)\"
1572+
foreach ($SDK in $SDKArchs) {
1573+
$Properties["INCLUDE_$($SDK.VSName.ToUpperInvariant())_SDK"] = "true"
1574+
$Properties["PLATFORM_ROOT_$($SDK.VSName.ToUpperInvariant())"] = "$($SDK.PlatformInstallRoot)\"
1575+
$Properties["SDK_ROOT_$($SDK.VSName.ToUpperInvariant())"] = "$($SDK.SDKInstallRoot)\"
15761576
}
15771577

1578-
Build-WiXProject bundle\installer.wixproj -Arch $HostArch -Properties $Properties
1578+
Build-WiXProject bundle\installer.wixproj -Arch $Arch -Properties $Properties
1579+
}
15791580

1580-
if ($Stage -and (-not $ToBatch)) {
1581-
Copy-File "$($HostArch.BinaryCache)\installer\Release\$($HostArch.VSName)\*.cab" "$Stage\"
1582-
Copy-File "$($HostArch.BinaryCache)\installer\Release\$($HostArch.VSName)\*.msi" "$Stage\"
1583-
Copy-File "$($HostArch.BinaryCache)\installer\Release\$($HostArch.VSName)\*.msm" "$Stage\"
1584-
Copy-File "$($HostArch.BinaryCache)\installer\Release\$($HostArch.VSName)\installer.exe" "$Stage\"
1585-
# Extract installer engine to ease code-signing on swift.org CI
1586-
New-Item -Type Directory -Path "$($HostArch.BinaryCache)\installer\$($HostArch.VSName)\" -ErrorAction Ignore | Out-Null
1587-
Invoke-Program "$BinaryCache\wix-4.0.1\tools\net6.0\any\wix.exe" -- burn detach "$($HostArch.BinaryCache)\installer\Release\$($HostArch.VSName)\installer.exe" -engine "$Stage\installer-engine.exe" -intermediateFolder "$($HostArch.BinaryCache)\installer\$($HostArch.VSName)\"
1581+
function Build-ArtifactPresentation($Arch) {
1582+
if ($ToBatch -or -not $Stage) { return }
1583+
1584+
Copy-File "$($Arch.BinaryCache)\installer\Release\$($Arch.VSName)\*.cab" "$Stage\"
1585+
Copy-File "$($Arch.BinaryCache)\installer\Release\$($Arch.VSName)\*.msi" "$Stage\"
1586+
foreach ($SDK in $SDKArchs) {
1587+
Copy-File "$($Arch.BinaryCache)\installer\Release\$($SDK.VSName)\sdk.$($SDK.VSName).cab" "$Stage\"
1588+
Copy-File "$($Arch.BinaryCache)\installer\Release\$($SDK.VSName)\sdk.$($SDK.VSName).msi" "$Stage\"
1589+
Copy-File "$($Arch.BinaryCache)\installer\Release\$($SDK.VSName)\sdk.$($SDK.VSName).msm" "$Stage\"
15881590
}
1591+
Copy-File "$($Arch.BinaryCache)\installer\Release\$($Arch.VSName)\installer.exe" "$Stage\"
1592+
# Extract installer engine to ease code-signing on swift.org CI
1593+
New-Item -Type Directory -Path "$($Arch.BinaryCache)\installer\$($Arch.VSName)\" -ErrorAction Ignore | Out-Null
1594+
Invoke-Program "$BinaryCache\wix-4.0.1\tools\net6.0\any\wix.exe" -- burn detach "$($Arch.BinaryCache)\installer\Release\$($Arch.VSName)\installer.exe" -engine "$Stage\installer-engine.exe" -intermediateFolder "$($Arch.BinaryCache)\installer\$($Arch.VSName)\"
15891595
}
15901596

15911597
#-------------------------------------------------------------------
@@ -1655,9 +1661,11 @@ if (-not $SkipBuild) {
16551661
}
16561662

16571663
if (-not $SkipPackaging) {
1658-
Build-Installer
1664+
Build-Installer $HostArch
16591665
}
16601666

1667+
Build-ArtifactPresentation $HostARch
1668+
16611669
if ($Test -contains "swift") { Build-Compilers $HostArch -Test }
16621670
if ($Test -contains "dispatch") { Build-Dispatch $HostArch -Test }
16631671
if ($Test -contains "foundation") { Build-Foundation $HostArch -Test }

0 commit comments

Comments
 (0)