feat(builder)!: build and play share one path, the launcher owns updates, and the fast check stops rebuilding #2762
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!2762
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:feat/builder-cli-v2"
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
longshot-builder's command line, made simpler as decided for launcher v2 (a clean break: protocol 2, no compatibility
shims), and its "is a rebuild needed?" check made stable.
One routine.
build_driver::play::ensure_builtis whatbuildandplayboth run: the fast check, then a build,a rebuild, the shaders' preparation alone, or nothing when the folder is current.
build --profile Pis that routine;play --profile Pis that routine (the same JSON events during a rebuild) and then the game. With no arguments, or asLongshot.exe/Longshot.x86_64, it plays.The profile holds the settings. profile.json carries the copy, the upscalers, the accepted licences and now
"language"and"prepare_shaders".build --profile P [--game ..] [--upscaler ..] [--language ..] [--accept-licenses ..] [--prepare-shaders on|off]writes what it is given into it, then builds (this is howRecompLauncher's prepare step and the launcher's first build set a profile up: one command).
playtakes no settings.--profiletakes a launcher profile id (default,p-<8 hex>, resolved throughlauncher-instance.jsonbeside theprogram) or a folder;
--profile-idis gone.Removed:
update(andbuild::update_options: a rebuild of a folder built before keeps its language unless theprofile names one, and still drops an upscaler whose licence is no longer accepted with
upscaler_dropped; its timesare still kept as "update"),
self-updatewith play's background check and--no-self-update,steam-shortcutwiththe
steamcrate and its event (the launcher owns Steam shortcuts), and the stage commandlift(dev liftis thelifter's).
Places from the environment. Player commands take no
--cache,--store,--work,--root,--ngx-sdk,--builder-exeor--log:LONGSHOT_CACHE,LONGSHOT_STORE,LONGSHOT_SHADER_STORE,LONGSHOT_ROOT, ... as thelauncher's
Builder::commandsets them.modloses--cachetoo.dev.dev build(the profile-less build, with its places),dev image,dev index,dev compile,dev prepare,dev share,dev sources,dev stamps,dev storage, beside the lifter'sdevcommands.--output jsonmeans: events alone on stdout, no window of the builder's, and play gives the game its launcherstart-up; the builder no longer reads
LONGSHOT_LAUNCHER_STARTUP(it still sets it for the game).infosays"protocol": 2, the one number a launcher checks.One at a time.
build --profiletakes the profile's lock as play does: a build while a play of the same profilebuilds or runs (or another build) stops at once with
profile_in_use(exit 123); two profiles sharing a work folder arekept apart by the work folder's lock (
work_folder_busy).The new command line
Why it rebuilt or prepared shaders when nothing changed
Each cause on
main, and what this does about it (game-free tests for each, written, not run:build_driver::play::tests::a_build_is_current_for_the_next_check_by_any_path_and_with_preparation_off,ensure_built_builds_only_when_the_check_says_so,build_driver::shaders::tests::a_failed_preparation_is_not_retried_for_the_same_inputs):builder/crates/longshot-builder/src/main.rs:437-444(build_cmd):build --profilenever asked the fast check: asecond
buildstraight after a successful one ran the whole build again (lift and compile checks, the romfs, theswap, the shader check). Now it is
ensure_built: nothing when current.builder/crates/build-driver/src/play.rs:387-391(game_stamp): the copy's stamp held its device and inode. Bothchange with no change to the file (a btrfs subvolume's or a removable drive's device number at each mount; exFAT,
NTFS-3G or network drives' made-up inodes), so the first play after a reboot or a remount built the game again. Now
size and write time.
builder/crates/build-driver/src/play.rs:218(Profile::key): the copy's path was the absolute one as reached, sothe same profile reached by another path (a relative
--profile, a symbolic link, the launcher's id against itsfolder) was "the profile's game files changed". Now the canonical path.
builder/crates/build-driver/src/play.rs:527withshaders.rs:683(would_prepareasks withasked = true): aprofile built with preparation off had never-prepared shaders, a
Shadersreason at every start, and a rebuild thatagain did not prepare them, forever. Now the profile's
prepare_shadersis passed in and honoured.builder/crates/build-driver/src/shaders.rs:728-733andbuild.rs:781-786: a preparation that failed (thesupervisor's bounds, a driver fault, a cache it could not open) recorded nothing, so
would_preparesaid "prepare"at every start and each start rebuilt to fail the same way. Now the failure is noted with its inputs' key
(
cache/longshot_prepare_failed_key.txt), and the check skips it until the driver, the renderer, the shader list orthe level changes (the game prepares what it needs at its first start, as with preparation off); a success removes
the note.
builder/crates/build-driver/src/play.rs:683-686: aShadersreason (a new driver, another GPU) ran a whole buildto prepare shaders. Now
BuildOptions::shaders_only: the preparation alone, under the same locks.builder/crates/build-driver/src/shader_cache.rs:19-31(store_dir): withLONGSHOT_SHADER_STOREunset, thecheck looked for the preparation's receipt in the old per-user folder (
~/.cache/longshot/shaders,%LOCALAPPDATA%\Longshot\shaders), whileconfigure_storegave the game the cache'sshader-store, the placethe launcher also sets. A direct start (a terminal, Steam's shortcut to
Longshot.x86_64) never found the receiptand prepared again. The check now uses the same store as the game (
shaders::shader_store); the old folder isonly looked at as a legacy location. Test:
shader_cache::tests::the_receipt_s_store_is_the_game_s_when_none_is_named.builder/crates/build-driver/src/shaders.rs(linux_drivers): the driver id includedVK_DRIVER_FILES,VK_ICD_FILENAMES,VK_ADD_DRIVER_FILESandXDG_DATA_DIRS's manifests, so an AppImage, Flatpak or Steam runtimegave another id and starts from two environments prepared in turn. It now keys on what the PC has: the manifests
of
/etc,/usr/local/share,/usr/shareand~/.local/share, their libraries, NVIDIA's version, and each GPU'svendor, device, kernel driver and module version (no Vulkan call).
Read first:
build_driver::play::ensure_built(play.rs),longshot-builder'sparseandbuild_cmd(main.rs),play::resolve_profile(longshot-builder play.rs).Testing
Tested: nothing was run: no tests, no game, no job queue (as asked; this PR is opened with
--force).cargo check,cargo clippy --workspace --tests(no warnings) andcargo fmton the Rust;python -m py_compileon the changedscripts and tests. The game-free tests above and the updated ones (main.rs, play.rs, info.rs, tests/cli.rs,
tests/one_copy.rs, build-driver/tests/driver.rs, tests/test_dev_update.py, test_dev_build.py, test_dev_packs.py) are
written, not run.
Still to test:
mise run testand the Rust tests, expecting them to pass (by hand)longshot-builder build --profile <p> --game <nup>twice: the second printsfast check: currentand adoneof 0 s, no compile, no shader stage; thenplay --profile <p>starts the game at once (by hand)--prepare-shaders off, thenplaytwice: no rebuild (by hand)playwith no arguments asLongshot.exe, and RecompLauncher's prepare line (build --game .. --profile .. --output recomplauncher --upscaler ..), expecting a build and the game (@Beanstalkonce its agent speaks protocol 2)dev.py packs base/pack/rtanddev.py update, expecting the same builds as before throughdev build(by hand)Measurements
Nothing to measure: a command line and a check that now skips work it repeated; no game code changes.
Risks
~/Projects/LongshotLauncher,origin/main):src/game/versions.rs:529-549(play with--profile-id, or--profile .. --cache .. --no-self-update --upscaler ..),src/game/wizard.rs:897-915(buildwith
--cache/--builder-exefromconfigure(),src/game/process.rs:207-216),src/game/process.rs:83-88(mod--cache),src/game/releases.rs:656-664(from-source--cache),src/game/sharing.rs:122-124(perf-report--cache),src/game/steam.rs:84-89(steam-shortcut, removed), and theLONGSHOT_LAUNCHER_STARTUPit sets(
versions.rs:542, now ignored:--output jsondecides). It should readinfo'sprotocoland refuse anything but2.
check,info --profile,verify --out,extract-romfs,fetchare unchanged.agent/Core/WorkspaceBuilder.cs:479(check --game .. --cache ..:--cacherefused) and:951-952(build --game --out --work --store --root --cache --language --no-prepare-shaders: nowdev build).Its dev.py packs runs keep working (dev.py inserts
dev).release rebuilds anyway.
start as it does with preparation off.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (not run on this PC, as asked)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. (written for each cause; not run, so not shown failing onmain)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
WIP: feat(builder)!: build and play share one path, the launcher owns updates, and the fast check stops rebuildingto feat(builder)!: build and play share one path, the launcher owns updates, and the fast check stops rebuildingdev compile, and a failure there says what the builder said #2774