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
25 changes: 21 additions & 4 deletions .azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ variables:

jobs:
- job: BUILD_GDK
displayName: 'Microsoft Game Development Kit (GDK)'
workspace:
clean: all
displayName: 'Microsoft Game Development Kit (Gaming.*.x64)'
timeoutInMinutes: 120
cancelTimeoutInMinutes: 1
steps:
Expand Down Expand Up @@ -100,12 +98,18 @@ jobs:
- task: NuGetAuthenticate@1
displayName: 'NuGet Auth'
- task: PowerShell@2
displayName: 'NuGet Install GDK'
displayName: 'NuGet Install PC GDK'
inputs:
targetType: filePath
filePath: ./build/RestoreGDK.ps1
arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER)
failOnStderr: true
- task: NuGetCommand@2
displayName: 'NuGet install Xbox GDK'
# Required for Gaming.Desktop.x64 MSBuild rules which are deprecated and only ship in the GXDK
inputs:
command: custom
arguments: 'install -directdownload Microsoft.GDK.Xbox -ExcludeVersion -Version $(GDKNuGetPackageVersion) -OutputDirectory $(EXTRACTED_FOLDER)'
- task: CopyFiles@2
displayName: Set up Directory.Build.props
inputs:
Expand All @@ -118,6 +122,12 @@ jobs:
solution: build/SetupBWOI.targets
msbuildArchitecture: x64
msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION)
- task: MSBuild@1
displayName: Log Information
inputs:
solution: build/LogInfo.targets
msbuildArchitecture: x64
msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION)
- task: VSBuild@1
displayName: Build solution DirectXTK_GDK_2022 pcdbg
continueOnError: true
Expand Down Expand Up @@ -147,6 +157,7 @@ jobs:
- checkout: self
clean: true
fetchTags: false
fetchDepth: 1
- task: NuGetToolInstaller@1
displayName: 'Use NuGet'
- task: PowerShell@2
Expand Down Expand Up @@ -200,6 +211,12 @@ jobs:
echo ##vso[task.prependpath]%ADDBIN%

failOnStderr: true
- task: MSBuild@1
displayName: Log Information
inputs:
solution: build/LogInfo.targets
msbuildArchitecture: x64
msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION)
- task: CMake@1
displayName: 'CMake (MSVC): Config Debug'
inputs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0

- name: Initialize CodeQL
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v3.29.5
uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
with:
languages: ${{ matrix.language }}
build-mode: manual
Expand All @@ -86,6 +86,6 @@ jobs:
run: msbuild MakeSpriteFont.csproj /p:Configuration=Debug /p:Platform=AnyCPU

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v3.29.5
uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
with:
category: "/language:${{ matrix.language }}"
2 changes: 1 addition & 1 deletion .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ jobs:

# Upload SARIF file to GitHub Code Scanning Alerts
- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v3.29.5
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
with:
sarif_file: ${{ steps.run-analysis.outputs.sarif }}
29 changes: 13 additions & 16 deletions build/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,11 @@

<_AlternativeVCTargetsPath170>$(ExtractedFolder)VCTargets170\</_AlternativeVCTargetsPath170>
<_AlternativeVCTargetsPath160>$(ExtractedFolder)VCTargets160\</_AlternativeVCTargetsPath160>
<_AlternativeVCTargetsPath150 Condition="'$(GDKEditionNumber)' != '' AND '$(GDKEditionNumber)' &lt; '241000'">$(ExtractedFolder)VCTargets150\</_AlternativeVCTargetsPath150>

<!-- Workaround for VS bug -->
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(GDKEditionNumber)' != '' AND '$(GDKEditionNumber)' &lt; '220300'">
<_PCNuGetPackage>Microsoft.PGDK</_PCNuGetPackage>
</PropertyGroup>

<PropertyGroup Condition="'$(GDKEditionNumber)' != '' AND '$(GDKEditionNumber)' &gt;= '220300'">
<_PCNuGetPackage>Microsoft.GDK.PC</_PCNuGetPackage>
</PropertyGroup>

<PropertyGroup Condition="'$(GDKEditionNumber)' != '' AND '$(GDKEditionNumber)' &lt; '241000'">
<_PCNuGetPackage>$(_PCNuGetPackage).$(GDKEditionNumber)</_PCNuGetPackage>
</PropertyGroup>

<!-- Windows SDK NuGet -->
<Import Condition="'$(WSDKEnableBWOI)' == 'true'"
Project="$(ExtractedFolder)Microsoft.Windows.SDK.cpp\build\Microsoft.Windows.SDK.cpp.props" />
Expand All @@ -44,8 +31,19 @@
Project="$(ExtractedFolder)Microsoft.Windows.SDK.cpp.arm64\build\native\Microsoft.Windows.SDK.cpp.arm64.props" />

<!-- Microsoft GDK NuGet -->
<Import Condition="'$(GDKEnableBWOI)' == 'true' and $(Platform.Contains('x64')) and Exists('$(ExtractedFolder)$(_PCNuGetPackage)\build\$(_PCNuGetPackage).props')"
Project="$(ExtractedFolder)$(_PCNuGetPackage)\build\$(_PCNuGetPackage).props" />
<Import Condition="'$(GDKEnableBWOI)' == 'true' and Exists('$(ExtractedFolder)Microsoft.GDK.Core\build\Microsoft.GDK.Core.props')"
Project="$(ExtractedFolder)Microsoft.GDK.Core\build\Microsoft.GDK.Core.props" />

<Import Condition="'$(GDKEnableBWOI)' == 'true' and '$(Platform)'=='ARM64' and Exists('$(ExtractedFolder)Microsoft.GDK.Windows\build\Microsoft.GDK.Windows.props')"
Project="$(ExtractedFolder)Microsoft.GDK.Windows\build\Microsoft.GDK.Windows.props" />
<Import Condition="'$(GDKEnableBWOI)' == 'true' and '$(Platform)'=='x64' and Exists('$(ExtractedFolder)Microsoft.GDK.Windows\build\Microsoft.GDK.Windows.props')"
Project="$(ExtractedFolder)Microsoft.GDK.Windows\build\Microsoft.GDK.Windows.props" />
<Import Condition="'$(GDKEnableBWOI)' == 'true' and '$(Platform)'=='Gaming.Desktop.x64' and Exists('$(ExtractedFolder)Microsoft.GDK.Windows\build\Microsoft.GDK.Windows.props')"
Project="$(ExtractedFolder)Microsoft.GDK.Windows\build\Microsoft.GDK.Windows.props" />

<!-- Microsoft GDK NuGet (Old Layouts)-->
<Import Condition="'$(GDKEnableBWOI)' == 'true' and $(Platform.Contains('x64')) and Exists('$(ExtractedFolder)Microsoft.GDK.PC\build\Microsoft.GDK.PC.props')"
Project="$(ExtractedFolder)Microsoft.GDK.PC\build\Microsoft.GDK.PC.props" />

<!--
****************************************************************************************************
Expand All @@ -54,7 +52,6 @@
-->
<PropertyGroup Condition="'$(Platform)' == 'Gaming.Desktop.x64' and '$(VisualStudioVersion)' == '17.0'">
<DisableInstalledVCTargetsUse>true</DisableInstalledVCTargetsUse>
<VCTargetsPath15 Condition="'$(_AlternativeVCTargetsPath150)'!=''">$(_AlternativeVCTargetsPath150)</VCTargetsPath15>
<VCTargetsPath16 Condition="'$(_AlternativeVCTargetsPath160)'!=''">$(_AlternativeVCTargetsPath160)</VCTargetsPath16>
<VCTargetsPath17>$(_AlternativeVCTargetsPath170)</VCTargetsPath17>
</PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions build/LogInfo.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="LogInfo" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
-->

<Target Name="LogInfo">
<Message Condition="'$(Platform)'!=''" Text="##[debug]Building $(Platform)" Importance="high" />
<Message Condition="'$(Configuration)'!=''" Text="##[debug]Building $(Configuration)" Importance="high" />
<Message Text="##[debug]Using VS $(VisualStudioVersion) : MSBuild $(MSBuildFileVersion)" Importance="high" />
<Message Condition="'$(GDKEditionNumber)'!=''" Text="##[debug]GDK Edition Number: $(GDKEditionNumber)" Importance="high" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion build/RestoreGDK.proj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
<Platforms>x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.GDK.PC" Version="$(EditionYearMonth).$(EditionQFE).*" />
<PackageReference Include="$(GDKNuGetPackage)" Version="$(EditionYearMonth).$(EditionQFE).*" />
</ItemGroup>
</Project>
79 changes: 52 additions & 27 deletions build/RestoreGDK.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<#

.SYNOPSIS
Download and extract GDK NuGet based on edition number
Download and extract the 'base' GDK NuGet based on edition number, returning the full version number that can be used to restore other GDK packages in the set.

.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.
Expand All @@ -12,6 +12,12 @@ The GDK edition number in the form of YYMMQQ.
.PARAMETER OutputDirectory
Directory to write the packages into. Path should not already contain the packages.

.PARAMETER NewLayout
Switch to indicate to use the 'new layout' of GDK packages (October 2025 and later).

.PARAMETER AutoLayout
Switch to indicate to automatically choose layout style based on edition number.

#>

param(
Expand All @@ -24,9 +30,15 @@ param(
Mandatory,
Position = 1
)]
[string]$OutputDirectory
[string]$OutputDirectory,
[switch]$NewLayout,
[switch]$AutoLayout
)

if ($NewLayout -and $AutoLayout) {
Write-Error "##[error]Cannot specify both NewLayout and AutoLayout switches" -ErrorAction Stop
}

# Validate output directory
if ([string]::IsNullOrEmpty($OutputDirectory)) {
Write-Error "##[error]Output Directory is required" -ErrorAction Stop
Expand Down Expand Up @@ -65,23 +77,40 @@ if (-Not $nuget) {
}

# Determine NuGet package ID
if ($GDKEditionNumber -ge 241000) {
$PGDK_ID = "Microsoft.GDK.PC"
if ($GDKEditionNumber -lt 241000) {
Write-Error "##[error]Script supports October 2024 or later" -ErrorAction Stop
}

if ($AutoLayout) {
if ($GDKEditionNumber -ge 251000) {
$NewLayout = $true
}
else {
$NewLayout = $false
}
}

if ($NewLayout) {
if ($GDKEditionNumber -lt 251000) {
Write-Error "##[error]New layout only supported for October 2025 or later" -ErrorAction Stop
}
$GDK_ID = "Microsoft.GDK.Core"
}
else {
Write-Error "##[error]Script supports October 2024 or later" -ErrorAction Stop
$GDK_ID = "Microsoft.GDK.PC"
}

# 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
$GDK_DIR = [IO.Path]::Combine($OutputDirectory, $GDK_ID)
if (Test-Path $GDK_DIR) {
Write-Error "##[error]NuGet 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)
$props = $props -replace '<GDKNuGetPackage>.+</GDKNuGetPackage>', ("<GDKNuGetPackage>{0}</GDKNuGetPackage>" -f $GDK_ID)
Set-Content -Path $propsfile -Value $props

$nugetArgs = "restore RestoreGDK.proj -PackageSaveMode nuspec -packagesDirectory `"{0}`"" -f $OutputDirectory.TrimEnd('\')
Expand All @@ -92,35 +121,31 @@ if ($nugetrun.ExitCode -gt 0) {
}

# 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 $GDK_DIR)) {
Write-Error "##[error]Missing NuGet package after restore!" -ErrorAction Stop
}

# Reduce path depth removing version folder
$PGDK_VER = Get-ChildItem $PGDK_DIR
if ($PGDK_VER.Count -ne 1) {
$GDK_VER = Get-ChildItem $GDK_DIR
if ($GDK_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

Write-Host ("##[debug]PC Package ID: {0} Version: {1}" -f $PGDK_ID, $PGDK_VER)
$content = Get-ChildItem $GDK_VER.Fullname
ForEach-Object -InputObject $content { Move-Item $_.Fullname -Destination $GDK_DIR }
Remove-Item $GDK_VER.Fullname

Write-Host ("##[debug]NuGet Package ID: {0} Version: {1}" -f $GDK_ID, $GDK_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"))
$GDK_NUSPEC = New-Object xml
$GDK_NUSPEC.PreserveWhitespace = $true
$GDK_NUSPEC.Load([IO.Path]::Combine($GDK_DIR, $GDK_ID + ".nuspec"))

# Log results
Write-Host "##[group]PC Nuget Package nuspec"
Write-host $PGDK_NUSPEC.outerxml
Write-Host "##[group]NuGet Nuget Package nuspec"
Write-host $GDK_NUSPEC.outerxml
Write-Host "##[endgroup]"

$id = $PGDK_NUSPEC.package.metadata.id
Write-Host "##vso[task.setvariable variable=PCNuGetPackage;]$id"

$ver = $PGDK_NUSPEC.package.metadata.version
Write-Host "##vso[task.setvariable variable=PCNuGetPackageVersion;]$ver"
$ver = $GDK_NUSPEC.package.metadata.version
Write-Host "##vso[task.setvariable variable=GDKNuGetPackageVersion;]$ver"
Loading
Loading