xref: /aosp_15_r20/external/bazelbuild-rules_rust/crate_universe/deps_bootstrap.bzl (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1"""A module is used to assist in bootstrapping cargo-bazel"""
2
3load("//cargo:defs.bzl", "cargo_bootstrap_repository")
4load("//crate_universe/private:srcs.bzl", "CARGO_BAZEL_SRCS")
5
6# buildifier: disable=bzl-visibility
7load("//rust/private:common.bzl", "rust_common")
8
9def cargo_bazel_bootstrap(name = "cargo_bazel_bootstrap", rust_version = rust_common.default_version, **kwargs):
10    """An optional repository which bootstraps `cargo-bazel` for use with `crates_repository`
11
12    Args:
13        name (str, optional): The name of the `cargo_bootstrap_repository`.
14        rust_version (str, optional): The rust version to use. Defaults to the default of `cargo_bootstrap_repository`.
15        **kwargs: kwargs to pass through to cargo_bootstrap_repository.
16    """
17    cargo_bootstrap_repository(
18        name = name,
19        srcs = CARGO_BAZEL_SRCS,
20        binary = "cargo-bazel",
21        cargo_lockfile = "@rules_rust//crate_universe:Cargo.lock",
22        cargo_toml = "@rules_rust//crate_universe:Cargo.toml",
23        version = rust_version,
24        # The increased timeout helps avoid flakes in CI
25        timeout = 900,
26        **kwargs
27    )
28