You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by tthebst April 28, 2023
I'm trying to compile tokio with --cfg tokio_unstable with rust rules. This works fine by adding it in the crate.annotations rustflag options. It also seems to get picked up by when compiling because I see that the compiler invocations have (bazel build -s --config local @crate_index//:tokio). But when compiling I get an error use of undeclared crate or module tracing indicating that the tracing dependency was not added when compiling. In the bazel lock file I see this:
I don't believe crate_universe knows anything about configurations when it resolves dependencies. So the select statement can never be matched. Similar to @rules_rust//crate_universe/src/context/platforms.rs, I would expect a resolve_cfg_rustc_flags that goes through annotations and finds cfg flags that can be used to enable or disable features. I don't think there will be a way to dynamically enable and disable the dependencies per bazel invocation. Would you be willing to convert this to an Issue? I'd be happy to collaborate on a pull request as well if you'd be open to working on this feature 😄
Enable support for the selection of conditional compilation dependencies.
Discussed in #1947
Originally posted by tthebst April 28, 2023
I'm trying to compile tokio with
--cfg tokio_unstable
with rust rules. This works fine by adding it in thecrate.annotations
rustflag options. It also seems to get picked up by when compiling because I see that the compiler invocations have (bazel build -s --config local @crate_index//:tokio
). But when compiling I get an erroruse of undeclared crate or module tracing
indicating that the tracing dependency was not added when compiling. In the bazel lock file I see this:How can I instruct bazel to add the tracing dependency when compiling?
I will try to come up with a small repro for this.
Reproduce:
WORKSPACE.bazel
Compile tokio
The text was updated successfully, but these errors were encountered: