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
43 changes: 25 additions & 18 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21
},
"configurePresets": [
{
"name": "base",
Expand All @@ -10,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
},
{
Expand All @@ -26,7 +31,9 @@
"value": "x86",
"strategy": "external"
},
"cacheVariables": { "DIRECTX_ARCH": "x86" },
"cacheVariables": {
"DIRECTX_ARCH": "x86"
},
"hidden": true
},
{
Expand All @@ -35,7 +42,9 @@
"value": "arm64",
"strategy": "external"
},
"cacheVariables": { "DIRECTX_ARCH": "arm64" },
"cacheVariables": {
"DIRECTX_ARCH": "arm64"
},
"hidden": true
},
{
Expand All @@ -44,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": "MSVC",
"hidden": true,
Expand Down Expand Up @@ -116,7 +126,6 @@
"strategy": "external"
}
},

{
"name": "XAudio2Redist",
"cacheVariables": {
Expand Down Expand Up @@ -266,19 +275,16 @@
"strategy": "external"
}
},

{
"name": "Analyze",
"cacheVariables":
{
"cacheVariables": {
"ENABLE_CODE_ANALYSIS": true
},
"hidden": true
},
{
"name": "Coverage",
"cacheVariables":
{
"cacheVariables": {
"ENABLE_CODE_COVERAGE": true
},
"hidden": true
Expand Down Expand Up @@ -395,6 +401,7 @@
{ "name": "x64-Coverage-Clang", "description": "Clang/LLVM for x64 (Debug) w/ Code Coverage", "inherits": [ "base", "x64", "Debug", "Clang", "Coverage" ] },
{ "name": "x64-Fuzzing" , "description": "MSVC for x64 (Release) with ASan", "inherits": [ "base", "x64", "Release", "MSVC", "Fuzzing" ] }
],

"testPresets": [
{ "name": "x64-Debug" , "configurePreset": "x64-Debug" },
{ "name": "x64-Release" , "configurePreset": "x64-Release" },
Expand Down
132 changes: 132 additions & 0 deletions build/promotenuget.ps1
Original file line number Diff line number Diff line change
@@ -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 DirectXTK12 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/DirectXTK12/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/277d2b26-d083-4ea6-b14c-bc4331b6d93b/_apis/packaging/feeds/b92d36b5-9106-4d87-a81b-5cbd23001601/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 = @('directxtk12_desktop_2019', 'directxtk12_desktop_win10', 'directxtk12_uwp')

# 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
}
}
Loading