Closed martijneken closed 1 month ago
See these docs. I've confirmed that adding the src/lib.rs placeholder file allows Bazel rules_rust to generate rust_binary targets:
src/lib.rs
rust_binary
Example Cargo.toml:
[package] edition = "2018" name = "wasmsign-bazel" version = "0.1.2" [lib] path = "fake_lib.rs" [dependencies] wasmsign = {git = "https://github.com/jedisct1/wasmsign", revision = "fa4d5598f778390df09be94232972b5b865a56b8"} #wasmsign2-cli = {git = "https://github.com/wasm-signatures/wasmsign2", revision = "0.2.3"} wasmsign2-cli = {git = "https://github.com/martijneken/wasmsign2", branch = "fix-bazel" }
Example use:
load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_vendor") crates_vendor( name = "crates_vendor", cargo_lockfile = "//bazel/cargo/wasmsign:Cargo.Bazel.lock", generate_binaries = True, generate_target_compatible_with = False, manifests = ["//bazel/cargo/wasmsign:Cargo.toml"], mode = "remote", tags = ["manual"], vendor_path = "//bazel/cargo/wasmsign/remote", )
Oh, this is atrocious.
But without ugly hacks, Rust typically doesn't play well with anything but itself, so as long as it doesn't break anything, let's do that.
See these docs. I've confirmed that adding the
src/lib.rs
placeholder file allows Bazel rules_rust to generaterust_binary
targets:Example Cargo.toml:
Example use: