fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

UebelAndreAdded `cargo_config` attribute to `cargo_bootstrap_repository`. (#2986)8b8150db

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