From f98cb67cadfe8f578db4634655e6d3d2ffc66aaf Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Mon, 26 Sep 2022 17:22:00 +0100 Subject: [PATCH 1/3] Experiment with symbol server style symbol storage --- .gitlab-ci.yml | 10 ++++++++ CI/Store-Symbols.ps1 | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 CI/Store-Symbols.ps1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8bd6c60fd5..aa59ff2183 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -437,6 +437,7 @@ macOS12_Xcode13: - $env:CCACHE_BASEDIR = Get-Location - $env:CCACHE_DIR = "$(Get-Location)\ccache" - New-Item -Type Directory -Force -Path $env:CCACHE_DIR + - New-Item -Type File -Force -Path MSVC2019_64_Ninja\.cmake\api\v1\query\codemodel-v2 - sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -N -b -t -C $multiview -E - cd MSVC2019_64_Ninja - .\ActivateMSVC.ps1 @@ -448,6 +449,10 @@ macOS12_Xcode13: - | if (Get-ChildItem -Recurse *.pdb) { 7z a -tzip "..\..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_symbols.zip"))" '*.pdb' CI-ID.txt + Push-Location .. + ..\CI\Store-Symbols.ps1 + 7z a -tzip "..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_sym_store.zip"))" '.\SymStore\*' CI-ID.txt + Pop-Location Get-ChildItem -Recurse *.pdb | Remove-Item } - 7z a -tzip "..\..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}.zip"))" '*' @@ -539,6 +544,7 @@ macOS12_Xcode13: - $env:CCACHE_BASEDIR = Get-Location - $env:CCACHE_DIR = "$(Get-Location)\ccache" - New-Item -Type Directory -Force -Path $env:CCACHE_DIR + - New-Item -Type File -Force -Path MSVC2019_64\.cmake\api\v1\query\codemodel-v2 - sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -b -t -C $multiview -E - cd MSVC2019_64 - cmake --build . --config $config @@ -549,6 +555,10 @@ macOS12_Xcode13: - | if (Get-ChildItem -Recurse *.pdb) { 7z a -tzip "..\..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_symbols.zip"))" '*.pdb' CI-ID.txt + Push-Location .. + ..\CI\Store-Symbols.ps1 + 7z a -tzip "..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_sym_store.zip"))" '.\SymStore\*' CI-ID.txt + Pop-Location Get-ChildItem -Recurse *.pdb | Remove-Item } - 7z a -tzip "..\..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}.zip"))" '*' diff --git a/CI/Store-Symbols.ps1 b/CI/Store-Symbols.ps1 new file mode 100644 index 0000000000..1d379cde24 --- /dev/null +++ b/CI/Store-Symbols.ps1 @@ -0,0 +1,54 @@ +if (-Not (Test-Path CMakeCache.txt)) +{ + Write-Error "This script must be run from the build directory." +} + +if (-Not (Test-Path .cmake\api\v1\reply)) +{ + New-Item -Type File -Force .cmake\api\v1\query\codemodel-v2 + cmake . +} + +try +{ + Push-Location .cmake\api\v1\reply + + $index = Get-Content -Raw index-*.json | ConvertFrom-Json + + $codemodel = Get-Content -Raw $index.reply."codemodel-v2".jsonFile | ConvertFrom-Json + + $targets = @() + $codemodel.configurations | ForEach-Object { + $_.targets | ForEach-Object { + $target = Get-Content -Raw $_.jsonFile | ConvertFrom-Json + if ($target.type -eq "EXECUTABLE" -or $target.type -eq "SHARED_LIBRARY") + { + $targets += $target + } + } + } + + $artifacts = @() + $targets | ForEach-Object { + $_.artifacts | ForEach-Object { + $artifacts += $_.path + } + } +} +finally +{ + Pop-Location +} + +$windowsSDKFolder = Get-ItemPropertyValue "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" InstallationFolder + +try +{ + $responseFile = New-TemporaryFile + $artifacts | Set-Content $responseFile + & "$windowsSDKFolder\debuggers\x64\symstore.exe" add /f @$responseFile /s .\SymStore /compress /t "I don't know why /t is needed" +} +finally +{ + Remove-Item $responseFile +} From 327f977ae61d5844627ee0adddc03a18667bea6c Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Mon, 26 Sep 2022 19:11:21 +0100 Subject: [PATCH 2/3] Switch to Python implementation of SymStore --- CI/Store-Symbols.ps1 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/CI/Store-Symbols.ps1 b/CI/Store-Symbols.ps1 index 1d379cde24..6328a2a2f6 100644 --- a/CI/Store-Symbols.ps1 +++ b/CI/Store-Symbols.ps1 @@ -40,15 +40,13 @@ finally Pop-Location } -$windowsSDKFolder = Get-ItemPropertyValue "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0" InstallationFolder - -try +if (-not (Test-Path symstore-venv)) { - $responseFile = New-TemporaryFile - $artifacts | Set-Content $responseFile - & "$windowsSDKFolder\debuggers\x64\symstore.exe" add /f @$responseFile /s .\SymStore /compress /t "I don't know why /t is needed" + python -m venv symstore-venv } -finally +if (-not (Test-Path symstore-venv\Scripts\symstore.exe)) { - Remove-Item $responseFile + symstore-venv\Scripts\pip install symstore==0.3.3 } +$artifacts = $artifacts | Where-Object { Test-Path $_ } +symstore-venv\Scripts\symstore --compress .\SymStore @artifacts From 3e094684e9e7c5dfdb319afccb24f76cec0f8d33 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Mon, 26 Sep 2022 19:12:09 +0100 Subject: [PATCH 3/3] Fix paths --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa59ff2183..590c654d99 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -451,7 +451,7 @@ macOS12_Xcode13: 7z a -tzip "..\..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_symbols.zip"))" '*.pdb' CI-ID.txt Push-Location .. ..\CI\Store-Symbols.ps1 - 7z a -tzip "..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_sym_store.zip"))" '.\SymStore\*' CI-ID.txt + 7z a -tzip "..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_sym_store.zip"))" '.\SymStore\*' $config\CI-ID.txt Pop-Location Get-ChildItem -Recurse *.pdb | Remove-Item } @@ -557,7 +557,7 @@ macOS12_Xcode13: 7z a -tzip "..\..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_symbols.zip"))" '*.pdb' CI-ID.txt Push-Location .. ..\CI\Store-Symbols.ps1 - 7z a -tzip "..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_sym_store.zip"))" '.\SymStore\*' CI-ID.txt + 7z a -tzip "..\$(Make-SafeFileName("OpenMW_MSVC2019_64_${config}_${CI_COMMIT_REF_NAME}_${CI_JOB_ID}_sym_store.zip"))" '.\SymStore\*' $config\CI-ID.txt Pop-Location Get-ChildItem -Recurse *.pdb | Remove-Item }