WIP: fix(builder): Windows: an unchanged link is not run again: a drive's colon is no option's separator #2835
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2835
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/mod-api-win-relink"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
For #2822 (into
mod-api). On Windows, every build links the game and the renderer again, even when nothing changed.link::run(builder/crates/build-compile/src/link.rs) skips a link whose inputs, outputs and key are as the last link left them. Its key comes fromlink_inputs, which also looks for a file named inside an option, after the option's first:or=(/map:<file>,--symbol-ordering-file=<file>). A whole Windows path's drive was taken for such a separator:-o C:\…\longshot-game.exegave\…\longshot-game.exe. That's the last link's own output under another name, so it went into the key, the key changed at every link, and no link was ever found unchanged. This makesoption_valuetake the first=, or a:that is not a drive's (a letter alone before it, a separator after it)./map:C:/xstill givesC:/x. Linux's paths hold no drive, so Linux is unchanged.To see it on
mod-api: Windows,dev.py packtwice with nothing changed. The second still sayslinked …longshot-game.exe: 911 MBandlinked …longshot_vk.dll.Read first:
option_valueandlink_inputsinbuilder/crates/build-compile/src/link.rs.Testing
Tested: Windows 11, RTX 5080, NVIDIA 621.40.
mise run dev -- pack --own-worktwice in a row on the PC's shared base, the second with 0 of 884 units to compile. Withmod-api's builder the second pack linked the game (911 MB, 5 s) and the renderer (1 s) again. With this branch's builder it saidnot linked againforlongshot-game.exe,longshot_vk.dllandlongshot_nvngx.dll_nr.dll.longshot-builder gamewith a profile: the AppContainer, the builder's channel, Skip title screen and the profile's mods started, and it played until the run's time limit.Checks:
link::tests::the_output_is_not_an_input_whatever_its_path_holdsfails onmod-api@eaf4a48bon Windows (the output among the inputs as\Users\…\x.exe) and passes here.tests/compile_link.rs's program is nowprog.exeon Windows, the file the link writes. It used to linkprog, solink::runnever found its output.an_unchanged_rebuild_compiles_nothing_and_a_change_compiles_what_it_touchesthen fails onmod-apion Windows ("and links nothing") and passes here: 4 of 4.an_options_value_is_after_its_separator_never_a_drives_colonchecks the separator's cases on every OS.cargo test -p build-compile --lib --test compile_linkpasses: 67 and 4. On Windows allbuild-compilelib tests pass buttoolchain's, which fails onmod-apitoo and which #2834 fixes.cargo fmt --checkandmise run lintpass.cargo clippy -p build-compile --all-targets --no-deps -- -D warnings(Windows target) reports onlymod-api's ownbuildserror, which #2830 fixes.Still to test:
dev.py packin a row with nothing changed, expectingnot linked againfor the game as before (@Beanstalk: an unchanged rebuild on Linux links nothing)Measurements
Verdict: an unchanged build on Windows links nothing. It took 6 s instead of 12 s here, the game's 911 MB link not made.
Baseline:
mod-api(#2822's head), the branch this PR goes into: the bug is there, not onmain.Setup: Windows 11, Ryzen 9 9900X3D, RTX 5080, the PC's shared base
3ab4db6e,mise run dev -- pack --own-workof the same tree twice in a row with each builder. The second pack's lines and its total, one run each: a link is either made or not, and the time is the build's own report.eaf4a48b328cfce6longshot-game.exelongshot_vk.dlllink::tests::the_output_is_not_an_input_whatever_its_path_holds, Windowscompile_link'san_unchanged_rebuild_…, WindowsRisks
The sandbox: not touched. This is the builder's link step on the developer's or player's PC, before any game runs. The game it builds is confined as before.
A link is skipped only when its key, linker, outputs and the files it read all match the last link's, as before; the key just no longer holds the output itself. A file named inside an option after a drive's colon (none of the builder's commands has one) is no longer taken as an input. A revert is enough. Players on Windows see a rebuild with nothing to compile finish sooner.
Checklist
Ready for review
mod-api(#2822's head); the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (The checks this change reaches pass, apart fromtoolchain's on Windows, which fails onmod-apitoo, as above.mod-api's whole suite has other failures on Windows that this PR doesn't change.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. (It fails onmod-api, where the bug is.)tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
link::tests::the_output_is_not_an_input_whatever_its_path_holds: a link whose output exists (the last link's) and an ordering file inside an option; the inputs must be the ordering file alone. It fails on mod-api on Windows: link_inputs looks for a file after an argument's first ':' or '=', and a whole path's drive (C:/w/x.exe) gives /w/x.exe, the output itself under another name, which then is in the link's key and changes it at each link. tests/compile_link.rs's program is prog.exe on Windows, the file the link writes (it linked prog, and link::run looked for prog): an_unchanged_rebuild_compiles_nothing_and_a_change_compiles_what_it_touches then fails on Windows for the same reason ("and links nothing"). Assisted-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>Tested in the game: Windows 11, RTX 5080, NVIDIA 621.40: a builder built from this branch (with #2726's broker change applied locally beneath it) started the game confined through
longshot-builder gamewith a profile: the AppContainer,mods: the builder's channel is open (31 ops), Skip title screen and the profile's mods started, and it played until the run's time limit. Its builds: an unchangeddev.py packsaysnot linked againfor longshot-game.exe and longshot_vk.dll (mod-api's builder linked both again).Risks now says how this change stands with the sandbox (what it touches, and why the confined game reaches nothing more).
2007ad2473dc9c50f1b4Rebased onto mod-api's newest (
4cc50ca1: main's newest merged in), with no conflict; this PR's own checks were run again on the rebased head and pass as before. The merge touched none of this PR's files (#2827: only a comment in host/hos_main.c, far from its change), so the measurements and runs above hold; the After commit is the rebased head.dc9c50f1b4b8d070bb6fRebased onto
mod-api@816d2354(#2837, headless shots of the mods' UI), nowb8d070bb. No conflict, and the diff is the same as before (samegit patch-id). #2837 touches none of this PR's files.b8d070bb6f356ff56a95356ff56a95328cfce6d8Rebased onto
mod-api@c5e5b676: it was re-squashed onto main @46291934(#2833) twice today (cdbb8551, thenc5e5b676), which made this PR show main's and the whole mod API's diff. Now328cfce6, the same diff as before (samegit patch-id), no conflict. The changes underneath touch none of this PR's files, so its checks still hold.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.