@@ -254,8 +254,13 @@ function Copy-File($Src, $Dst) {
254
254
# Create the directory tree first so Copy-Item succeeds
255
255
# If $Dst is the target directory, make sure it ends with "\"
256
256
$DstDir = [IO.Path ]::GetDirectoryName($Dst )
257
- New-Item - ItemType Directory - ErrorAction Ignore $DstDir | Out-Null
258
- Copy-Item - Force $Src $Dst
257
+ if ($ToBatch ) {
258
+ Write-Output " md `" $DstDir `" "
259
+ Write-Output " copy /Y `" $Src `" `" $Dst `" "
260
+ } else {
261
+ New-Item - ItemType Directory - ErrorAction Ignore $DstDir | Out-Null
262
+ Copy-Item - Force $Src $Dst
263
+ }
259
264
}
260
265
261
266
function Copy-Directory ($Src , $Dst ) {
@@ -1558,46 +1563,54 @@ function Build-DocC() {
1558
1563
}
1559
1564
}
1560
1565
1561
- function Build-Installer () {
1566
+ function Build-Installer ($Arch ) {
1562
1567
$Properties = @ {
1563
1568
BundleFlavor = " offline" ;
1564
- DEVTOOLS_ROOT = " $ ( $HostArch .ToolchainInstallRoot ) \" ;
1565
- TOOLCHAIN_ROOT = " $ ( $HostArch .ToolchainInstallRoot ) \" ;
1569
+ DEVTOOLS_ROOT = " $ ( $Arch .ToolchainInstallRoot ) \" ;
1570
+ TOOLCHAIN_ROOT = " $ ( $Arch .ToolchainInstallRoot ) \" ;
1566
1571
INCLUDE_SWIFT_FORMAT = " true" ;
1567
- SWIFT_FORMAT_BUILD = " $ ( $HostArch .BinaryCache ) \swift-format\release" ;
1572
+ SWIFT_FORMAT_BUILD = " $ ( $Arch .BinaryCache ) \swift-format\release" ;
1568
1573
INCLUDE_SWIFT_INSPECT = " true" ;
1569
- SWIFT_INSPECT_BUILD = " $ ( $HostArch .BinaryCache ) \swift-inspect\release" ;
1574
+ SWIFT_INSPECT_BUILD = " $ ( $Arch .BinaryCache ) \swift-inspect\release" ;
1570
1575
INCLUDE_SWIFT_DOCC = " true" ;
1571
- SWIFT_DOCC_BUILD = " $ ( $HostArch .BinaryCache ) \swift-docc\release" ;
1576
+ SWIFT_DOCC_BUILD = " $ ( $Arch .BinaryCache ) \swift-docc\release" ;
1572
1577
SWIFT_DOCC_RENDER_ARTIFACT_ROOT = " ${SourceCache} \swift-docc-render-artifact" ;
1573
1578
}
1574
1579
1575
1580
Isolate- EnvVars {
1576
- Invoke-VsDevShell $HostArch
1577
- $VCRedistInstallerPath = " ${env: VCToolsRedistDir} \vc_redist.$ ( $HostArch .ShortName ) .exe"
1581
+ Invoke-VsDevShell $Arch
1582
+ $VCRedistInstallerPath = " ${env: VCToolsRedistDir} \vc_redist.$ ( $Arch .ShortName ) .exe"
1578
1583
if (Test-Path $VCRedistInstallerPath ) {
1579
1584
$Properties [" VCRedistInstaller" ] = $VCRedistInstallerPath
1580
1585
$Properties [" VSVersion" ] = $env: VSCMD_VER
1581
1586
}
1582
1587
}
1583
1588
1584
- foreach ($Arch in $SDKArchs ) {
1585
- $Properties [" INCLUDE_$ ( $Arch .VSName.ToUpperInvariant ()) _SDK" ] = " true"
1586
- $Properties [" PLATFORM_ROOT_$ ( $Arch .VSName.ToUpperInvariant ()) " ] = " $ ( $Arch .PlatformInstallRoot ) \"
1587
- $Properties [" SDK_ROOT_$ ( $Arch .VSName.ToUpperInvariant ()) " ] = " $ ( $Arch .SDKInstallRoot ) \"
1589
+ foreach ($SDK in $SDKArchs ) {
1590
+ $Properties [" INCLUDE_$ ( $SDK .VSName.ToUpperInvariant ()) _SDK" ] = " true"
1591
+ $Properties [" PLATFORM_ROOT_$ ( $SDK .VSName.ToUpperInvariant ()) " ] = " $ ( $SDK .PlatformInstallRoot ) \"
1592
+ $Properties [" SDK_ROOT_$ ( $SDK .VSName.ToUpperInvariant ()) " ] = " $ ( $SDK .SDKInstallRoot ) \"
1588
1593
}
1589
1594
1590
- Build-WiXProject bundle\installer.wixproj - Arch $HostArch - Properties $Properties
1595
+ Build-WiXProject bundle\installer.wixproj - Arch $Arch - Properties $Properties
1596
+ }
1591
1597
1592
- if ($Stage -and (-not $ToBatch )) {
1593
- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.cab" " $Stage \"
1594
- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.msi" " $Stage \"
1595
- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \*.msm" " $Stage \"
1596
- Copy-File " $ ( $HostArch.BinaryCache ) \installer\Release\$ ( $HostArch.VSName ) \installer.exe" " $Stage \"
1597
- # Extract installer engine to ease code-signing on swift.org CI
1598
- New-Item - Type Directory - Path " $ ( $HostArch.BinaryCache ) \installer\$ ( $HostArch.VSName ) \" - ErrorAction Ignore | Out-Null
1599
- 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 ) \"
1598
+ function Stage-BuildArtifacts ($Arch ) {
1599
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \*.cab" " $Stage \"
1600
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \*.msi" " $Stage \"
1601
+ foreach ($SDK in $SDKArchs ) {
1602
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \sdk.$ ( $SDK.VSName ) .cab" " $Stage \"
1603
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \sdk.$ ( $SDK.VSName ) .msi" " $Stage \"
1604
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $SDK.VSName ) \sdk.$ ( $SDK.VSName ) .msm" " $Stage \"
1600
1605
}
1606
+ Copy-File " $ ( $Arch.BinaryCache ) \installer\Release\$ ( $Arch.VSName ) \installer.exe" " $Stage \"
1607
+ # Extract installer engine to ease code-signing on swift.org CI
1608
+ if ($ToBatch ) {
1609
+ Write-Output " md `" $ ( $Arch.BinaryCache ) \installer\$ ( $Arch.VSName ) \`" "
1610
+ } else {
1611
+ New-Item - Type Directory - Path " $ ( $Arch.BinaryCache ) \installer\$ ( $Arch.VSName ) \" - ErrorAction Ignore | Out-Null
1612
+ }
1613
+ 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 ) \"
1601
1614
}
1602
1615
1603
1616
# -------------------------------------------------------------------
@@ -1667,7 +1680,11 @@ if (-not $SkipBuild) {
1667
1680
}
1668
1681
1669
1682
if (-not $SkipPackaging ) {
1670
- Invoke-BuildStep Build-Installer
1683
+ Invoke-BuildStep Build-Installer $HostArch
1684
+ }
1685
+
1686
+ if ($Stage ) {
1687
+ Stage- BuildArtifacts $HostArch
1671
1688
}
1672
1689
1673
1690
if ($Test -contains " swift" ) { Build-Compilers $HostArch - Test }
0 commit comments