xref: /aosp_15_r20/external/bazelbuild-rules_rust/examples/bazel_env/MODULE.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifan"""bazelbuild/rules_rust - bazel_env/bzlmod example
2*d4726bddSHONG Yifan
3*d4726bddSHONG YifanSee https://github.com/buildbuddy-io/bazel_env.bzl.
4*d4726bddSHONG Yifan"""
5*d4726bddSHONG Yifan
6*d4726bddSHONG Yifanmodule(
7*d4726bddSHONG Yifan    name = "all_crate_deps_bzlmod_example",
8*d4726bddSHONG Yifan    version = "0.0.0",
9*d4726bddSHONG Yifan)
10*d4726bddSHONG Yifan
11*d4726bddSHONG Yifanbazel_dep(name = "platforms", version = "0.0.9")
12*d4726bddSHONG Yifanbazel_dep(
13*d4726bddSHONG Yifan    name = "rules_rust",
14*d4726bddSHONG Yifan    version = "0.0.0",
15*d4726bddSHONG Yifan)
16*d4726bddSHONG Yifanlocal_path_override(
17*d4726bddSHONG Yifan    module_name = "rules_rust",
18*d4726bddSHONG Yifan    path = "../..",
19*d4726bddSHONG Yifan)
20*d4726bddSHONG Yifan
21*d4726bddSHONG Yifanrust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
22*d4726bddSHONG Yifanrust.toolchain(edition = "2021")
23*d4726bddSHONG Yifanuse_repo(
24*d4726bddSHONG Yifan    rust,
25*d4726bddSHONG Yifan    "rust_toolchains",
26*d4726bddSHONG Yifan)
27*d4726bddSHONG Yifan
28*d4726bddSHONG Yifanregister_toolchains("@rust_toolchains//:all")
29*d4726bddSHONG Yifan
30*d4726bddSHONG Yifancrate = use_extension(
31*d4726bddSHONG Yifan    "@rules_rust//crate_universe:extension.bzl",
32*d4726bddSHONG Yifan    "crate",
33*d4726bddSHONG Yifan)
34*d4726bddSHONG Yifancrate.from_cargo(
35*d4726bddSHONG Yifan    name = "crates",
36*d4726bddSHONG Yifan    cargo_lockfile = "//:Cargo.lock",
37*d4726bddSHONG Yifan    manifests = [
38*d4726bddSHONG Yifan        "//:Cargo.toml",
39*d4726bddSHONG Yifan        "//rust/hello_world:Cargo.toml",
40*d4726bddSHONG Yifan    ],
41*d4726bddSHONG Yifan)
42*d4726bddSHONG Yifanuse_repo(crate, "crates")
43*d4726bddSHONG Yifan
44*d4726bddSHONG Yifanbazel_dep(name = "bazel_env.bzl", version = "0.1.1")
45