bazelbuild / bazelbuild/rules_rust

crates_repository: how to define a crate twice with a different set of features ?

Open
#1,609 6 comments 1 reaction 0 assignees View on GitHub
bug crate-universe needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

:wave:
Is there a way to define a crate multiple times with a different set of features ?
I tried something like that but it seems that the crate is filtered out.

```
crates_repository(
...
packages = {
"tonic-tls": crate.spec(
features = ["tls"],
package = "tonic",
version = "0.8",
),
"tonic": crate.spec(
version = "0.8",
),
}
)
❯ bazel query @crate_index//... | grep tonic
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
# no more tonic dependency
```
Let me know it it's the right way to do it

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.