Skip to content
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

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

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

martijneken
Copy link
Contributor

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",
)

Signed-off-by: Martijn Stevenson <[email protected]>
Signed-off-by: Martijn Stevenson <[email protected]>
Signed-off-by: Martijn Stevenson <[email protected]>
@jedisct1
Copy link
Collaborator

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.

@jedisct1 jedisct1 merged commit 07c60ee into wasm-signatures:master Jul 29, 2024
1 check passed
@martijneken martijneken deleted the fix-bazel branch July 29, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants