fix(setup): locate fbuild binary via cargo --message-format=json#458
Conversation
|
Warning Review limit reached
More reviews will be available in 13 minutes and 16 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. 📝 WalkthroughWalkthroughThe PR strengthens ChangesFbuild Binary Discovery
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3d1a743 to
3464d1c
Compare
`pip install .` failed on every Windows dev install where soldr sets
`CARGO_BUILD_TARGET=<host-triple>` (the default for this repo):
ERROR: cargo build succeeded but binary not at
C:\Users\niteris\dev\fbuild\target\release\fbuild.exe.
Cargo had written the binary to
`target/x86_64-pc-windows-msvc/release/fbuild.exe`, but `setup.py`
hard-coded `target/release/fbuild.exe` as the only place it would
look.
Switch to `cargo build --message-format=json-render-diagnostics`,
walk the structured artifact stream, and pull the real `executable`
path out of the compiler-artifact line. That's the same mechanism
`cargo install` uses and it works regardless of the target-dir
layout (host-triple, custom profile, custom CARGO_TARGET_DIR).
Falls back to searching `target/release/` and every
`target/<triple>/release/` subdir when cargo's JSON stream is empty
(e.g. a fully-cached `Fresh` run that skips emitting artifact
messages on stdout).
Verified locally on Windows: `uv run python -c "import fbuild"`
now succeeds during `uv pip install`, the binary lands in
`ci/bin/fbuild.exe`, and `fbuild --version` prints `fbuild 2.2.19`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3464d1c to
3368f01
Compare
Summary
Drives cargo with
--message-format=json-render-diagnosticsand pulls the binary path out of the structured artifact stream — the same mechanismcargo installuses. Works regardless of how cargo lays out its target dir.Relation to #461
PR #461 already shipped a fix for the same bug (filesystem probe of
target/release/+ everytarget/<triple>/release/subdir, max-mtime tiebreak). This PR is rebased on top of that merge and replaces the filesystem probe with the JSON-stream approach. Both fix the original "binary not at target\release\fbuild.exe" failure. This PR is materially more robust against:CARGO_TARGET_DIR— env-driven override, doesn't sit anywhere under the repo'starget/tree at all.--profile dist, etc.) — output dir becomestarget/<triple>/<profile>/, which the mtime-tiebreak filesystem probe in fix(setup.py): locate cargo binary under target/<host-triple>/release/ #461 can't see.The filesystem probe survives as a fallback for the cached-
Freshedge case where cargo doesn't emitcompiler-artifactmessages on stdout. So this PR is strictly a superset of #461's behaviour.What changed
cargo build --release -p fbuild-cli --message-format=json-render-diagnostics.compiler-artifactwithtarget.name == "fbuild"and a non-nullexecutablefield.Test plan
uv pip installsucceeds where the originaltarget/release/<bin>check failed.ci/bin/fbuild.exeas expected by the wheel packaging step.fbuild --versionfrom the newly-installed venv printsfbuild 2.2.19.🤖 Generated with Claude Code