crate_universe: build.rs script causes erroneous alias record

Open
#4,053 2 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
build-system

Research direction

Start with the :crates_vendor entry point and reproduce the issue using the linked cargo-bazel reproducer, then inspect the generated BUILD.bazel for alias records for workspace-internal crates with build.rs scripts. Done means running :crates_vendor no longer emits an alias for that workspace crate and the generated dependency information no longer breaks the build.

Written by the indexing model from the issue text.

Description

crate-universe

Description
In a repository using cargo_bazel for vendored crates.io dependencies, a workspace-internal crate with a build.rs script causes the :crates_vendor utility to emit an alias for it, breaking the build due to bad dependency information. Because the crate is a workspace member, and not an external dependency, no alias record should be written.

Reproduction steps
Include a workspace crate with a build.rs script, and run :crates_vendor. Inspect the generated BUILD.bazel and observe the alias records for that crate.

Reproducer repository: https://github.com/matx-patrick/cargo-bazel-repro

Impact
We have worked around this with the patch shown in the reproducer repo.

Bazel and rules_rust version
rules_rust: 0.70.0
Bazel: 9.1.0

Dominant language
Starlark
Stars
857
Forks
701
Avg merge
4d 7h
Merged PRs (30d)
46

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bazelbuild/rules_rust

All issues in bazelbuild/rules_rust

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.