Crates.io | cargo-proto-raze |
lib.rs | cargo-proto-raze |
version | 0.1.1 |
source | src |
created_at | 2017-04-27 01:52:31.672826 |
updated_at | 2017-04-27 02:19:25.767807 |
description | A Cargo subcommand to help integrate Cargo dependencies into a Bazel project. |
homepage | |
repository | https://github.com/acmcarther/cargo-raze-vendor |
max_upload_size | |
id | 12158 |
size | 76,578 |
A bazel rule generator for cargo dependencies.
This tool is experimental and no guarantees are made that it will work at all really. It works for the one example in this repo. It was built as a spike to test out possible workflows for a proper tool implementation.
Example invocation (in a Cargo.toml+Cargo.lock bearing directory)
cargo install raze
cargo raze --overrides log-0.3.7:@custom-log//log:log --generate
A generate
invocation will yield a series of new_http_archive() invocations into ./raze.WORKSPACE
that can be included in the repository's WORKSPACE file to automatically include the selected crates, with generated BUILD rules. An overrides
flag is provided to allow users to override references of selected dependencies with their own defined rules. This is a useful feature when the automatically generated build rule fails to compile. Typically, rules that have complex system library dependencies, or leverage build.rs
in interesting ways will require a custom override. Overrides in this manner will need to be accessible from your WORKSPACE, meaning they cannot live in the root workspace.
It is not suggested that users manually edit the generated rules, as those edits will have to be persisted when generate
is rerun.
Example invocation (in a Cargo.toml+Cargo.lock bearing directory)
cargo install raze
cargo raze --overrides log-0.3.7:@custom-log//log:log --vendor ./raze
A vendor
invocation will yield the full source code, supplemented with BUILD files into a selected directory. These rules function identically to normal source code. An override
feature is provided to prevent vendoring of some dependency, in lieu of a user-customized dependency. This is typically necessary if the dependency leverages build.rs
in some novel way.
raze
is run onalias
rules for packages directly specified in Cargo.tomlbuild.rs
shim rules, rather than forcing an --override
when build_dependencies are present.