wasm-signatures / wasmsign2

Implementation of the WebAssembly Modules Signatures.
47 stars 4 forks source link

feat: add a dummy src/lib.rs to make Bazel crate_universe happy #3

Closed martijneken closed 1 month ago

martijneken commented 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:

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",
)
jedisct1 commented 1 month ago

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.