bazelbuild / bazelbuild/rules_rust

Unable to pass apparent repo labels to `crate.annotation` attributes

Open
#2,736 3 comments 12 reactions 0 assignees View on GitHub
crate-universe
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

Take for example this annotation:

```
crate.annotation(
crate = "pyo3-build-config",
build_script_data = [
"@python_3_11//:files",
"@python_3_11//:python3",
],
build_script_env = {
"PYO3_PYTHON": "$(execpath @python_3_11//:python3)",
},
)
```

This annotation fails because `@python_3_11` isn't visible to the rules_rust repo (although it is visible to the root repo). One might expect that `build_script_data` is a `label_list`, and that Bazel would automatically handle apparent-to-canonical repo name conversion when passing a label. But it's actually a [string_list](https://github.com/bazelbuild/rules_rust/blob/b3fe74cc97305908d67f9deb5f5a16b28667423d/crate_universe/extension.bzl#L14-L19).

The only work around I've found so far is to hard-code canonical labels which isn't ideal. If `build_script_data` must be a `string_list`, maybe there could be a separate `build_script_data_labels` attribute?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.