Open cceckman opened 3 years ago
(XRef #262 / @UebelAndre , as that seems to be the main FR / contributed for workspace support - thanks for your efforts so far!)
OK; yeah, it's user error. Fixed (kind of) in https://github.com/cceckman/raze-bug/tree/fixed.
I had read "workspace_path
" as "this Cargo.toml's relative path to the root"; when it's actually "where to put (some of) the generated files".
I'm not in the right circadian cycle to think about doc updates for this, but may be able to tomorrow. Sorry for the noise >.<
Yeah, workspace_path
is "where to put the outputs relative to the bazel workspace root. It's not limited to the path to the Cargo.toml
file. Maybe in addition to updating the docs, the naming of it can be updated too. workspace_path
doesn't feel like it communicates enough. Any suggestions (question open to everyone 😄)?
output_path
, maybe?
Minimal (maybe) demo in https://github.com/cceckman/raze-bug.
TL;DR It seems that "Bazel workspace root" == "Cargo workspace root" doesn't work;
cargo raze
generates a label that begins///
, which is not valid in Bazel.Is this: a) working as intended; b) a bug; c) not actually the case, and instead I've done something wrong? (Entirely possible! :-) )
This setup in https://github.com/cceckman/raze-bug is:
//
is a Bazel workspace and a Cargo workspace (and, incidentally, the Git root)Cargo.toml
has aworkspace.metadata.raze
section,workspace_path = "//"
//alib
is a Cargo cratenum_enum
)rust_library
andrust_test
rulesThe error:
(Same error from
bazel build //alib:alib
.)Versions used in
VERSIONS
file there - it'sHEAD
ofrules_rust
and0.8.0
ofcargo raze
.If I'm reading right- and I may not be - this line comes from remote_crates.bzl.template; here at the version of
cargo raze
used in my test, but still here at HEAD. The formatting there seems to assume that the relative path is not "the root of the repository".The "smoke tests" don't seem to exercise this condition:
So:
1) Is this analysis correct (this is a bug and the cause)? (If not - please point me in the right direction and thanks for the help :-) ) 2) Is there way to add a test for this? (I haven't looked much at the test infrastructure here.) 3) What's the right fix for this?