@@ -255,8 +255,13 @@ function Copy-File($Src, $Dst) {
255255 # Create the directory tree first so Copy-Item succeeds
256256 # If $Dst is the target directory, make sure it ends with "\"
257257 $DstDir = [IO.Path ]::GetDirectoryName($Dst )
258- New-Item - ItemType Directory - ErrorAction Ignore $DstDir | Out-Null
259- Copy-Item - Force $Src $Dst
258+ if ($ToBatch ) {
259+ Write-Output " md `" $DstDir `" "
260+ Write-Output " copy /Y `" $Src `" `" $Dst `" "
261+ } else {
262+ New-Item - ItemType Directory - ErrorAction Ignore $DstDir | Out-Null
263+ Copy-Item - Force $Src $Dst
264+ }
260265}
261266
262267function Copy-Directory ($Src , $Dst ) {
@@ -1572,46 +1577,56 @@ function Build-DocC() {
15721577 }
15731578}
15741579
1575- function Build-Installer () {
1580+ function Build-Installer ($Arch ) {
15761581 $Properties = @ {
15771582 BundleFlavor = " offline" ;
1578- DEVTOOLS_ROOT = " $ ( $HostArch .ToolchainInstallRoot ) \" ;
1579- TOOLCHAIN_ROOT = " $ ( $HostArch .ToolchainInstallRoot ) \" ;
1583+ DEVTOOLS_ROOT = " $ ( $Arch .ToolchainInstallRoot ) \" ;
1584+ TOOLCHAIN_ROOT = " $ ( $Arch .ToolchainInstallRoot ) \" ;
15801585 INCLUDE_SWIFT_FORMAT = " true" ;
1581- SWIFT_FORMAT_BUILD = " $ ( $HostArch .BinaryCache ) \swift-format\release" ;
1586+ SWIFT_FORMAT_BUILD = " $ ( $Arch .BinaryCache ) \swift-format\release" ;
15821587 INCLUDE_SWIFT_INSPECT = " true" ;
1583- SWIFT_INSPECT_BUILD = " $ ( $HostArch .BinaryCache ) \swift-inspect\release" ;
1588+ SWIFT_INSPECT_BUILD = " $ ( $Arch .BinaryCache ) \swift-inspect\release" ;
15841589 INCLUDE_SWIFT_DOCC = " true" ;
1585- SWIFT_DOCC_BUILD = " $ ( $HostArch .BinaryCache ) \swift-docc\release" ;
1590+ SWIFT_DOCC_BUILD = " $ ( $Arch .BinaryCache ) \swift-docc\release" ;
15861591 SWIFT_DOCC_RENDER_ARTIFACT_ROOT = " ${SourceCache} \swift-docc-render-artifact" ;
15871592 }
15881593
15891594 Isolate- EnvVars {
1590- Invoke-VsDevShell $HostArch
1591- $VCRedistInstallerPath = " ${env: VCToolsRedistDir} \vc_redist.$ ( $HostArch .ShortName ) .exe"
1595+ Invoke-VsDevShell $Arch
1596+ $VCRedistInstallerPath = " ${env: VCToolsRedistDir} \vc_redist.$ ( $Arch .ShortName ) .exe"
15921597 if (Test-Path $VCRedistInstallerPath ) {
15931598 $Properties [" VCRedistInstaller" ] = $VCRedistInstallerPath
15941599 $Properties [" VSVersion" ] = $env: VSCMD_VER
15951600 }
15961601 }
15971602
1598- foreach ($Arch in $SDKArchs ) {
1599- $Properties [" INCLUDE_$ ( $Arch .VSName.ToUpperInvariant ()) _SDK" ] = " true"
1600- $Properties [" PLATFORM_ROOT_$ ( $Arch .VSName.ToUpperInvariant ()) " ] = " $ ( $Arch .PlatformInstallRoot ) \"
1601- $Properties [" SDK_ROOT_$ ( $Arch .VSName.ToUpperInvariant ()) " ] = " $ ( $Arch .SDKInstallRoot ) \"
1603+ foreach ($SDK in $SDKArchs ) {
1604+ $Properties [" INCLUDE_$ ( $SDK .VSName.ToUpperInvariant ()) _SDK" ] = " true"
1605+ $Properties [" PLATFORM_ROOT_$ ( $SDK .VSName.ToUpperInvariant ()) " ] = " $ ( $SDK .PlatformInstallRoot ) \"
1606+ $Properties [" SDK_ROOT_$ ( $SDK .VSName.ToUpperInvariant ()) " ] = " $ ( $SDK .SDKInstallRoot ) \"
16021607 }
16031608
1604- Build-WiXProject bundle\installer.wixproj - Arch $HostArch - Properties $Properties
1609+ Build-WiXProject bundle\installer.wixproj - Arch $Arch - Properties $Properties
1610+ }
16051611
1606- if ($Stage -and (-not $ToBatch )) {
1607- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.cab" " $Stage \"
1608- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.msi" " $Stage \"
1609- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.msm" " $Stage \"
1610- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \installer.exe" " $Stage \"
1611- # Extract installer engine to ease code-signing on swift.org CI
1612- New-Item - Type Directory - Path " $ ( $HostArch.BinaryCache ) \installer\$ ( $HostArch.VSName ) \" - ErrorAction Ignore | Out-Null
1613- 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 ) \"
1612+ function Stage-BuildArtifacts ($Arch ) {
1613+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \*.cab" " $Stage \"
1614+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \*.msi" " $Stage \"
1615+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \rtl.cab" " $Stage \"
1616+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \rtl.msi" " $Stage \"
1617+ foreach ($SDK in $SDKArchs ) {
1618+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \sdk.$ ( $SDK.VSName ) .cab" " $Stage \"
1619+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \sdk.$ ( $SDK.VSName ) .msi" " $Stage \"
1620+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \rtl.$ ( $SDK.VSName ) .msm" " $Stage \"
16141621 }
1622+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \installer.exe" " $Stage \"
1623+ # Extract installer engine to ease code-signing on swift.org CI
1624+ if ($ToBatch ) {
1625+ Write-Output " md `" $ ( $Arch.BinaryCache ) \installer\$ ( $Arch.VSName ) \`" "
1626+ } else {
1627+ New-Item - Type Directory - Path " $ ( $Arch.BinaryCache ) \installer\$ ( $Arch.VSName ) \" - ErrorAction Ignore | Out-Null
1628+ }
1629+ 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 ) \"
16151630}
16161631
16171632# -------------------------------------------------------------------
@@ -1681,7 +1696,11 @@ if (-not $SkipBuild) {
16811696}
16821697
16831698if (-not $SkipPackaging ) {
1684- Invoke-BuildStep Build-Installer
1699+ Invoke-BuildStep Build-Installer $HostArch
1700+ }
1701+
1702+ if ($Stage ) {
1703+ Stage- BuildArtifacts $HostArch
16851704}
16861705
16871706if ($Test -contains " swift" ) { Build-Compilers $HostArch - Test }
0 commit comments