Generate MSI for win-arm64 installer (#20516) (#23910)

This commit is contained in:
Aditya Patwardhan
2024-06-11 10:02:57 -07:00
committed by GitHub
parent 3b26088def
commit 81ebe1ef59
7 changed files with 110 additions and 16 deletions
+9
View File
@@ -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"?>
+9
View File
@@ -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"?>
+59 -1
View File
@@ -541,9 +541,11 @@ function Invoke-CIFinish
}
'win-arm.*' {
$runPackageTest = $false
$packageTypes = 'zip', 'zip-pdb', 'msix'
$packageTypes = 'msi', 'zip', 'zip-pdb', 'msix'
}
}
Install-WixArmZip
$packages = Start-PSPackage -Type $packageTypes -ReleaseTag $preReleaseVersion -SkipReleaseChecks -WindowsRuntime $Runtime
foreach ($package in $packages) {
@@ -620,6 +622,62 @@ function Invoke-CIFinish
}
}
function Install-WixArmZip
{
# cleanup previous install
if((Test-Path "${env:ProgramFiles(x86)}\Arm Support WiX Toolset xcopy")) {
Remove-Item "${env:ProgramFiles(x86)}\Arm Support WiX Toolset xcopy" -Recurse -Force
}
# This URI is for wix 3.14 which supports generating msi for arm architecures.
$wixUriArmSupport = 'https://aka.ms/ps-wix-3-14-zip'
$zipArmSupport = "$env:TEMP\wixArmSupport.zip"
$targetRoot = "${env:ProgramFiles(x86)}\Arm Support WiX Toolset xcopy"
Invoke-RestMethod -Uri $wixUriArmSupport -OutFile $zipArmSupport
$binPath = Join-Path -Path $targetRoot -ChildPath 'bin'
Write-Verbose "Expanding $zipArmSupport to $binPath ..." -Verbose
Expand-Archive -Path $zipArmSupport -DestinationPath $binPath -Force
$docExpandPath = Join-Path -Path $binPath -ChildPath 'doc'
$sdkExpandPath = Join-Path -Path $binPath -ChildPath 'sdk'
$docTargetPath = Join-Path -Path $targetRoot -ChildPath 'doc'
$sdkTargetPath = Join-Path -Path $targetRoot -ChildPath 'sdk'
Write-Verbose "Fixing folder structure ..." -Verbose
Move-Item -Path $docExpandPath -Destination $docTargetPath
Move-Item -Path $sdkExpandPath -Destination $sdkTargetPath
Set-Path -Append -Path $binPath
Write-Verbose "Done installing WIX for arm!"
}
function Set-Path
{
param
(
[Parameter(Mandatory)]
[string]
$Path,
[Parameter(Mandatory)]
[switch]
$Append
)
$machinePathString = [System.Environment]::GetEnvironmentVariable('path',[System.EnvironmentVariableTarget]::Machine)
$machinePath = $machinePathString -split ';'
if($machinePath -inotcontains $path)
{
$newPath = "$machinePathString;$path"
Write-Verbose "Adding $path to path..." -Verbose
[System.Environment]::SetEnvironmentVariable('path',$newPath,[System.EnvironmentVariableTarget]::Machine)
Write-Verbose "Added $path to path." -Verbose
}
else
{
Write-Verbose "$path already in path." -Verbose
}
}
# Bootstrap script for Linux and macOS
function Invoke-BootstrapStage
{
+29 -8
View File
@@ -486,6 +486,12 @@ function Start-PSPackage {
$TargetArchitecture = "x86"
$r2rArchitecture = "i386"
}
elseif ($Runtime -match "-arm64")
{
$TargetArchitecture = "arm64"
$r2rArchitecture = "arm64"
}
Write-Verbose "TargetArchitecture = $TargetArchitecture" -Verbose
$Arguments = @{
@@ -3279,12 +3285,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
)
Write-Verbose "Ensure Wix Toolset is present on the machine @ $wixToolsetBinPath"
$wixToolsetBinPath = $IsProductArchitectureArm ? "${env:ProgramFiles(x86)}\Arm Support WiX Toolset *\bin" : "${env:ProgramFiles(x86)}\WiX Toolset *\bin"
Write-Verbose -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://aka.ms/ps-wix-3-14-zip"
}
}
## Get the latest if multiple versions exist.
@@ -3308,7 +3325,6 @@ function Get-WixPath
WixLightExePath = $wixLightExePath
WixInsigniaExePath = $wixInsigniaExePath
}
}
<#
@@ -3360,7 +3376,7 @@ function New-MSIPackage
# Architecture to use when creating the MSI
[Parameter(Mandatory = $true)]
[ValidateSet("x86", "x64")]
[ValidateSet("x86", "x64", "arm64")]
[ValidateNotNullOrEmpty()]
[string] $ProductTargetArchitecture,
@@ -3370,7 +3386,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
@@ -3408,6 +3424,11 @@ function New-MSIPackage
$fileArchitecture = 'x86'
$ProductProgFilesDir = "ProgramFilesFolder"
}
elseif ($ProductTargetArchitecture -eq "arm64")
{
$fileArchitecture = 'arm64'
$ProductProgFilesDir = "ProgramFiles64Folder"
}
$wixFragmentPath = Join-Path $env:Temp "Fragment.wxs"
@@ -3522,7 +3543,7 @@ function New-ExePackage {
# Architecture to use when creating the MSI
[Parameter(Mandatory = $true)]
[ValidateSet("x86", "x64")]
[ValidateSet("x86", "x64", "arm64")]
[ValidateNotNullOrEmpty()]
[string] $ProductTargetArchitecture,
@@ -3644,7 +3665,7 @@ function Start-MsiBuild {
$outDir = $env:Temp
$wixPaths = Get-WixPath
$wixPaths = Get-WixPath -IsProductArchitectureArm ($ProductTargetArchitecture -eq "arm64")
$extensionArgs = @()
foreach ($extensionName in $Extension) {
@@ -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
@@ -99,7 +99,7 @@ jobs:
parameters:
architecture: arm64
version: $(version)
msi: no
msi: yes
- template: upload.yml
parameters:
@@ -270,7 +270,7 @@ jobs:
displayName: Upload unsigned packages
retryCountOnTaskFailure: 2
- ${{ if and(ne(variables['BuildConfiguration'],'minSize'), in(variables['Architecture'], 'x64', 'x86')) }}:
- ${{ if and(ne(variables['BuildConfiguration'],'minSize'), in(variables['Architecture'], 'x64', 'x86', 'arm64')) }}:
- template: EsrpSign.yml@ComplianceRepo
parameters:
buildOutputPath: $(System.ArtifactsDirectory)\pkgSigned