Skip to content
Merged
Show file tree
Hide file tree
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
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
60 changes: 59 additions & 1 deletion tools/ci.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
{
Expand Down
37 changes: 29 additions & 8 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,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 @@ -3206,12 +3212,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.
Expand All @@ -3235,7 +3252,6 @@ function Get-WixPath
WixLightExePath = $wixLightExePath
WixInsigniaExePath = $wixInsigniaExePath
}

}

<#
Expand Down Expand Up @@ -3287,7 +3303,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 @@ -3297,7 +3313,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 @@ -3335,6 +3351,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 @@ -3449,7 +3470,7 @@ function New-ExePackage {

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

Expand Down Expand Up @@ -3571,7 +3592,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 @@ -99,7 +99,7 @@ jobs:
parameters:
architecture: arm64
version: $(version)
msi: no
msi: yes

- template: upload.yml
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down