macos: honor Cargo target directories in setup and launcher #38
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!38
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/38/head"
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?
@shabouwcaw on GitHub · 2026-11-26 10:53 UTC · original
shabouwcaw:fix/macos-cargo-target-dir→main· +240 −5 · 6 files · 2 commits · merged 2026-11-26 11:10 UTCWhat this changes
A global Cargo
build.target-dirlets setup build successfully outside the checkout, but the launcher still looks undertarget/. It either refuses to launch or silently starts an older executable left there. This addresses the Setup notes in #13, not its separate story-loading stall; it does not close that issue.Both scripts now use a shared resolver based on
cargo metadata --format-version 1 --no-deps --offline, keeping the explicitx86_64-apple-darwin/release/victoryselection. macOS's built-inplutildecodes the JSON path, so no additional runtime dependency is introduced. Metadata/configuration errors stop the scripts; a missing or non-executable file reports the resolved path and setup command. The launcher also returns the child's exit status after printing the log.This follows Cargo's documented absolute
target_directorymetadata field and configuration precedence. Setup and launching must use the same configuration; a one-off build's--target-dirflag is not persisted by Cargo. The launcher now requires Cargo on PATH.How it was tested
The regression runner uses temporary workspaces, an isolated HOME/CARGO_HOME, real Cargo configuration resolution, harmless placeholder input, and fixture executables that record their exact path and argument vector. Custom-directory cases also plant a stale default executable, so launching the wrong file cannot pass. It runs with
/bin/bash(stock 3.2) and is included in a new macOS CI job./bin/bash tools/macos/tests/target-directory.sh: 15 cases pass. Covers default output;CARGO_TARGET_DIRandCARGO_BUILD_TARGET_DIR; global config both with explicit CARGO_HOME and HOME/.cargo; project-relative config and precedence; relative environment paths; spaces and quotes; missing/non-executable output; malformed or unsuccessful metadata and invalid config; exact arguments with/without headless; child exit 37; setup's matching output report and error propagation.nice cargo test -j6 --locked -p victory-shader -p victory-hle -p victory -p victory-gpu -p xtask: passed on native Apple Silicon (502 passed, 4 ignored).nice cargo test -j6 --locked --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: passed under Rosetta, including actual execution of the 16 native-probe tests. Architecture-filtered arm64 tests are not counted as native execution coverage.--all-features, with--workspace --all-targets --locked -- -D warnings: passed.cargo xtask policy, Bash syntax checks for all changed shell files, andgit diff --check: passed.All Rust checks used the sourced local environment,
nice, and at most six build jobs, on the rebased commit after #31 merged. No game was run. Setup's installation/prerequisite commands and expensive release build are stubbed in the script tests; its metadata resolution is real. Full fresh-install setup and real-game launch are not claimed.Upstream CI run 45805580822 passed on
a657417: macOS script regressions (20 s) and the Windows check job (2 m 55 s, both Clippy configurations and full workspace tests).Checklist
docs/native-host.md@LakshanSivakumar on GitHub · 2026-11-26 11:07 UTC · original · approved these changes
Nice, careful work. Resolving through
cargo metadataplusplutilavoids any new dependency, and the stale-binary case is exactly the trap. The 15-case script passes locally under /bin/bash 3.2, and the Rust tests, Windows clippy and policy pass merged with main alongside #39. The CI job addition looks fine.