Skip to content

build.ps1: Update the msbuild installer call #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 12 additions & 49 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -597,22 +597,23 @@ function Build-WiXProject() {

$Properties = $Properties.Clone()
TryAdd-KeyValue $Properties Configuration Release
TryAdd-KeyValue $Properties BaseOutputPath "$($Arch.BinaryCache)\msi\"
TryAdd-KeyValue $Properties BaseOutputPath "$($Arch.BinaryCache)\installer\"
TryAdd-KeyValue $Properties ProductArchitecture $ArchName
TryAdd-KeyValue $Properties ProductVersion $ProductVersionArg

$MSBuildArgs = @("$SourceCache\swift-installer-scripts\platforms\Windows\$FileName")
$MSBuildArgs += "-noLogo"
$MSBuildArgs += "-restore"
$MSBuildArgs += "-maxCpuCount"
foreach ($Property in $Properties.GetEnumerator()) {
if ($Property.Value.Contains(" ")) {
$MSBuildArgs += "-p:$($Property.Key)=$($Property.Value.Replace('\', '\\'))"
} else {
$MSBuildArgs += "-p:$($Property.Key)=$($Property.Value)"
}
}
$MSBuildArgs += "-bl:$($Arch.BinaryCache)\msi\$ArchName-$([System.IO.Path]::GetFileNameWithoutExtension($FileName)).binlog"
$MSBuildArgs += "-ds:False"
$MSBuildArgs += "-binaryLogger:$($Arch.BinaryCache)\msi\$ArchName-$([System.IO.Path]::GetFileNameWithoutExtension($FileName)).binlog"
$MSBuildArgs += "-detailedSummary:False"

Invoke-Program $msbuild @MSBuildArgs
}
Expand Down Expand Up @@ -1405,53 +1406,23 @@ function Build-DocC() {
}

function Build-Installer() {
Build-WiXProject bld\bld.wixproj -Arch $HostArch -Properties @{
DEVTOOLS_ROOT = "$($HostArch.ToolchainInstallRoot)\";
TOOLCHAIN_ROOT = "$($HostArch.ToolchainInstallRoot)\";
}

Build-WiXProject cli\cli.wixproj -Arch $HostArch -Properties @{
Build-WiXProject bundle\installer.wixproj -Arch $HostArch -Properties @{
DEVTOOLS_ROOT = "$($HostArch.ToolchainInstallRoot)\";
TOOLCHAIN_ROOT = "$($HostArch.ToolchainInstallRoot)\";
PLATFORM_ROOT = "$($HostArch.PlatformInstallRoot)\";
# Pending support for building other architectures
SDK_ROOT = "$($HostArch.SDKInstallRoot)\";
INCLUDE_SWIFT_FORMAT = "true";
SWIFT_FORMAT_BUILD = "$($HostArch.BinaryCache)\swift-format\release";
}

Build-WiXProject dbg\dbg.wixproj -Arch $HostArch -Properties @{
DEVTOOLS_ROOT = "$($HostArch.ToolchainInstallRoot)\";
TOOLCHAIN_ROOT = "$($HostArch.ToolchainInstallRoot)\";
INCLUDE_SWIFT_INSPECT = "true";
SWIFT_INSPECT_BUILD = "$($HostArch.BinaryCache)\swift-inspect\release";
}

Build-WiXProject ide\ide.wixproj -Arch $HostArch -Properties @{
DEVTOOLS_ROOT = "$($HostArch.ToolchainInstallRoot)\";
TOOLCHAIN_ROOT = "$($HostArch.ToolchainInstallRoot)\";
}
if (($Stage -ne "") -and (-not $ToBatch)) {
$Stage += "\" # Interpret as target directory

foreach ($Arch in $SDKArchs) {
Build-WiXProject runtimemsi\runtimemsi.wixproj -Arch $Arch -Properties @{
SDK_ROOT = "$($Arch.SDKInstallRoot)\";
}

Build-WiXProject sdk\sdk.wixproj -Arch $Arch -Properties @{
InstallerPlatform = $HostArch.ShortName;
PLATFORM_ROOT = "$($Arch.PlatformInstallRoot)\";
SDK_ROOT = "$($Arch.SDKInstallRoot)\";
SWIFT_SOURCE_DIR = "$SourceCache\swift\";
}
}

foreach ($MSI in ("bld", "cli", "dbg", "ide", "sdk", "runtime")) {
if ($ToBatch) {
Write-Output "Move-Item $($HostArch.BinaryCache)\msi\Release\$($HostArch.VSName)\$MSI.msi $($HostArch.BinaryCache)\msi\";
} else {
Move-Item -Force "$($HostArch.BinaryCache)\msi\Release\$($HostArch.VSName)\$MSI.msi" "$($HostArch.BinaryCache)\msi\";
}
}

Build-WiXProject bundle\installer.wixproj -Arch $HostArch -Bundle -Properties @{
MSI_LOCATION = "$($HostArch.BinaryCache)\msi\";
Copy-File "$($HostArch.BinaryCache)\installer\Release\$($HostArch.VSName)\*.msi" $Stage
Copy-File "$($HostArch.BinaryCache)\installer\Release\$($HostArch.VSName)\installer.exe" $Stage
}
}

Expand All @@ -1462,7 +1433,6 @@ if (-not $SkipBuild) {
Build-Compilers $HostArch
}


foreach ($Arch in $SDKArchs) {
if (-not $SkipBuild) {
Build-ZLib $Arch
Expand Down Expand Up @@ -1526,10 +1496,3 @@ if ($Test -contains "dispatch") { Build-Dispatch $HostArch -Test }
if ($Test -contains "foundation") { Build-Foundation $HostArch -Test }
if ($Test -contains "xctest") { Build-XCTest $HostArch -Test }
if ($Test -contains "llbuild") { Build-LLBuild $HostArch -Test }

if (-not $SkipPackaging -and $Stage -ne "") {
$Stage += "\" # Interpret as target directory

Copy-File "$($HostArch.BinaryCache)\msi\*.msi" $Stage
Copy-File "$($HostArch.BinaryCache)\installer.exe" $Stage
}