-
Notifications
You must be signed in to change notification settings - Fork 431
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
Use canonical repo name for aspects #2450
Use canonical repo name for aspects #2450
Conversation
Currently when running `gen_rust_project`, the aspect given to bazel has the canonical repo name but only a single `@`. This does not work with bzlmod, since it tries to resolve this using the repository mappings, and complains that the repository does not exist: ``` ERROR: Unable to find package for @@[unknown repo 'rules_rust~0.38.0' requested from @@]//rust:defs.bzl: The repository '@@[unknown repo 'rules_rust~0.38.0' requested from @@]' could not be resolved: No repository visible as '@rules_rust~0.38.0' from main repository. ERROR: Analysis of aspects '[@@[unknown repo 'rules_rust~0.38.0' requested from @@]//rust:defs.bzl%rust_analyzer_aspect] with parameters {} on //prost:prost_toolchain_impl' failed; build aborted: Unable to find package for @@[unknown repo 'rules_rust~0.38.0' requested from @@]//rust:defs.bzl: The repository '@@[unknown repo 'rules_rust~0.38.0' requested from @@]' could not be resolved: No repository visible as '@rules_rust~0.38.0' from main repository. ``` This adds an extra `@`, so that the repository in the label is of canonical form.
This requires fixing bazelbuild/rules_rust#2450
Thanks! Could you add a test which fails before and passes after this change? We have some tests in https://github.com/bazelbuild/rules_rust/blob/main/examples/bzlmod/hello_world/BUILD.bazel for testing similar things, or can add extra rules_rust/.bazelci/presubmit.yml Lines 641 to 656 in 649b32d
Lines 10 to 11 in 649b32d
bazel run explicitly.
|
Adding a regular bazel test is trickier because |
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.
Thanks!
Now that bazelbuild/rules_rust#2450 is fixed, we can use a `rust-project.json` instead of `Cargo.toml` for IDE features.
Currently when running
gen_rust_project
, the aspect given to bazel has the canonical repo name but only a single@
. This does not work with bzlmod, since it tries to resolve this using the repository mappings, and complains that the repository does not exist:This adds an extra
@
, so that the repository in the label is of canonical form.Fixes #2449