@@ -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 ) {
@@ -1572,46 +1577,56 @@ function Build-DocC() {
1572
1577
}
1573
1578
}
1574
1579
1575
- function Build-Installer () {
1580
+ function Build-Installer ($Arch ) {
1576
1581
$Properties = @ {
1577
1582
BundleFlavor = " offline" ;
1578
- DEVTOOLS_ROOT = " $ ( $HostArch .ToolchainInstallRoot ) \" ;
1579
- TOOLCHAIN_ROOT = " $ ( $HostArch .ToolchainInstallRoot ) \" ;
1583
+ DEVTOOLS_ROOT = " $ ( $Arch .ToolchainInstallRoot ) \" ;
1584
+ TOOLCHAIN_ROOT = " $ ( $Arch .ToolchainInstallRoot ) \" ;
1580
1585
INCLUDE_SWIFT_FORMAT = " true" ;
1581
- SWIFT_FORMAT_BUILD = " $ ( $HostArch .BinaryCache ) \swift-format\release" ;
1586
+ SWIFT_FORMAT_BUILD = " $ ( $Arch .BinaryCache ) \swift-format\release" ;
1582
1587
INCLUDE_SWIFT_INSPECT = " true" ;
1583
- SWIFT_INSPECT_BUILD = " $ ( $HostArch .BinaryCache ) \swift-inspect\release" ;
1588
+ SWIFT_INSPECT_BUILD = " $ ( $Arch .BinaryCache ) \swift-inspect\release" ;
1584
1589
INCLUDE_SWIFT_DOCC = " true" ;
1585
- SWIFT_DOCC_BUILD = " $ ( $HostArch .BinaryCache ) \swift-docc\release" ;
1590
+ SWIFT_DOCC_BUILD = " $ ( $Arch .BinaryCache ) \swift-docc\release" ;
1586
1591
SWIFT_DOCC_RENDER_ARTIFACT_ROOT = " ${SourceCache} \swift-docc-render-artifact" ;
1587
1592
}
1588
1593
1589
1594
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"
1592
1597
if (Test-Path $VCRedistInstallerPath ) {
1593
1598
$Properties [" VCRedistInstaller" ] = $VCRedistInstallerPath
1594
1599
$Properties [" VSVersion" ] = $env: VSCMD_VER
1595
1600
}
1596
1601
}
1597
1602
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 ) \"
1602
1607
}
1603
1608
1604
- Build-WiXProject bundle\installer.wixproj - Arch $HostArch - Properties $Properties
1609
+ Build-WiXProject bundle\installer.wixproj - Arch $Arch - Properties $Properties
1610
+ }
1605
1611
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 \"
1614
1621
}
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 ) \"
1615
1630
}
1616
1631
1617
1632
# -------------------------------------------------------------------
@@ -1681,7 +1696,11 @@ if (-not $SkipBuild) {
1681
1696
}
1682
1697
1683
1698
if (-not $SkipPackaging ) {
1684
- Invoke-BuildStep Build-Installer
1699
+ Invoke-BuildStep Build-Installer $HostArch
1700
+ }
1701
+
1702
+ if ($Stage ) {
1703
+ Stage- BuildArtifacts $HostArch
1685
1704
}
1686
1705
1687
1706
if ($Test -contains " swift" ) { Build-Compilers $HostArch - Test }
0 commit comments