@@ -255,8 +255,13 @@ function Copy-File($Src, $Dst) {
255
255
# Create the directory tree first so Copy-Item succeeds
256
256
# If $Dst is the target directory, make sure it ends with "\"
257
257
$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
+ }
260
265
}
261
266
262
267
function Copy-Directory ($Src , $Dst ) {
@@ -1626,46 +1631,56 @@ function Build-DocC() {
1626
1631
}
1627
1632
}
1628
1633
1629
- function Build-Installer () {
1634
+ function Build-Installer ($Arch ) {
1630
1635
$Properties = @ {
1631
1636
BundleFlavor = " offline" ;
1632
- DEVTOOLS_ROOT = " $ ( $HostArch .ToolchainInstallRoot ) \" ;
1633
- TOOLCHAIN_ROOT = " $ ( $HostArch .ToolchainInstallRoot ) \" ;
1637
+ DEVTOOLS_ROOT = " $ ( $Arch .ToolchainInstallRoot ) \" ;
1638
+ TOOLCHAIN_ROOT = " $ ( $Arch .ToolchainInstallRoot ) \" ;
1634
1639
INCLUDE_SWIFT_FORMAT = " true" ;
1635
- SWIFT_FORMAT_BUILD = " $ ( $HostArch .BinaryCache ) \swift-format\release" ;
1640
+ SWIFT_FORMAT_BUILD = " $ ( $Arch .BinaryCache ) \swift-format\release" ;
1636
1641
INCLUDE_SWIFT_INSPECT = " true" ;
1637
- SWIFT_INSPECT_BUILD = " $ ( $HostArch .BinaryCache ) \swift-inspect\release" ;
1642
+ SWIFT_INSPECT_BUILD = " $ ( $Arch .BinaryCache ) \swift-inspect\release" ;
1638
1643
INCLUDE_SWIFT_DOCC = " true" ;
1639
- SWIFT_DOCC_BUILD = " $ ( $HostArch .BinaryCache ) \swift-docc\release" ;
1644
+ SWIFT_DOCC_BUILD = " $ ( $Arch .BinaryCache ) \swift-docc\release" ;
1640
1645
SWIFT_DOCC_RENDER_ARTIFACT_ROOT = " ${SourceCache} \swift-docc-render-artifact" ;
1641
1646
}
1642
1647
1643
1648
Isolate- EnvVars {
1644
- Invoke-VsDevShell $HostArch
1645
- $VCRedistInstallerPath = " ${env: VCToolsRedistDir} \vc_redist.$ ( $HostArch .ShortName ) .exe"
1649
+ Invoke-VsDevShell $Arch
1650
+ $VCRedistInstallerPath = " ${env: VCToolsRedistDir} \vc_redist.$ ( $Arch .ShortName ) .exe"
1646
1651
if (Test-Path $VCRedistInstallerPath ) {
1647
1652
$Properties [" VCRedistInstaller" ] = $VCRedistInstallerPath
1648
1653
$Properties [" VSVersion" ] = $env: VSCMD_VER
1649
1654
}
1650
1655
}
1651
1656
1652
- foreach ($Arch in $SDKArchs ) {
1653
- $Properties [" INCLUDE_$ ( $Arch .VSName.ToUpperInvariant ()) _SDK" ] = " true"
1654
- $Properties [" PLATFORM_ROOT_$ ( $Arch .VSName.ToUpperInvariant ()) " ] = " $ ( $Arch .PlatformInstallRoot ) \"
1655
- $Properties [" SDK_ROOT_$ ( $Arch .VSName.ToUpperInvariant ()) " ] = " $ ( $Arch .SDKInstallRoot ) \"
1657
+ foreach ($SDK in $SDKArchs ) {
1658
+ $Properties [" INCLUDE_$ ( $SDK .VSName.ToUpperInvariant ()) _SDK" ] = " true"
1659
+ $Properties [" PLATFORM_ROOT_$ ( $SDK .VSName.ToUpperInvariant ()) " ] = " $ ( $SDK .PlatformInstallRoot ) \"
1660
+ $Properties [" SDK_ROOT_$ ( $SDK .VSName.ToUpperInvariant ()) " ] = " $ ( $SDK .SDKInstallRoot ) \"
1656
1661
}
1657
1662
1658
- Build-WiXProject bundle\installer.wixproj - Arch $HostArch - Properties $Properties
1663
+ Build-WiXProject bundle\installer.wixproj - Arch $Arch - Properties $Properties
1664
+ }
1659
1665
1660
- if ($Stage -and (-not $ToBatch )) {
1661
- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.cab" " $Stage \"
1662
- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.msi" " $Stage \"
1663
- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.msm" " $Stage \"
1664
- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \installer.exe" " $Stage \"
1665
- # Extract installer engine to ease code-signing on swift.org CI
1666
- New-Item - Type Directory - Path " $ ( $HostArch.BinaryCache ) \installer\$ ( $HostArch.VSName ) \" - ErrorAction Ignore | Out-Null
1667
- 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 ) \"
1666
+ function Stage-BuildArtifacts ($Arch ) {
1667
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \*.cab" " $Stage \"
1668
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \*.msi" " $Stage \"
1669
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \rtl.cab" " $Stage \"
1670
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \rtl.msi" " $Stage \"
1671
+ foreach ($SDK in $SDKArchs ) {
1672
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \sdk.$ ( $SDK.VSName ) .cab" " $Stage \"
1673
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \sdk.$ ( $SDK.VSName ) .msi" " $Stage \"
1674
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \rtl.$ ( $SDK.VSName ) .msm" " $Stage \"
1668
1675
}
1676
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \installer.exe" " $Stage \"
1677
+ # Extract installer engine to ease code-signing on swift.org CI
1678
+ if ($ToBatch ) {
1679
+ Write-Output " md `" $ ( $Arch.BinaryCache ) \installer\$ ( $Arch.VSName ) \`" "
1680
+ } else {
1681
+ New-Item - Type Directory - Path " $ ( $Arch.BinaryCache ) \installer\$ ( $Arch.VSName ) \" - ErrorAction Ignore | Out-Null
1682
+ }
1683
+ 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 ) \"
1669
1684
}
1670
1685
1671
1686
# -------------------------------------------------------------------
@@ -1735,7 +1750,11 @@ if (-not $SkipBuild) {
1735
1750
}
1736
1751
1737
1752
if (-not $SkipPackaging ) {
1738
- Invoke-BuildStep Build-Installer
1753
+ Invoke-BuildStep Build-Installer $HostArch
1754
+ }
1755
+
1756
+ if ($Stage ) {
1757
+ Stage- BuildArtifacts $HostArch
1739
1758
}
1740
1759
1741
1760
if ($Test -contains " swift" ) { Build-Compilers $HostArch - Test }
0 commit comments