feat: add Cargo-style rust_crate and reusable test suites - #217
Draft
dzbarsky wants to merge 2 commits into
Draft
Conversation
dzbarsky
force-pushed
the
codex/cargo-style-rust-crate
branch
from
August 13, 2026 23:30
ad04258 to
c0db9dc
Compare
dzbarsky
changed the base branch from
main
to
codex/move-generated-rust-crate-private
August 13, 2026 23:31
dzbarsky
force-pushed
the
codex/cargo-style-rust-crate
branch
from
August 13, 2026 23:55
c0db9dc to
0343b28
Compare
dzbarsky
changed the base branch from
codex/move-generated-rust-crate-private
to
main
August 13, 2026 23:55
dzbarsky
commented
Aug 13, 2026
| caller_rustc_env = kwargs.pop("rustc_env", {}) | ||
| caller_env = kwargs.pop("env", {}) | ||
|
|
||
| rustc_env = dict(cargo_binary_env) |
Member
Author
There was a problem hiding this comment.
just do rustc_env = cargo_binary_env | rustc_env and add it to kwargs with default of {}? Same with the other ones
dzbarsky
commented
Aug 13, 2026
| rust_crate( | ||
| name = "my_crate", | ||
| aliases = aliases(), | ||
| deps = all_crate_deps(normal = True), |
Member
Author
There was a problem hiding this comment.
drop normal = True, we don't need that! actually can this just take a dep_data struct like DEP_DATA creates?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a public
@rules_rs//rs:rust_crate.bzlmacro that infers Cargo libraries, binaries, build scripts, library and binary unit tests, and integration tests. Expose independently reusablerust_unit_test_suiteandrust_integration_test_suitehelpers, and re-export the upstream-compatiblerust_test_suiterequested in #193.The existing generated-dependency
rust_crateimplementation was moved tors/private/rust_crate.bzlin #218.The new Cargo workspace fixture covers binary-only packages, default and hyphenated binaries, nested binary and integration-test roots, shared test modules, normal/development/build dependency separation and overlap, build-script helper modules,
CARGO_PKG_NAME,CARGO_PKG_VERSION, and compile-time/runtimeCARGO_BIN_EXE_*.Validation
bazel test --config=remote //rust_crate/...intest/: 15 tests passed.//rs/private:all: 42 tests passed.buildifier -mode=check,rustfmt --check, andgit diff --checkpassed.Full-suite validation on this macOS checkout encounters pre-existing local conditions: an ignored
test/targetdirectory is interpreted as a missing@targetrepository, and an unrestricted root remote run selects a macOS executable on Linux workers. Focused and existing private regression suites pass.