Repository navigation
fix: build --lib only for .rlib targets to skip harness binaries #1397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -172,7 +172,14 @@ build_repo() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "$build_dir/Cargo.toml" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (cd "$build_dir" && cargo +nightly build --release 2>&1); then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # If the target is a .rlib, only build the library (avoids compiling all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # test/harness binaries in large workspaces like frankensqlite). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local cargo_flags="--release" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local expanded_bin="${binary_path/#\~/$HOME}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ "$expanded_bin" == *.rlib ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cargo_flags="--release --lib" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (cd "$build_dir" && cargo +nightly build $cargo_flags 2>&1); then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using an array for You might also consider supporting other library extensions like
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local cargo_flags="--release" | |
| local expanded_bin="${binary_path/#\~/$HOME}" | |
| if [[ "$expanded_bin" == *.rlib ]]; then | |
| cargo_flags="--release --lib" | |
| fi | |
| if (cd "$build_dir" && cargo +nightly build $cargo_flags 2>&1); then | |
| local cargo_flags=(--release) | |
| local expanded_bin="${binary_path/#\~/$HOME}" | |
| if [[ "$expanded_bin" == *.rlib ]]; then | |
| cargo_flags+=(--lib) | |
| fi | |
| if (cd "$build_dir" && cargo +nightly build "${cargo_flags[@]}" 2>&1); then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: This change removes the literal cargo +nightly build --release string from the script, which will break the existing test in spec/update_local_binaries_spec.sh that uses grep to match that exact command. The spec needs to be updated to account for the new $cargo_flags variable (and ideally assert the --lib behavior for .rlib targets).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/update-local-binaries.sh, line 182:
<comment>This change removes the literal `cargo +nightly build --release` string from the script, which will break the existing test in `spec/update_local_binaries_spec.sh` that uses `grep` to match that exact command. The spec needs to be updated to account for the new `$cargo_flags` variable (and ideally assert the `--lib` behavior for `.rlib` targets).</comment>
<file context>
@@ -172,7 +172,14 @@ build_repo() {
+ if [[ "$expanded_bin" == *.rlib ]]; then
+ cargo_flags="--release --lib"
+ fi
+ if (cd "$build_dir" && cargo +nightly build $cargo_flags 2>&1); then
return 0
else
</file context>
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change replaces the literal cargo +nightly build --release command with cargo +nightly build $cargo_flags, which will break the existing shell spec that greps for cargo +nightly build --release (see spec/update_local_binaries_spec.sh). Update the spec to assert the new behavior (including the new --lib case for .rlib targets) rather than matching the old hard-coded command string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will cause the test at line 166 of
spec/update_local_binaries_spec.shto fail. The test usesgrepto look for the literal stringcargo +nightly build --releasein the script, which no longer exists in that form. Please update the test suite to accommodate this change.