SDL: release: Include pdb in Visual Studio release artifacts + build in C:\temp

From 9b0203d9b135afa6f02320f3f257236c1f2861c5 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 3 May 2024 22:36:23 +0200
Subject: [PATCH] release: Include pdb in Visual Studio release artifacts +
 build in C:\temp

---
 .github/workflows/release.yml  | 10 +++++-----
 build-scripts/build-release.py |  9 +++++++--
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a44471c016674..1c523ec71f56f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -247,14 +247,14 @@ jobs:
       - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
         id: zip
         run: |
-          mkdir C:\zipdir
-          cd C:\zipdir
+          New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
+          cd C:\temp
           unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
-          echo "path=C:\zipdir\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
+          echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
       - name: 'Build MSVC binary archives'
         id: releaser
         run: |
-          python build-scripts/build-release.py          `
+          python build-scripts/build-release.py     `
             --create win32                          `
             --commit ${{ inputs.commit }}           `
             --project SDL3                          `
@@ -478,4 +478,4 @@ jobs:
         uses: actions/upload-artifact@v4
         with:
           name: android
-          path: '${{ github.workspace }}/dist'
\ No newline at end of file
+          path: '${{ github.workspace }}/dist'
diff --git a/build-scripts/build-release.py b/build-scripts/build-release.py
index b6b965040ed30..634ae99dcaa2d 100755
--- a/build-scripts/build-release.py
+++ b/build-scripts/build-release.py
@@ -24,7 +24,7 @@
 logger = logging.getLogger(__name__)
 
 
-VcArchDevel = collections.namedtuple("VcArchDevel", ("dll", "imp", "test"))
+VcArchDevel = collections.namedtuple("VcArchDevel", ("dll", "pdb", "imp", "test"))
 GIT_HASH_FILENAME = ".git-hash"
 
 ANDROID_AVAILABLE_ABIS = [
@@ -456,10 +456,12 @@ def create_mingw_archives(self):
 
     def build_vs(self, arch: str, platform: str, vs: VisualStudio, configuration: str="Release"):
         dll_path = self.root / f"VisualC/SDL/{platform}/{configuration}/{self.project}.dll"
+        pdb_path = self.root / f"VisualC/SDL/{platform}/{configuration}/{self.project}.pdb"
         imp_path = self.root / f"VisualC/SDL/{platform}/{configuration}/{self.project}.lib"
         test_path = self.root / f"VisualC/SDL_test/{platform}/{configuration}/{self.project}_test.lib"
 
         dll_path.unlink(missing_ok=True)
+        pdb_path.unlink(missing_ok=True)
         imp_path.unlink(missing_ok=True)
         test_path.unlink(missing_ok=True)
 
@@ -473,11 +475,13 @@ def build_vs(self, arch: str, platform: str, vs: VisualStudio, configuration: st
         if self.dry:
             dll_path.parent.mkdir(parents=True, exist_ok=True)
             dll_path.touch()
+            pdb_path.touch()
             imp_path.touch()
             test_path.parent.mkdir(parents=True, exist_ok=True)
             test_path.touch()
 
         assert dll_path.is_file(), "SDL3.dll has not been created"
+        assert pdb_path.is_file(), "SDL3.pdb has not been created"
         assert imp_path.is_file(), "SDL3.lib has not been created"
         assert test_path.is_file(), "SDL3_test.lib has not been created"
 
@@ -492,7 +496,7 @@ def build_vs(self, arch: str, platform: str, vs: VisualStudio, configuration: st
             self._zip_add_git_hash(zip_file=zf)
         self.artifacts[f"VC-{arch}"] = zip_path
 
-        return VcArchDevel(dll=dll_path, imp=imp_path, test=test_path)
+        return VcArchDevel(dll=dll_path, pdb=pdb_path, imp=imp_path, test=test_path)
 
     def build_vs_devel(self, arch_vc: dict[str, VcArchDevel]):
         zip_path = self.dist_path / f"{self.project}-devel-{self.version}-VC.zip"
@@ -514,6 +518,7 @@ def zip_directory(zf: zipfile.ZipFile, directory: Path, arcrelpath: str):
             for arch, binaries in arch_vc.items():
                 zip_file(zf, path=binaries.dll, arcrelpath=f"lib/{arch}/{binaries.dll.name}")
                 zip_file(zf, path=binaries.imp, arcrelpath=f"lib/{arch}/{binaries.imp.name}")
+                zip_file(zf, path=binaries.pdb, arcrelpath=f"lib/{arch}/{binaries.pdb.name}")
                 zip_file(zf, path=binaries.test, arcrelpath=f"lib/{arch}/{binaries.test.name}")
 
             zip_directory(zf, directory=self.root / "include/SDL3", arcrelpath="include/SDL3")