GHA and ADO pipeline updates (#623)

This commit is contained in:
Chuck Walbourn 2025-07-22 16:22:37 -07:00 committed by GitHub
parent 32b2a8ef35
commit 9a84cfdc5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 585 additions and 310 deletions

View File

@ -32,7 +32,6 @@ resources:
- repository: self
type: git
ref: refs/heads/main
trigger: none
- repository: testRepo
name: walbourn/directxtextest
type: github
@ -51,12 +50,14 @@ variables:
value: '10.0.19041.0'
- name: EXTRACTED_FOLDER
value: '$(ExtractedFolder)'
- name: GDK_EDITION
value: $(GDKEditionNumber)
- name: URL_FEED
value: $(ADOFeedURL)
- name: VC_PATH
value: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC'
- name: GameDKLatest
value: '$(ExtractedFolder)\Microsoft.gdk.xbox.$(GDK_EDITION)\native\$(GDK_EDITION)\'
value: '$(ExtractedFolder)\Microsoft.gdk.xbox\native\$(GDK_EDITION)\'
- name: skipNugetSecurityAnalysis
value: true # We explicitly call this task so we don't need it to be auto-injected
@ -97,16 +98,13 @@ jobs:
displayName: 'Secure Supply Chain Analysis'
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: NuGetCommand@2
displayName: NuGet install PGDK
- task: PowerShell@2
displayName: 'NuGet Install GDK'
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: CMake@1
displayName: 'CMake (MSVC): Config x64 (Xbox Series X|S)'
inputs:
@ -251,16 +249,13 @@ jobs:
displayName: 'Secure Supply Chain Analysis'
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: NuGetCommand@2
displayName: NuGet install PGDK
- task: PowerShell@2
displayName: 'NuGet Install GDK'
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: CmdLine@2
displayName: Setup BWOI for GDK command-line
inputs:
@ -345,16 +340,13 @@ jobs:
displayName: 'Secure Supply Chain Analysis'
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: NuGetCommand@2
displayName: NuGet install PGDK
- task: PowerShell@2
displayName: 'NuGet Install GDK'
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: CmdLine@2
displayName: Setup BWOI for GDK command-line
inputs:

View File

@ -58,20 +58,22 @@ variables:
- name: Codeql.Enabled
value: false
- name: VS_GENERATOR
value: 'Visual Studio 16 2019'
value: 'Visual Studio 17 2022'
- name: WIN10_SDK
value: '10.0.19041.0'
- name: EXTRACTED_FOLDER
value: '$(ExtractedFolder)'
- name: GDK_EDITION
value: $(GDKEditionNumber)
- name: URL_FEED
value: $(ADOFeedURL)
- name: GameDKLatest
value: '$(ExtractedFolder)\Microsoft.gdk.xbox.$(GDK_EDITION)\native\$(GDK_EDITION)\'
value: '$(ExtractedFolder)\Microsoft.gdk.xbox\native\$(GDK_EDITION)\'
- name: skipNugetSecurityAnalysis
value: true # We explicitly call this task so we don't need it to be auto-injected
pool:
vmImage: windows-2019
vmImage: windows-2022
jobs:
- job: CMAKE_BUILD
@ -107,22 +109,19 @@ jobs:
displayName: 'Secure Supply Chain Analysis'
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: NuGetCommand@2
displayName: NuGet install PGDK
- task: PowerShell@2
displayName: 'NuGet Install GDK'
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: CMake@1
displayName: 'CMake (MSVC): Config x64 (Xbox Series X|S)'
inputs:
cwd: ''
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_XBOX_EXTS_SCARLETT=ON -DBUILD_SAMPLE=OFF
- task: CMake@1
@ -135,66 +134,30 @@ jobs:
inputs:
cwd: ''
cmakeArgs: --build out -v --config RelWithDebInfo
- task: CMake@1
displayName: 'CMake (ClangCl): Config x64 (Xbox Series X|S)'
inputs:
cwd: ''
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -T clangcl -B out2
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_XBOX_EXTS_SCARLETT=ON -DBUILD_SAMPLE=OFF
- task: CMake@1
displayName: 'CMake (ClangCl): Build x64 Debug (Xbox Series X|S)'
inputs:
cwd: ''
cmakeArgs: --build out2 -v --config Debug
- task: CMake@1
displayName: 'CMake (ClangCl): Build x64 Release (Xbox Series X|S)'
inputs:
cwd: ''
cmakeArgs: --build out2 -v --config RelWithDebInfo
- task: CMake@1
displayName: 'CMake (MSVC): Config x64 (Xbox One)'
inputs:
cwd: ''
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out3
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out2
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_XBOX_EXTS_XBOXONE=ON -DBUILD_SAMPLE=OFF
- task: CMake@1
displayName: 'CMake (MSVC): Build x64 Debug (Xbox One)'
inputs:
cwd: ''
cmakeArgs: --build out3 -v --config Debug
cmakeArgs: --build out2 -v --config Debug
- task: CMake@1
displayName: 'CMake (MSVC): Build x64 Release (Xbox One)'
inputs:
cwd: ''
cmakeArgs: --build out3 -v --config RelWithDebInfo
- task: CMake@1
displayName: 'CMake (ClangCl): Config x64 (Xbox One)'
inputs:
cwd: ''
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -T clangcl -B out4
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_XBOX_EXTS_XBOXONE=ON -DBUILD_SAMPLE=OFF
- task: CMake@1
displayName: 'CMake (ClangCl): Build x64 Debug (Xbox One)'
inputs:
cwd: ''
cmakeArgs: --build out4 -v --config Debug
- task: CMake@1
displayName: 'CMake (ClangCl): Build x64 Release (Xbox One)'
inputs:
cwd: ''
cmakeArgs: --build out4 -v --config RelWithDebInfo
cmakeArgs: --build out2 -v --config RelWithDebInfo
- task: CMake@1
displayName: 'CMake (DLL): Config x64 (Xbox Series X|S)'
inputs:
cwd: ''
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out5
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out3
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_XBOX_EXTS_SCARLETT=ON -DBUILD_SAMPLE=OFF
-DBUILD_SHARED_LIBS=ON
@ -202,18 +165,18 @@ jobs:
displayName: 'CMake (DLL): Build x64 Debug (Xbox Series X|S)'
inputs:
cwd: ''
cmakeArgs: --build out5 -v --config Debug
cmakeArgs: --build out3 -v --config Debug
- task: CMake@1
displayName: 'CMake (DLL): Build x64 Release (Xbox Series X|S)'
inputs:
cwd: ''
cmakeArgs: --build out5 -v --config RelWithDebInfo
cmakeArgs: --build out3 -v --config RelWithDebInfo
- task: CMake@1
displayName: 'CMake (DLL): Config x64 (Xbox One)'
inputs:
cwd: ''
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out6
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out4
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_XBOX_EXTS_XBOXONE=ON -DBUILD_SAMPLE=OFF
-DBUILD_SHARED_LIBS=ON
@ -221,9 +184,9 @@ jobs:
displayName: 'CMake (DLL): Build x64 Debug (Xbox One)'
inputs:
cwd: ''
cmakeArgs: --build out6 -v --config Debug
cmakeArgs: --build out4 -v --config Debug
- task: CMake@1
displayName: 'CMake (DLL): Build x64 Release (Xbox One)'
inputs:
cwd: ''
cmakeArgs: --build out6 -v --config RelWithDebInfo
cmakeArgs: --build out4 -v --config RelWithDebInfo

View File

@ -69,14 +69,14 @@ variables:
- name: VCPKG_MANIFEST_DIR
value: '$(Build.SourcesDirectory)/build'
- name: VS_GENERATOR
value: 'Visual Studio 16 2019'
value: 'Visual Studio 17 2022'
- name: WIN10_SDK
value: '10.0.19041.0'
- name: WIN11_SDK
value: '10.0.22000.0'
pool:
vmImage: windows-2019
vmImage: windows-2022
jobs:
- job: CMAKE_BUILD
@ -90,7 +90,7 @@ jobs:
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_DX12=OFF
- task: CMake@1
@ -108,7 +108,7 @@ jobs:
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A Win32 -B out2
-G "$(VS_GENERATOR)" -T v142 -A Win32 -B out2
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_DX12=OFF
- task: CMake@1
@ -126,82 +126,32 @@ jobs:
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out3
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out3
-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=10.0
- task: CMake@1
displayName: 'CMake (UWP): Build x64'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out3 -v
- task: CMake@1
displayName: 'CMake (ClangCl): Config x64'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -T clangcl -B out4
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
- task: CMake@1
displayName: 'CMake (ClangCl): Build x64 Debug'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out4 -v --config Debug
- task: CMake@1
displayName: 'CMake (ClangCl): Build x64 Release'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out4 -v --config RelWithDebInfo
- task: CMake@1
displayName: 'CMake (Win10): Config'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out5
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out4
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_DX12=ON
- task: CMake@1
displayName: 'CMake (Win10): Build'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out5 -v --config Debug
- task: CMake@1
displayName: 'CMake (MSVC Spectre): Config x64'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out6
-DENABLE_SPECTRE_MITIGATION=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_DX12=OFF
- task: CMake@1
displayName: 'CMake (MSVC Spectre): Build x64 Debug'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out6 -v --config Debug
- task: CMake@1
displayName: 'CMake (MSVC Spectre): Build x64 Release'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out6 -v --config RelWithDebInfo
- task: CMake@1
displayName: 'CMake (Win10 Spectre): Config'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out7
-DENABLE_SPECTRE_MITIGATION=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
-DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_DX12=ON
- task: CMake@1
displayName: 'CMake (Win10 Spectre): Build'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out7 -v --config Debug
cmakeArgs: --build out4 -v --config Debug
- task: CMake@1
displayName: 'CMake (NO_WCHAR_T): Config'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out8
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out5
-DNO_WCHAR_T=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
-DCMAKE_SYSTEM_VERSION=$(WIN11_SDK)
-DBUILD_DX12=ON
@ -209,13 +159,13 @@ jobs:
displayName: 'CMake (NO_WCHAR_T): Build'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out8 -v --config Debug
cmakeArgs: --build out5 -v --config Debug
- task: CMake@1
displayName: 'CMake (DLL): Config x64'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out9
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out6
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DBUILD_DX12=ON
-DBUILD_SHARED_LIBS=ON
@ -223,25 +173,25 @@ jobs:
displayName: 'CMake (DLL): Build x64 Debug'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out9 -v --config Debug
cmakeArgs: --build out6 -v --config Debug
- task: CMake@1
displayName: 'CMake (DLL): Build x64 Release'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out9 -v --config RelWithDebInfo
cmakeArgs: --build out6 -v --config RelWithDebInfo
- task: CMake@1
displayName: 'CMake (UWP DLL): Config x64'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out10
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out7
-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_SYSTEM_VERSION=10.0
-DBUILD_SHARED_LIBS=ON
- task: CMake@1
displayName: 'CMake (UWP DLL): Build x64'
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: --build out10 -v
cmakeArgs: --build out7 -v
- job: CMAKE_BUILD_VCPKG
displayName: CMake using VCPKG
@ -272,7 +222,7 @@ jobs:
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)"
-DVCPKG_MANIFEST_DIR="$(VCPKG_MANIFEST_DIR)" -DVCPKG_TARGET_TRIPLET=x64-windows
- task: CMake@1
@ -285,7 +235,7 @@ jobs:
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out2 -DENABLE_OPENEXR_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out2 -DENABLE_OPENEXR_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)"
-DVCPKG_MANIFEST_DIR="$(VCPKG_MANIFEST_DIR)" -DVCPKG_TARGET_TRIPLET=x64-windows
- task: CMake@1
@ -298,7 +248,7 @@ jobs:
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out3 -DENABLE_LIBJPEG_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out3 -DENABLE_LIBJPEG_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)"
-DVCPKG_MANIFEST_DIR="$(VCPKG_MANIFEST_DIR)" -DVCPKG_TARGET_TRIPLET=x64-windows
- task: CMake@1
@ -311,7 +261,7 @@ jobs:
inputs:
cwd: $(Build.SourcesDirectory)
cmakeArgs: >
-G "$(VS_GENERATOR)" -A x64 -B out4 -DENABLE_LIBPNG_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-G "$(VS_GENERATOR)" -T v142 -A x64 -B out4 -DENABLE_LIBPNG_SUPPORT=ON -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_VERSION=$(WIN10_SDK)
-DCMAKE_TOOLCHAIN_FILE="$(VCPKG_CMAKE_DIR)"
-DVCPKG_MANIFEST_DIR="$(VCPKG_MANIFEST_DIR)" -DVCPKG_TARGET_TRIPLET=x64-windows
- task: CMake@1

View File

@ -34,7 +34,6 @@ resources:
- repository: self
type: git
ref: refs/heads/main
trigger: none
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
@ -47,6 +46,8 @@ variables:
value: false
- name: EXTRACTED_FOLDER
value: '$(ExtractedFolder)'
- name: GDK_EDITION
value: $(GDKEditionNumber)
- name: GDKEnableBWOI
value: true
- name: URL_FEED
@ -92,16 +93,13 @@ jobs:
displayName: 'Secure Supply Chain Analysis'
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: NuGetCommand@2
displayName: NuGet install PGDK
- task: PowerShell@2
displayName: 'NuGet Install GDK'
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: CopyFiles@2
displayName: Set up Directory.Build.props
inputs:
@ -112,7 +110,6 @@ jobs:
displayName: Setup BWOI VCTargets
inputs:
solution: build/SetupBWOI.targets
msbuildVersion: 17.0
msbuildArchitecture: x64
msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION)
- template: '/.azuredevops/templates/DirectXTex-build-gdk.yml'
@ -155,16 +152,13 @@ jobs:
displayName: 'Secure Supply Chain Analysis'
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: NuGetCommand@2
displayName: NuGet install PGDK
- task: PowerShell@2
displayName: 'NuGet Install GDK'
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: CmdLine@2
displayName: Setup BWOI for GDK command-line
inputs:
@ -274,16 +268,13 @@ jobs:
displayName: 'Secure Supply Chain Analysis'
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: NuGetCommand@2
displayName: NuGet install PGDK
- task: PowerShell@2
displayName: 'NuGet Install GDK'
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: CmdLine@2
displayName: Setup BWOI for GDK command-line
inputs:

View File

@ -58,7 +58,7 @@ resources:
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
pool:
vmImage: windows-2019
vmImage: windows-2022
variables:
- group: dxtex-shared-variables
@ -66,6 +66,8 @@ variables:
value: false
- name: EXTRACTED_FOLDER
value: '$(ExtractedFolder)'
- name: GDK_EDITION
value: $(GDKEditionNumber)
- name: GDKEnableBWOI
value: true
- name: URL_FEED
@ -109,16 +111,13 @@ jobs:
displayName: 'Secure Supply Chain Analysis'
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: NuGetCommand@2
displayName: NuGet install PGDK
- task: PowerShell@2
displayName: 'NuGet Install GDK'
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: CopyFiles@2
displayName: Set up Directory.Build.props
inputs:
@ -129,10 +128,9 @@ jobs:
displayName: Setup BWOI VCTargets
inputs:
solution: build/SetupBWOI.targets
msbuildVersion: 16.0
msbuildArchitecture: x64
msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION)
- template: '/.azuredevops/templates/DirectXTex-build-gdk.yml'
parameters:
msVersion: '16.0'
msVersion: '17.0'
vsYear: 2019

View File

@ -39,9 +39,13 @@ pool:
vmImage: windows-2022
variables:
Codeql.Enabled: false
VC_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC'
GUID_FEED: $(ADOFeedGUID)
- group: dxtex-shared-variables
- name: Codeql.Enabled
value: false
- name: VC_PATH
value: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC'
- name: GUID_FEED
value: $(ADOFeedGUID)
jobs:
- job: DESKTOP_BUILD
@ -93,7 +97,6 @@ jobs:
displayName: Build solution DirectXTex_Tests_Desktop_2022.sln
inputs:
solution: Tests/DirectXTex_Tests_Desktop_2022.sln
vsVersion: 17.0
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
@ -103,7 +106,6 @@ jobs:
displayName: Build solution DirectXTex_Tests_Desktop_2022_Win10.sln
inputs:
solution: Tests/DirectXTex_Tests_Desktop_2022_Win10.sln
vsVersion: 17.0
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'

View File

@ -36,14 +36,12 @@ resources:
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
pool:
vmImage: windows-2019
vmImage: windows-2022
variables:
- group: dxtex-shared-variables
- name: Codeql.Enabled
value: false
- name: VC_PATH
value: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC'
- name: GUID_FEED
value: $(ADOFeedGUID)
@ -91,7 +89,6 @@ jobs:
displayName: Build solution DirectXTex_Tests_Desktop_2019.sln
inputs:
solution: Tests/DirectXTex_Tests_Desktop_2019.sln
vsVersion: 16.0
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
@ -99,89 +96,6 @@ jobs:
displayName: Build solution DirectXTex_Tests_Desktop_2019_Win10.sln
inputs:
solution: Tests/DirectXTex_Tests_Desktop_2019_Win10.sln
vsVersion: 16.0
msbuildArgs: /p:PreferredToolArchitecture=x64
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- job: CMAKE_BUILD_X64
displayName: 'CMake for X64 BUILD_TESTING=ON'
timeoutInMinutes: 120
workspace:
clean: all
steps:
- checkout: self
clean: true
fetchTags: false
fetchDepth: 1
path: 's'
- checkout: testRepo
displayName: Fetch Tests
clean: true
fetchTags: false
fetchDepth: 1
path: 's/Tests'
- task: CmdLine@2
displayName: Setup environment for CMake to use VS
inputs:
script: |
call "$(VC_PATH)\Auxiliary\Build\vcvars64.bat"
echo ##vso[task.setvariable variable=WindowsSdkVerBinPath;]%WindowsSdkVerBinPath%
echo ##vso[task.prependpath]%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin
echo ##vso[task.prependpath]%WindowsSdkBinPath%x64
echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64
echo ##vso[task.prependpath]%VCToolsInstallDir%bin\Hostx64\x64
echo ##vso[task.setvariable variable=EXTERNAL_INCLUDE;]%EXTERNAL_INCLUDE%
echo ##vso[task.setvariable variable=INCLUDE;]%INCLUDE%
echo ##vso[task.setvariable variable=LIB;]%LIB%
- task: CMake@1
displayName: CMake (MSVC; x64-Debug) Config
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Debug
- task: CMake@1
displayName: CMake (MSVC; x64-Debug) Build
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Debug -v
- task: DeleteFiles@1
inputs:
Contents: 'out'
- task: CMake@1
displayName: CMake (MSVC; x64-Release) Config
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Release
- task: CMake@1
displayName: CMake (MSVC; x64-Release) Build
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Release -v
- task: DeleteFiles@1
inputs:
Contents: 'out'
- task: CMake@1
displayName: CMake (clang/LLVM; x64-Debug) Config
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Debug-Clang
- task: CMake@1
displayName: CMake (clang/LLVM; x64-Debug) Build
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Debug-Clang -v
- task: DeleteFiles@1
inputs:
Contents: 'out'
- task: CMake@1
displayName: CMake (clang/LLVM; x64-Release) Config
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Release-Clang
- task: CMake@1
displayName: CMake (clang/LLVM; x64-Release) Build
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out/build/x64-Release-Clang -v

View File

@ -35,7 +35,7 @@ variables:
Codeql.Enabled: false
pool:
vmImage: windows-2019
vmImage: windows-2022
jobs:
- job: DESKTOP_BUILD
@ -61,22 +61,7 @@ jobs:
BuildPlatform: x86
BuildConfiguration: Debug
SpectreMitigation: false
Release_x64_SpectreMitigated:
BuildPlatform: x64
BuildConfiguration: Release
SpectreMitigation: 'Spectre'
Debug_x64_SpectreMitigated:
BuildPlatform: x64
BuildConfiguration: Debug
SpectreMitigation: 'Spectre'
Release_x86_SpectreMitigated:
BuildPlatform: x86
BuildConfiguration: Release
SpectreMitigation: 'Spectre'
Debug_x86_SpectreMitigated:
BuildPlatform: x86
BuildConfiguration: Debug
SpectreMitigation: 'Spectre'
# windows-2022 image is missing v142 spectre-mitigated libraries
steps:
- checkout: self
clean: true

107
.github/copilot-instructions.md vendored Normal file
View File

@ -0,0 +1,107 @@
# GitHub Copilot Instructions
These instructions define how GitHub Copilot should assist with this project. The goal is to ensure consistent, high-quality code generation aligned with our conventions, stack, and best practices.
## Context
- **Project Type**: Graphics Library / DirectX / Direct3D 11 / Direct3D 12 / Image Processing
- **Project Name**: DirectXTex Texture Processing Library
- **Language**: C++
- **Framework / Libraries**: STL / CMake / CTest
- **Architecture**: Modular / RAII / OOP
## Getting Started
- See the tutorial at [Getting Started](https://github.com/microsoft/DirectXTex/wiki/Getting-Started).
- The recommended way to integrate *DirectXTex* into your project is by using the *vcpkg* Package Manager.
- You can make use of the nuget.org packages **directxtex_desktop_2019**, **directxtex_desktop_win10**, or **directxtex_uwp**.
- You can also use the library source code directly in your project or as a git submodule.
## General Guidelines
- **Code Style**: The project uses an .editorconfig file to enforce coding standards. Follow the rules defined in `.editorconfig` for indentation, line endings, and other formatting. Additional information can be found on the wiki at [Implementation](https://github.com/microsoft/DirectXTK/wiki/Implementation). The code requires C++11/C++14 features.
- **Documentation**: The project provides documentation in the form of wiki pages available at [Documentation](https://github.com/microsoft/DirectXTex/wiki/).
- **Error Handling**: Use C++ exceptions for error handling and uses RAII smart pointers to ensure resources are properly managed. For some functions that return HRESULT error codes, they are marked `noexcept`, use `std::nothrow` for memory allocation, and should not throw exceptions.
- **Testing**: Unit tests for this project are implemented in this repository [Test Suite](https://github.com/walbourn/directxtextest/) and can be run using CTest per the instructions at [Test Documentation](https://github.com/walbourn/directxtextest/wiki).
- **Security**: This project uses secure coding practices from the Microsoft Secure Coding Guidelines, and is subject to the `SECURITY.md` file in the root of the repository. Functions that read input from geometry files are subject to OneFuzz testing to ensure they are secure against malformed files.
- **Dependencies**: The project uses CMake and VCPKG for managing dependencies, making optional use of DirectXMath and DirectX-Headers. The project can be built without these dependencies, relying on the Windows SDK for core functionality.
- **Continuous Integration**: This project implements GitHub Actions for continuous integration, ensuring that all code changes are tested and validated before merging. This includes building the project for a number of configurations and toolsets, running a subset of unit tests, and static code analysis including GitHub super-linter, CodeQL, and MSVC Code Analysis.
- **Code of Conduct**: The project adheres to the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). All contributors are expected to follow this code of conduct in all interactions related to the project.
## File Structure
```txt
.azuredevops/ # Azure DevOps pipeline configuration and policy files.
.github/ # GitHub Actions workflow files and linter configuration files.
.nuget/ # NuGet package configuration files.
build/ # Miscellaneous build files and scripts.
Auxiliary/ # Auxiliary functions such as Xbox tiling extensions, OpenEXR support, etc.
DirectXTex/ # DirectXTex implementation files.
Shaders/ # HLSL shader files.
DDSView/ # Sample application for viewing DDS texture files using DirectXTex.
texassemble/ # CLI tool for creating complex DDS files from multiple image files.
texconv/ # CLI tool for converting image files to DDS texture files including block compression, mipmaps, and resizing.
texdiag/ # CLI tool for diagnosing and validating DDS texture files.
DDSTextureLoader/ # Standalone version of the DDS texture loader for Direct3D 9/11/12.
ScreenGrab/ # Standalone version of the screenshot capture utility for Direct3D 9/11/12.
WICTextureLoader/ # Standalone versoin of the WIC texture loader for Direct3D 9/11/12.
Tests/ # Tests are designed to be cloned from a separate repository at this location.
```
> Note that DDSTextureLoader, ScreenGrab, and WICTextureLoader are standalone version of utilities which are also included in the *DirectX Tool Kit for DirectX 11* and *DirectX Tool Kit for DirectX 12*.
## Patterns
### Patterns to Follow
- Use RAII for all resource ownership (memory, file handles, etc.).
- Many classes utilize the pImpl idiom to hide implementation details, and to enable optimized memory alignment in the implementation.
- Use `std::unique_ptr` for exclusive ownership and `std::shared_ptr` for shared ownership.
- Use `Microsoft::WRL::ComPtr` for COM object management.
- Make use of anonymous namespaces to limit scope of functions and variables.
- Make use of `assert` for debugging checks, but be sure to validate input parameters in release builds.
### Patterns to Avoid
- Dont use raw pointers for ownership.
- Avoid macros for constants—prefer `constexpr` or `inline` `const`.
- Dont put implementation logic in header files unless using templates, although the SimpleMath library does use an .inl file for performance.
- Avoid using `using namespace` in header files to prevent polluting the global namespace.
## References
- [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines)
- [Microsoft Secure Coding Guidelines](https://learn.microsoft.com/en-us/security/develop/secure-coding-guidelines)
- [CMake Documentation](https://cmake.org/documentation/)
- [VCPK Documentation](https://learn.microsoft.com/vcpkg/)
- [DirectXTex Wiki](https://github.com/microsoft/DirectXTex/wiki/)
- [Games for Windows and the DirectX SDK blog - October 2021](https://walbourn.github.io/directxtex/)
- [Games for Windows and the DirectX SDK blog - April 2025](https://walbourn.github.io/github-project-updates-2025/)
## No speculation
When creating documentation:
### Document Only What Exists
- Only document features, patterns, and decisions that are explicitly present in the source code.
- Only include configurations and requirements that are clearly specified.
- Do not make assumptions about implementation details.
### Handle Missing Information
- Ask the user questions to gather missing information.
- Document gaps in current implementation or specifications.
- List open questions that need to be addressed.
### Source Material
- Always cite the specific source file and line numbers for documented features.
- Link directly to relevant source code when possible.
- Indicate when information comes from requirements vs. implementation.
### Verification Process
- Review each documented item against source code whenever related to the task.
- Remove any speculative content.
- Ensure all documentation is verifiable against the current state of the codebase.

4
.github/linters/actionlint.yml vendored Normal file
View File

@ -0,0 +1,4 @@
self-hosted-runner:
# Workaround until linter is updated
labels:
- windows-11-arm

77
.github/workflows/arm64.yml vendored Normal file
View File

@ -0,0 +1,77 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# http://go.microsoft.com/fwlink/?LinkId=248926
name: 'CMake (Windows on ARM64)'
on:
push:
branches: "main"
paths-ignore:
- '*.md'
- LICENSE
- '.azuredevops/**'
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.xvd
pull_request:
branches: "main"
paths-ignore:
- '*.md'
- LICENSE
- '.azuredevops/**'
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.xvd
permissions:
contents: read
jobs:
build:
runs-on: windows-11-arm
strategy:
fail-fast: false
matrix:
build_type: [arm64-Debug, arm64-Release, arm64-Debug-UWP, arm64-Release-UWP]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 'Install Ninja'
run: choco install ninja
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch: arm64
- name: 'Configure CMake'
working-directory: ${{ github.workspace }}
run: cmake --preset=${{ matrix.build_type }}
- name: 'Build'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}
- name: 'Clean up'
working-directory: ${{ github.workspace }}
run: Remove-Item -Path out -Recurse -Force
- name: 'Configure CMake (DLL)'
working-directory: ${{ github.workspace }}
run: cmake --preset=${{ matrix.build_type }} -DBUILD_SHARED_LIBS=ON
- name: 'Build (DLL)'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

107
.github/workflows/arm64bvt.yml vendored Normal file
View File

@ -0,0 +1,107 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
# https://go.microsoft.com/fwlink/?LinkId=248926
name: 'BVTs (arm64)'
on:
push:
branches: "main"
paths-ignore:
- '*.md'
- LICENSE
- '.azuredevops/**'
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.xvd
pull_request:
branches: "main"
paths-ignore:
- '*.md'
- LICENSE
- '.azuredevops/**'
- '.nuget/*'
- build/*.cmd
- build/*.json
- build/*.props
- build/*.ps1
- build/*.targets
- build/*.xvd
permissions:
contents: read
jobs:
build:
runs-on: windows-11-arm
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
build_type: [arm64-Release]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Clone test repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: walbourn/directxtextest
path: Tests
ref: main
- name: 'Install Ninja'
run: choco install ninja
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch: arm64
- name: 'Set triplet'
shell: pwsh
run: echo "VCPKG_DEFAULT_TRIPLET=arm64-windows" >> $env:GITHUB_ENV
- name: Get vcpkg commit hash
shell: pwsh
run: |
if ($Env:vcpkgRelease) {
echo "Using vcpkg commit from repo variable..."
$VCPKG_COMMIT_ID = $Env:vcpkgRelease
}
else {
echo "Fetching latest vcpkg commit hash..."
$commit = (git ls-remote https://github.com/microsoft/vcpkg.git HEAD | Select-String -Pattern '([a-f0-9]{40})').Matches.Value
$VCPKG_COMMIT_ID = $commit
}
Write-Host "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID"
echo "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID" >> $env:GITHUB_ENV
env:
vcpkgRelease: '${{ vars.VCPKG_COMMIT_ID }}'
- uses: lukka/run-vcpkg@7d259227a1fb6471a0253dd5ab7419835228f7d7 # v11
with:
runVcpkgInstall: true
vcpkgJsonGlob: '**/build/vcpkg.json'
vcpkgGitCommitId: '${{ env.VCPKG_COMMIT_ID }}'
- name: 'Configure CMake'
working-directory: ${{ github.workspace }}
run: >
cmake --preset=${{ matrix.build_type }} -DBUILD_TESTING=ON -DBUILD_TOOLS=OFF -DBUILD_SAMPLE=OFF -DBUILD_BVT=ON
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_MANIFEST_DIR="${{ github.workspace }}/build"
-DVCPKG_TARGET_TRIPLET="${env:VCPKG_DEFAULT_TRIPLET}"
- name: 'Build'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}
- name: 'Run BVTs'
working-directory: ${{ github.workspace }}
run: ctest --preset=${{ matrix.build_type }} --output-on-failure

View File

@ -3,7 +3,7 @@
#
# https://go.microsoft.com/fwlink/?LinkId=248926
name: 'CTest (BVTs)'
name: 'BVTs (x64)'
on:
push:

20
build/RestoreGDK.proj Normal file
View File

@ -0,0 +1,20 @@
<!-- First update the GDKEditionNumber property in gdkedition.props -->
<!-- nuget restore restoregdk.proj -packagesDirectory <outputdirectory> -->
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="gdkedition.props" />
<PropertyGroup>
<EditionYearMonth>$(GDKEditionNumber.Substring(0,2))$(GDKEditionNumber.Substring(2,2))</EditionYearMonth>
<EditionQFE>$(GDKEditionNumber.Substring(4,2).TrimStart('0'))</EditionQFE>
<EditionQFE Condition="'$(EditionQFE)'==''">0</EditionQFE>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<Platforms>x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.GDK.PC" Version="$(EditionYearMonth).$(EditionQFE).*" />
<PackageReference Include="Microsoft.GDK.Xbox" Version="$(EditionYearMonth).$(EditionQFE).*" />
</ItemGroup>
</Project>

159
build/RestoreGDK.ps1 Normal file
View File

@ -0,0 +1,159 @@
<#
.SYNOPSIS
Download and extract GDK NuGet based on edition number
.DESCRIPTION
This script determines the NuGet package id to use based on the provided GDK edition number. It makes use of MSBuild PackageReference floating version numbers to do the restore operation.
.PARAMETER GDKEditionNumber
The GDK edition number in the form of YYMMQQ.
.PARAMETER OutputDirectory
Directory to write the packages into. Path should not already contain the packages.
#>
param(
[Parameter(
Mandatory,
Position = 0
)]
[string]$GDKEditionNumber,
[Parameter(
Mandatory,
Position = 1
)]
[string]$OutputDirectory
)
# Validate output directory
if ([string]::IsNullOrEmpty($OutputDirectory)) {
Write-Error "##[error]Output Directory is required" -ErrorAction Stop
}
# Parse edition number
if (-not ($GDKEditionNumber -match '^([0-9][0-9])([0-9][0-9])([0-9][0-9])$')) {
Write-Error "##[error]This script requires a valid GDK edition number!" -ErrorAction Stop
}
$year = $Matches.1
$month = [int]$Matches.2
$qfe = [int]$Matches.3
if ($year -lt 21)
{
Write-Error "##[error]Edition year not supported: 20$year" -ErrorAction Stop
}
if (($month -lt 1) -or ($month -gt 12))
{
Write-Error "##[error]Edition month not supported: $month" -ErrorAction Stop
}
if ($qfe -gt 0) {
Write-Host ("##[debug]GDKEditionNumber = $GDKEditionNumber ({0} 20{1} QFE {2})" -f (Get-Culture).DateTimeFormat.GetMonthName($month), $year, $qfe)
}
else {
Write-Host ("##[debug]GDKEditionNumber = $GDKEditionNumber ({0} 20{1})" -f (Get-Culture).DateTimeFormat.GetMonthName($month), $year)
}
# Verify NuGet tool is available
$nuget = Get-Command nuget.exe -ErrorAction SilentlyContinue
if (-Not $nuget) {
Write-Error "##[error]Missing required nuget.exe tool" -ErrorAction Stop
}
# Determine NuGet package ID
if ($GDKEditionNumber -ge 241000) {
$PGDK_ID = "Microsoft.GDK.PC"
$GDKX_ID = "Microsoft.GDK.Xbox"
}
else {
Write-Error "##[error]Script supports October 2024 or later" -ErrorAction Stop
}
# Check that the package isn't already present
$PGDK_DIR = [IO.Path]::Combine($OutputDirectory, $PGDK_ID)
if (Test-Path $PGDK_DIR) {
Write-Error "##[error]PC Package ID already exists!" -ErrorAction Stop
}
$GDKX_DIR = [IO.Path]::Combine($OutputDirectory, $GDKX_ID)
if (Test-Path $GDKX_DIR) {
Write-Error "##[error]Xbox Package ID already exists!" -ErrorAction Stop
}
# Restore Nuget packages using floating versions
$propsfile = [IO.Path]::Combine( $PSScriptRoot , "gdkedition.props")
$props = Get-Content -Path $propsfile
$props = $props -replace '<GDKEditionNumber>.+</GDKEditionNumber>', ("<GDKEditionNumber>{0}</GDKEditionNumber>" -f $GDKEditionNumber)
Set-Content -Path $propsfile -Value $props
$nugetArgs = "restore RestoreGDK.proj -PackageSaveMode nuspec -packagesDirectory `"{0}`"" -f $OutputDirectory.TrimEnd('\')
Write-Host "##[command]nuget $nugetArgs"
$nugetrun = Start-Process -PassThru -Wait -FilePath $nuget.Path -WorkingDirectory $PSScriptRoot -ArgumentList $nugetArgs -NoNewWindow
if ($nugetrun.ExitCode -gt 0) {
Write-Error "##[error]nuget restore failed" -ErrorAction Stop
}
# Verify expected output of restore
if (-Not (Test-Path $PGDK_DIR)) {
Write-Error "##[error]Missing PC package after restore!" -ErrorAction Stop
}
if (-Not (Test-Path $GDKX_DIR)) {
Write-Error "##[error]Missing Xbox package after restore!" -ErrorAction Stop
}
# Reduce path depth removing version folder
$PGDK_VER = Get-ChildItem $PGDK_DIR
if ($PGDK_VER.Count -ne 1) {
Write-Error "##[error]Expected a single directory for the version!" -ErrorAction Stop
}
$content = Get-ChildItem $PGDK_VER.Fullname
ForEach-Object -InputObject $content { Move-Item $_.Fullname -Destination $PGDK_DIR }
Remove-Item $PGDK_VER.Fullname
$GDKX_VER = Get-ChildItem $GDKX_DIR
if ($GDKX_VER.Count -ne 1) {
Write-Error "##[error]Expected a single directory for the version!" -ErrorAction Stop
}
$content = Get-ChildItem $GDKX_VER.Fullname
ForEach-Object -InputObject $content { Move-Item $_.Fullname -Destination $GDKX_DIR }
Remove-Item $GDKX_VER.Fullname
Write-Host ("##[debug]PC Package ID: {0} Version: {1}" -f $PGDK_ID, $PGDK_VER)
Write-Host ("##[debug]Xbox Package ID: {0} Version: {1}" -f $GDKX_ID, $GDKX_VER)
# Read the nuspec files
$PGDK_NUSPEC = New-Object xml
$PGDK_NUSPEC.PreserveWhitespace = $true
$PGDK_NUSPEC.Load([IO.Path]::Combine($PGDK_DIR, $PGDK_ID + ".nuspec"))
$GDKX_NUSPEC = New-Object xml
$GDKX_NUSPEC.PreserveWhitespace = $true
$GDKX_NUSPEC.Load([IO.Path]::Combine($GDKX_DIR, $GDKX_ID + ".nuspec"))
# Log results
Write-Host "##[group]PC Nuget Package nuspec"
Write-host $PGDK_NUSPEC.outerxml
Write-Host "##[endgroup]"
Write-Host "##[group]Xbox Nuget Package nuspec"
Write-host $GDKX_NUSPEC.outerxml
Write-Host "##[endgroup]"
$id = $PGDK_NUSPEC.package.metadata.id
Write-Host "##vso[task.setvariable variable=PCNuGetPackage;]$id"
$id = $GDKX_NUSPEC.package.metadata.id
Write-Host "##vso[task.setvariable variable=XboxNuGetPackage;]$id"
$ver = $PGDK_NUSPEC.package.metadata.version
Write-Host "##vso[task.setvariable variable=PCNuGetPackageVersion;]$ver"
$ver = $GDKX_NUSPEC.package.metadata.version
Write-Host "##vso[task.setvariable variable=XboxNuGetPackageVersion;]$ver"

View File

@ -13,7 +13,7 @@ goto needconsole
set GXDKEDITION=%2
echo GXDKEDITION: %GXDKEDITION%
set PCNUGET=%1\Microsoft.GDK.PC.%GXDKEDITION%\
set PCNUGET=%1\Microsoft.GDK.PC\
if NOT EXIST %PCNUGET% goto missingpcnuget
set GRDKLatest=%PCNUGET%native\%GXDKEDITION%\GRDK\
@ -21,7 +21,7 @@ echo GRDKLatest: %GRDKLatest%
if %3.==PC. goto grdkonly
set XBOXNUGET=%1\Microsoft.gdk.xbox.%GXDKEDITION%\
set XBOXNUGET=%1\Microsoft.gdk.xbox\
if NOT EXIST %XBOXNUGET% goto missingxboxnuget
set GXDKLatest=%XBOXNUGET%native\%GXDKEDITION%\GXDK\
@ -68,9 +68,9 @@ echo Usage: This script requires the target type of PC, Scarlett, or XboxOne in
exit /b 1
:missingpcnuget
echo ERROR - Cannot find Microsoft.GDK.PC.<edition> installed at '%1'
echo ERROR - Cannot find Microsoft.GDK.PC installed at '%1'
exit /b 1
:missingxboxnuget
echo ERROR - Cannot find Microsoft.GDK.Xbox.<edition> installed at '%1'
echo ERROR - Cannot find Microsoft.GDK.Xbox installed at '%1'
exit /b 1

6
build/gdkedition.props Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<GDKEditionNumber>000000</GDKEditionNumber>
</PropertyGroup>
</Project>