- Use
cargo new
orcargo init
command to initialize cargo project - Use
cargo install cargo-raze
to download raze that can generate BUILD files for bazel - If you plan to use any crates as bazel targets add this snippet:
load("//cargo:crates.bzl", "raze_fetch_remote_crates")
# Note that this method's name depends on your gen_workspace_prefix setting.
# `raze` is the default prefix.
raze_fetch_remote_crates()
- Use
cargo raze
to generate bazel BUILD file for cargo crates. ** More about cargo raze can be found here - Now you can build it using bazel
bazel build //...