From 02414acfa970b05cf342da8b617afab3690742b0 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Wed, 7 Jan 2026 11:28:38 -0800 Subject: [PATCH 1/3] CmakePresets code review --- CMakePresets.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index f60a4acf..87a0db69 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,5 +1,9 @@ { "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21 + }, "configurePresets": [ { "name": "base", From 389540d23850cbbd0f1c985b687a329aa30cba2d Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Wed, 7 Jan 2026 11:29:30 -0800 Subject: [PATCH 2/3] JSon reformat --- CMakePresets.json | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 87a0db69..8cb8d459 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -14,14 +14,15 @@ "binaryDir": "${sourceDir}/out/build/${presetName}", "installDir": "${sourceDir}/out/install/${presetName}" }, - { "name": "x64", "architecture": { "value": "x64", "strategy": "external" }, - "cacheVariables": { "DIRECTX_ARCH": "x64" }, + "cacheVariables": { + "DIRECTX_ARCH": "x64" + }, "hidden": true }, { @@ -30,7 +31,9 @@ "value": "x86", "strategy": "external" }, - "cacheVariables": { "DIRECTX_ARCH": "x86" }, + "cacheVariables": { + "DIRECTX_ARCH": "x86" + }, "hidden": true }, { @@ -39,7 +42,9 @@ "value": "arm64", "strategy": "external" }, - "cacheVariables": { "DIRECTX_ARCH": "arm64" }, + "cacheVariables": { + "DIRECTX_ARCH": "arm64" + }, "hidden": true }, { @@ -48,29 +53,30 @@ "value": "arm64ec", "strategy": "external" }, - "cacheVariables": { "DIRECTX_ARCH": "arm64ec" }, + "cacheVariables": { + "DIRECTX_ARCH": "arm64ec" + }, "environment": { "CFLAGS": "/arm64EC", "CXXFLAGS": "/arm64EC" }, "hidden": true }, - { "name": "Debug", - "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + }, "hidden": true }, { "name": "Release", - "cacheVariables": - { - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "CMAKE_INTERPROCEDURAL_OPTIMIZATION": true + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_INTERPROCEDURAL_OPTIMIZATION": true }, "hidden": true }, - { "name": "UWP", "cacheVariables": { @@ -101,12 +107,10 @@ { "name": "Tools", "cacheVariables": { - "BUILD_TOOLS" : true + "BUILD_TOOLS": true }, "hidden": true }, - - { "name": "MSVC", "hidden": true, @@ -278,6 +282,7 @@ { "name": "x64-Analyze" , "description": "MSVC for x64 (Debug) using /analyze", "inherits": [ "base", "x64", "Debug", "VCPKG", "MSVC", "Tools" ], "cacheVariables": { "ENABLE_CODE_ANALYSIS": true } } ], + "testPresets": [ { "name": "x64-Debug" , "configurePreset": "x64-Debug" }, { "name": "x64-Release" , "configurePreset": "x64-Release" }, From 2316ac45fefb1b00f07875b225dc70a1e2ba798e Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Wed, 7 Jan 2026 11:50:53 -0800 Subject: [PATCH 3/3] Add helper scripts --- .gitignore | 1 + build/downloadbuild.ps1 | 105 ++++++++++++++++++++++++++++++++ build/promotenuget.ps1 | 132 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 build/downloadbuild.ps1 create mode 100644 build/promotenuget.ps1 diff --git a/.gitignore b/.gitignore index 98947dd4..afa8197f 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ packages /out /CMakeUserPresets.json /build/vcpkg_installed +/build/*.exe diff --git a/build/downloadbuild.ps1 b/build/downloadbuild.ps1 new file mode 100644 index 00000000..335919e9 --- /dev/null +++ b/build/downloadbuild.ps1 @@ -0,0 +1,105 @@ +<# + +.NOTES +Copyright (c) Microsoft Corporation. +Licensed under the MIT License. + +.SYNOPSIS +Downloads build artifacts from Azure DevOps for UVAtlas. + +.DESCRIPTION +This script is used as part of the internal release process for UVAtlas. + +.PARAMETER BuildId +This is the specific build to get artifacts from. + +.PARAMETER PAT +Requires an ADO PAT with 'Build > Read' scope. Can be provided via the ADO_PERSONAL_ACCESS_TOKEN environment variable or as a parameter. + +.LINK +https://github.com/microsoft/UVAtlas/wiki + +#> + +param( + [Parameter(Mandatory)] + [int]$BuildId, + [string]$PAT = "" +) + +# Parse PAT +if ($PAT.Length -eq 0) { + $PAT = $env:ADO_PERSONAL_ACCESS_TOKEN + + if ($PAT.Length -eq 0) { + Write-Error "##[error]This script requires a valid ADO Personal Access Token!" -ErrorAction Stop + } +} + +# Initial REST query +$headers = @{ + "Content-Type" = "application/json" + Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$PAT")) +} + +$uriFormat = "https://dev.azure.com/MSCodeHub/c083e54b-cdc7-4b8b-8bf6-0d874500b610/_apis/build/builds/{0}/artifacts?artifactName={1}&api-version=7.1" + +$uriamd64 = $uriFormat -f $BuildId, "UVAtlas_Binaries_Release_x64" + +try +{ + Write-Host "Checking if build and artifacts exist..." + $responseamd64 = Invoke-RestMethod -Uri $uriamd64 -Method Get -Headers $headers +} +catch +{ + Write-Error "##[error]Build $BuildId not found!" -ErrorAction Continue +} + +$ProgressPreference = 'SilentlyContinue' + +$tempFolderPath = Join-Path $Env:Temp $(New-Guid) +New-Item -Type Directory -Path $tempFolderPath | Out-Null + +Write-Host $tempFolderPath + +$headers = @{ + Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$PAT")) + Accept = "application/zip" +} + +Add-Type -A System.IO.Compression.FileSystem + +# Download artifacts for X64 +foreach ($artifact in $responseamd64) { + $artifactName = $artifact.name + $downloadUrl = $artifact.resource.downloadUrl + $outputFile = Join-Path $tempFolderPath "$artifactName.zip" + + try + { + Write-Host "Downloading $artifactName to $outputFile..." + Invoke-WebRequest -Uri $downloadUrl -Headers $headers -OutFile $outputFile + } + catch + { + Write-Error "##[error]Failed to download $artifactName!" -ErrorAction Continue + } + + try + { + Write-Host "Extracting $artifactName..." + [IO.Compression.ZipFile]::ExtractToDirectory($outputFile, $tempFolderPath) + } + catch + { + Write-Error "##[error]Failed to extract $artifactName!" -ErrorAction Continue + } +} + +# Extract command-line tool binary +$exe = "UVAtlasTool" + +$binPath = Join-Path $tempFolderPath "UVAtlas_Binaries_Release_x64" +$srcPath = "{0}\{1}\Bin\Desktop_2022\x64\Release\{1}.exe" -f $binPath, $exe +Copy-Item -Path $srcPath -Destination "." -ErrorAction Stop diff --git a/build/promotenuget.ps1 b/build/promotenuget.ps1 new file mode 100644 index 00000000..fe8357a4 --- /dev/null +++ b/build/promotenuget.ps1 @@ -0,0 +1,132 @@ +<# + +.NOTES +Copyright (c) Microsoft Corporation. +Licensed under the MIT License. + +.SYNOPSIS +This promotes the NuGet packages on the project-scoped feed. + +.DESCRIPTION +This script promotes the views of the UVAtlas NuGet packages on the project-scoped feed. It always promotes to Prerelease view, and if the Release switch is set, it also promotes to Release view. + +.PARAMETER Version +Indicates which version of the packages to promote. + +.PARAMETER PAT +Requires an ADO PAT with 'Packaging > Read, write, and manage' scope. Can be provided via the ADO_PERSONAL_ACCESS_TOKEN environment variable or as a parameter. + +.PARAMETER Release +By default promotes to prerelease. If this switch is set, promotes to release as well. + +.LINK +https://github.com/microsoft/UVAtlas/wiki + +#> + +param( + [Parameter(Mandatory)] + [string]$Version, + [string]$PAT = "", + [switch]$Release +) + +# Parse PAT +if ($PAT.Length -eq 0) { + $PAT = $env:ADO_PERSONAL_ACCESS_TOKEN + + if ($PAT.Length -eq 0) { + Write-Error "##[error]This script requires a valid ADO Personal Access Token!" -ErrorAction Stop + } +} + +# Project-scoped feed root (package name and version to be filled in later) +$uriFormat = "https://pkgs.dev.azure.com/MSCodeHub/c083e54b-cdc7-4b8b-8bf6-0d874500b610/_apis/packaging/feeds/f34c46a0-2801-4711-aa81-2c6961a441d4/nuget/packages/{0}/versions/{1}?api-version=7.1" + +$headers = @{ + "Content-Type" = "application/json" + Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$PAT")) +} + +$bodyPrerelease = @{ + views = @{ + op = "add" + path = "/views/-" + value = "Prerelease" + } +} | ConvertTo-Json + +$bodyRelease = @{ + views = @{ + op = "add" + path = "/views/-" + value = "Release" + } +} | ConvertTo-Json + +$packages = @('uvatlas_desktop_2019', 'uvatlas_desktop_win10') + +# Check if all packages exist +$allPackagesSucceeded = $true +foreach ($package in $packages) { + $uri = $uriFormat -f $package, $Version + + try + { + Write-Host "Checking if $package version $Version exists..." + Invoke-RestMethod -Uri $uri -Method Get -Headers $headers + } + catch + { + Write-Error "##[error]Package $package version $Version not found!" -ErrorAction Continue + $allPackagesSucceeded = $false + } +} + +if (-not $allPackagesSucceeded) { + Write-Error "##[error]Not all packages found. Aborting promotion." -ErrorAction Stop +} + +# Promote package to Prerelease view +foreach ($package in $packages) { + $uri = $uriFormat -f $package, $Version + + try + { + # Promote to Prerelease view + Write-Host "Promoting $package version $Version to Prerelease view..." + Invoke-RestMethod -Uri $uri -Method Patch -Headers $headers -Body $bodyPrerelease + } + catch + { + Write-Error "##[error]Package $package version $Version failed to promote" -ErrorAction Continue + $allPackagesSucceeded = $false + } +} + +if (-not $allPackagesSucceeded) { + Write-Error "##[error]Not all packages promoted to Prerelease." -ErrorAction Stop +} + +# Optionally promote package to Release view +if ($Release.IsPresent) { + foreach ($package in $packages) { + $uri = $uriFormat -f $package, $Version + + try + { + # Promote to Release view + Write-Host "Promoting $package version $Version to Release view..." + Invoke-RestMethod -Uri $uri -Method Patch -Headers $headers -Body $bodyRelease + } + catch + { + Write-Error "##[error]Package $package version $Version failed to promote" -ErrorAction Continue + $allPackagesSucceeded = $false + } + } + + if (-not $allPackagesSucceeded) { + Write-Error "##[error]Not all packages promoted to Release." -ErrorAction Stop + } +}