Skip to content
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

Generate msi for win-arm64 installer #20516

Merged
merged 19 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
9 changes: 9 additions & 0 deletions assets/wix/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
<?else?>
<?define UpgradeCode = $(var.UpgradeCodeRelease)?>
<?endif?>
<?elseif $(sys.BUILDARCH) = "ARM64"?>
<?define ExplorerContextMenuDialogText = "&$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))"?>
<?define UpgradeCodePreview = "f064cf16-97b7-4550-b392-ce0f4a6823a3"?>
<?define UpgradeCodeRelease = "75c68ab2-09d8-46b8-b697-d829bdd4c94f"?>
<?if $(var.IsPreview)=True?>
<?define UpgradeCode = $(var.UpgradeCodePreview)?>
<?else?>
<?define UpgradeCode = $(var.UpgradeCodeRelease)?>
<?endif?>
<?else?>
<?define ExplorerContextMenuDialogText = "&$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))"?>
<?define UpgradeCodePreview = "86abcfbd-1ccc-4a88-b8b2-0facfde29094"?>
Expand Down
9 changes: 9 additions & 0 deletions assets/wix/bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
<?else?>
<?define UpgradeCode = $(var.UpgradeCodeRelease)?>
<?endif?>
<?elseif $(sys.BUILDARCH) = "ARM64"?>
<?define ExplorerContextMenuDialogText = "&$(var.ProductName) $(var.SimpleProductVersion) ($(sys.BUILDARCH))"?>
<?define UpgradeCodePreview = "499e9123-48aa-41df-aa20-6f4d28b54722"?>
<?define UpgradeCodeRelease = "4cc0e36a-17db-4c84-b4f4-560a11e7ddb6"?>
<?if $(var.IsPreview)=True?>
<?define UpgradeCode = $(var.UpgradeCodePreview)?>
<?else?>
<?define UpgradeCode = $(var.UpgradeCodeRelease)?>
<?endif?>
<?else?>
<?define UpgradeCodePreview = "4A699A9C-E904-4024-BCD2-44E098A8C6BD"?>
<?define UpgradeCodeRelease = "ED46CB02-64B3-43FD-A63E-6CF269D8C21C"?>
Expand Down
33 changes: 27 additions & 6 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ function Start-PSPackage {
$TargetArchitecture = "x86"
$r2rArchitecture = "i386"
}
elseif ($Runtime -match "-arm64")
{
$TargetArchitecture = "arm64"
$r2rArchitecture = "arm64"
}

Write-Verbose "TargetArchitecture = $TargetArchitecture" -Verbose

$Arguments = @{
Expand Down Expand Up @@ -3186,12 +3192,23 @@ function Get-NugetSemanticVersion
# Get the paths to various WiX tools
function Get-WixPath
{
$wixToolsetBinPath = "${env:ProgramFiles(x86)}\WiX Toolset *\bin"
[CmdletBinding()]
param (
[bool] $IsProductArchitectureArm = $false
)

$wixToolsetBinPath = $IsProductArchitectureArm ? "${env:ProgramFiles(x86)}\Arm Support WiX Toolset *\bin" : "${env:ProgramFiles(x86)}\WiX Toolset *\bin"

Write-Verbose "Ensure Wix Toolset is present on the machine @ $wixToolsetBinPath"
if (-not (Test-Path $wixToolsetBinPath))
{
throw "The latest version of Wix Toolset 3.11 is required to create MSI package. Please install it from https://github.com/wixtoolset/wix3/releases"
if (!$IsProductArchitectureArm)
{
throw "The latest version of Wix Toolset 3.11 is required to create MSI package. Please install it from https://github.com/wixtoolset/wix3/releases"
}
else {
throw "The latest version of Wix Toolset 3.14 is required to create MSI package for arm. Please install it from https://powershellinfraartifacts.blob.core.windows.net/test/wix314-binaries.zip"
}
}

## Get the latest if multiple versions exist.
Expand All @@ -3215,7 +3232,6 @@ function Get-WixPath
WixLightExePath = $wixLightExePath
WixInsigniaExePath = $wixInsigniaExePath
}

}

<#
Expand Down Expand Up @@ -3267,7 +3283,7 @@ function New-MSIPackage

# Architecture to use when creating the MSI
[Parameter(Mandatory = $true)]
[ValidateSet("x86", "x64")]
[ValidateSet("x86", "x64", "arm64")]
[ValidateNotNullOrEmpty()]
[string] $ProductTargetArchitecture,

Expand All @@ -3277,7 +3293,7 @@ function New-MSIPackage
[string] $CurrentLocation = (Get-Location)
)

$wixPaths = Get-WixPath
$wixPaths = Get-WixPath -IsProductArchitectureArm ($ProductTargetArchitecture -eq "arm64")

$windowsNames = Get-WindowsNames -ProductName $ProductName -ProductNameSuffix $ProductNameSuffix -ProductVersion $ProductVersion
$productSemanticVersionWithName = $windowsNames.ProductSemanticVersionWithName
Expand Down Expand Up @@ -3315,6 +3331,11 @@ function New-MSIPackage
$fileArchitecture = 'x86'
$ProductProgFilesDir = "ProgramFilesFolder"
}
elseif ($ProductTargetArchitecture -eq "arm64")
{
$fileArchitecture = 'arm64'
$ProductProgFilesDir = "ProgramFiles64Folder"
}

$wixFragmentPath = Join-Path $env:Temp "Fragment.wxs"

Expand Down Expand Up @@ -3551,7 +3572,7 @@ function Start-MsiBuild {

$outDir = $env:Temp

$wixPaths = Get-WixPath
$wixPaths = Get-WixPath -IsProductArchitectureArm ($ProductTargetArchitecture -eq "arm64")

$extensionArgs = @()
foreach ($extensionName in $Extension) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,8 @@ try

if (!$Symbols -and $Runtime -notlike 'fxdependent*' -and !$ForMinimalSize)
{
if ($Runtime -notmatch 'arm')
{
Write-Verbose "Starting powershell packaging(msi)..." -Verbose
Start-PSPackage @pspackageParams @releaseTagParam
}
Write-Verbose "Starting powershell packaging(msi)..." -Verbose
Start-PSPackage @pspackageParams @releaseTagParam

$pspackageParams['Type']='msix'
Write-Verbose "Starting powershell packaging(msix)..." -Verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
parameters:
architecture: arm64
version: $(version)
msi: no
msi: yes

- template: upload.yml
parameters:
Expand Down
Loading