-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't emit CrateInfo
from rust_static_library
and rust_shared_library
#1298
Don't emit CrateInfo
from rust_static_library
and rust_shared_library
#1298
Conversation
DefaultInfo( | ||
# nb. This field is required for cc_library to depend on our output. | ||
files = depset(outputs), | ||
runfiles = runfiles, | ||
executable = crate_info.output if crate_info.type == "bin" or crate_info.is_test or out_binary else None, | ||
), | ||
] | ||
|
||
if crate_info.type in ["staticlib", "cdylib"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This confuses rule type with crate_info.type
, and breaks rust_binary(crate_type="cdylib")
which we use when building WebAssembly targets (due to a missing first-class support for rust_wasm_binary()
):
[...]
ERROR: /tmp/proxy-wasm-cpp-host/test/test_data/BUILD:45:17: in rust_binary rule //test/test_data:_wasm_env_wasm:
.../external/rules_rust/rust/private/rust.bzl:295:5: rule advertised the 'CrateInfo' provider, but this provider was not among those returned
ERROR: /tmp/proxy-wasm-cpp-host/test/test_data/BUILD:45:17: Analysis of target '//test/test_data:_wasm_env_wasm' failed
ERROR: Analysis of target '//test/test_data:env.wasm' failed; build aborted:
[...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PiotrSikora Sorry about the breakage 😞
can you create a separate issue for this? It'd then be good if you could provide a local repro case or maybe just open a PR if you've already got a solution in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a fix (#1315), but local repro is tricky due to a use of custom rule and transition to force build for Wasm.
Broken in bazelbuild#1298. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
These rules emit a
staticlib
andcdylib
which are not meant for consumption by other rust targets.However, one should still be able to write a
rust_test
forrust_shared_library
andrust_static_library
targets, which needs aCrateInfo
. For this purpose we provide aCrateInfo
wrapped in aTestCrateInfo
provider, thatrust_test
understands.