diff --git a/.github/workflows/release-overlay.yml b/.github/workflows/release-overlay.yml index 9b37b992..de04ef47 100644 --- a/.github/workflows/release-overlay.yml +++ b/.github/workflows/release-overlay.yml @@ -3,12 +3,18 @@ name: Release RiftLauncher overlays on: release: types: [published] + workflow_dispatch: + inputs: + tag: + description: Existing release tag to build and attach overlays for (for example v0.4.1) + required: true + type: string permissions: contents: write concurrency: - group: release-overlay-${{ github.event.release.tag_name }} + group: release-overlay-${{ inputs.tag || github.event.release.tag_name }} cancel-in-progress: false jobs: @@ -32,7 +38,7 @@ jobs: - name: Resolve release and client versions id: versions env: - RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }} shell: bash run: | set -euo pipefail @@ -103,7 +109,7 @@ jobs: - name: Resolve release and client versions id: versions env: - RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }} shell: bash run: | set -euo pipefail @@ -172,7 +178,7 @@ jobs: - name: Validate and upload release assets env: GH_TOKEN: ${{ github.token }} - RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }} shell: bash run: | set -euo pipefail diff --git a/Optimum.Tests/installer-release-coverage-tests.cs b/Optimum.Tests/installer-release-coverage-tests.cs index 0bbab0a6..f797c8a8 100644 --- a/Optimum.Tests/installer-release-coverage-tests.cs +++ b/Optimum.Tests/installer-release-coverage-tests.cs @@ -512,6 +512,30 @@ public void RuntimePatchesHaveASeparateExactDonorPipeline() Assert.Contains("Test-PatchSyntax", Read("scripts/bootstrap.ps1")); } + [Fact] + public void RuntimeDonorReferenceResolutionPrefersPatchedBuildOutput() + { + // The vanilla donor snapshot holds an unpatched VintagestoryAPI.dll. If + // it is probed before the build output, the Windows donor build loses + // Optimum-only API members (v0.4.1 overlay failure). + string bash = Read("scripts/prepare-runtime-donors.sh"); + string powershell = Read("scripts/prepare-runtime-donors.ps1"); + + int bashOutput = bash.IndexOf("my @dirs = ($ENV{OUTPUT_ROOT},", StringComparison.Ordinal); + int bashDonor = bash.IndexOf("\"$ENV{RUNTIME_DONOR_DIR}/Lib\"", bashOutput, StringComparison.Ordinal); + Assert.True(bashOutput >= 0 && bashDonor > bashOutput, "Bash must probe the build output before the donor directories"); + + Match search = Regex.Match( + powershell, + @"\$searchPaths = @\((?
.*?)\r?\n\s*\)", + RegexOptions.Singleline); + Assert.True(search.Success, "PowerShell search path list is missing"); + string body = search.Groups["body"].Value; + int psOutput = body.IndexOf("$outputRoot", StringComparison.Ordinal); + int psDonor = body.IndexOf("$runtimeDonorDir", StringComparison.Ordinal); + Assert.True(psOutput >= 0 && psDonor > psOutput, "PowerShell must probe the build output before the donor directories"); + } + [Fact] public void RuntimeDonorPreparationUsesProtectedVanillaSnapshot() { diff --git a/scripts/prepare-runtime-donors.ps1 b/scripts/prepare-runtime-donors.ps1 index a3288865..e2ba4f89 100644 --- a/scripts/prepare-runtime-donors.ps1 +++ b/scripts/prepare-runtime-donors.ps1 @@ -378,11 +378,13 @@ function Resolve-ProjectReferences { param([string]$ProjectFile) $text = [IO.File]::ReadAllText($ProjectFile) $projectDir = Split-Path -Parent $ProjectFile + # The patched build output must win over the vanilla donor snapshot, which + # also contains VintagestoryAPI.dll. Matches resolve_references in the .sh. $searchPaths = @( + $outputRoot, (Join-Path $runtimeDonorDir 'Lib'), $runtimeDonorDir, - (Join-Path $runtimeDonorDir 'Mods'), - $outputRoot + (Join-Path $runtimeDonorDir 'Mods') ) # Pass 1: Self-closing references without HintPath $text = [regex]::Replace($text, '