Rust rewrite of Tinder's bazel-diff, designed as a drop-in CLI and output compatible replacement with faster, traced, async execution and first-class Bazel 8/9 bzlmod support.
- Drop-in compatibility:
generate-hashesandget-impacted-targetsmatch the upstream jar byte-for-byte on WORKSPACE andMODULE.bazelfixtures, including fine-grained external repo hashing and dep-edges output. - Bzlmod ready: canonical repo names with trailing
+are preserved,@@labels hash identically to upstream, and pure bzlmod workspaces (no//external) are handled. - Modern Rust pipeline: async Bazel invocations, streamed proto decoding, deterministic hashing, structured
tracingoutput, and optional verbose logging via-v/RUST_LOG. - Tests and tooling: nearly 600 Rust tests plus a parity harness against the upstream jar,
cargo-nextestwith timeouts (nextest.toml), and GitHub Actions validated withact.
just build # cargo build --workspace
just nextest # runs the full suite with timeouts
just build-upstream-bazel-diff
just integration-tests- The upstream jar lives at
target/upstream/bazel-diff_deploy.jarand is built from thevendor/bazel-diffsubmodule.just build-upstream-bazel-diffautomates this. - Local CI:
just act-ci(uses theghcr.io/catthehacker/ubuntu:act-latestimage; set--container-architecture linux/amd64on Apple silicon). - No system
protocis required; the prost build usesprotoc-bin-vendoredduring compilation.
bazel-differrous generate-hashes \
-w /path/to/workspace \
--bazelPath bazelisk \
--bazelCommandOptions=--enable_workspace \
--includeTargetType \
--fineGrainedHashExternalRepos @@depmod \
--contentHashPath content_hashes.json \
--seed-filepaths seed_files.txt \
--modified-filepaths modified_files.txt \
-d dep_edges.json > hashes.json- Supports
--useCquery,--excludeExternalTargets,--ignoredRuleHashingAttributes,--fineGrainedHashExternalRepos[File],--seed-filepaths,--contentHashPath,--modified-filepaths, and--targetType/-ttexactly like the Java tool. - Outputs hash JSON (and optional dep-edges JSON) identically to
bazel-difffor both legacy WORKSPACE and bzlmod projects.
bazel-differrous get-impacted-targets \
-sh starting.json -fh final.json \
[-d dep_edges.json] \
[--targetType Rule,SourceFile] \
[-o impacted.json]- Without
-d, emits newline labels; with dep-edges it emits JSON with distance metrics, matching upstream ordering and exit codes.
cargo nextest run --workspaceexercises ~600 unit/property tests (label normalization, hashing edge cases, bzlmod canonical names) plus integration tests; timeouts are configured innextest.toml.- Parity harness (
crates/integration-tests) runs the Rust CLI and the upstream jar with identical flags and compares stdout/stderr/exit codes byte-for-byte on WORKSPACE and MODULE fixtures. Tests skip automatically if the jar is absent. - GitHub Actions workflow
.github/workflows/ci.ymlmirrors theJustfiletargets and is validated locally withact.
-vorRUST_LOG=debugenables detailed tracing spans; outputs remain stable for parity tests.- Binaries are compatible with standard profilers (
perf,cargo flamegraph,tokio-console) without rebuild flags.
crates/core: hashing engine, Bazel adapters, impact diff logic, and label/attribute normalization.crates/cli: Clap-based CLI wiring, tracing init, and file I/O.crates/proto: prost-generated Bazel streamed proto types.crates/integration-tests: parity harness and fixtures.tests/fixtures+tests/golden: shared fixtures and captured upstream outputs.vendor/bazel-diff: upstream submodule used for goldens and behavioral reference.
This project builds directly on the ideas and formats from the upstream bazel-diff authors at Tinder/Match Group and the wider Bazel community. See CREDITS.md for acknowledgements and licensing details.