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
I've just upgraded the rules from 0.30.0 in WORKSPACE to 0.54.1 in bzlmod, on Windows 11. My project does not compile anymore.
The problem is that all_crate_deps does not list workspace siblings, whereas it used to.
I've set up a minimal reproducible example at https://github.com/KoltesDigital/bazel-rust-workspace-members . It's basically a library and a binary, the latter depends on the former. But <output_base>/external/rules_rust~~crate~crates/defs.bzl has the following:
...
################################################################################ WORKSPACE MEMBER DEPS AND ALIASES###############################################################################_NORMAL_DEPENDENCIES= {
"mybin": {
},
"mylib": {
},
}
...
which means all_crate_deps in mybin/BUILD does not declare a dependency to mylib, and thus build fails.
The workaround is to manually add + ["//mylib:library"] to mybin/BUILD.
It used to work, but now that I've written the previous sentence, I'm wondering whether it was working by mistake and was never intended to. I don't know any way for crate_universe to know the precise target name of a library in the user project.
So, is the workaround the actual way to go? If so, you may consider integrating my example into examples/bzlmod to let people know.
Update: well... even the workaround doesn't work. Build still fails! What should I do?
Update 2: workaround works when targets are named exactly like the crates. Check branch works out.
The text was updated successfully, but these errors were encountered:
I've just upgraded the rules from 0.30.0 in WORKSPACE to 0.54.1 in bzlmod, on Windows 11. My project does not compile anymore.
The problem is that
all_crate_deps
does not list workspace siblings, whereas it used to.I've set up a minimal reproducible example at https://github.com/KoltesDigital/bazel-rust-workspace-members . It's basically a library and a binary, the latter depends on the former. But <output_base>/external/rules_rust~~crate~crates/defs.bzl has the following:
which means
all_crate_deps
in mybin/BUILD does not declare a dependency tomylib
, and thusbuild
fails.The workaround is to manually add
+ ["//mylib:library"]
to mybin/BUILD.It used to work, but now that I've written the previous sentence, I'm wondering whether it was working by mistake and was never intended to. I don't know any way for
crate_universe
to know the precise target name of a library in the user project.So, is the workaround the actual way to go? If so, you may consider integrating my example into examples/bzlmod to let people know.
Update: well... even the workaround doesn't work. Build still fails! What should I do?
Update 2: workaround works when targets are named exactly like the crates. Check branch
works
out.The text was updated successfully, but these errors were encountered: