From b753830877a65617c47e9b05c65e3b0dcba3522b Mon Sep 17 00:00:00 2001 From: Zaldaryon <273555259+Zaldaryon@users.noreply.github.com> Date: Fri, 20 Nov 2026 13:53:58 -0300 Subject: [PATCH 1/2] fix(release): probe patched build output first in Windows runtime donor build The Windows donor script searched the vanilla donor snapshot before bin/Release, so Resolve-ProjectReferences replaced the patched VintagestoryAPI.dll hint with the unpatched one and VSSurvivalMod failed to compile in the v0.4.1 overlay run. Match the bash script's order and add a regression test. --- .../installer-release-coverage-tests.cs | 24 +++++++++++++++++++ scripts/prepare-runtime-donors.ps1 | 6 +++-- 2 files changed, 28 insertions(+), 2 deletions(-) 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, '