fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
8e962a16
main
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 ( 11name = "cargo_bazel_bootstrap" , 12rust_version = rust_common . default_version , 13** kwargs ): 14"""An optional repository which bootstraps `cargo-bazel` for use with `crates_repository` 15 16Args: 17name (str, optional): The name of the `cargo_bootstrap_repository`. 18rust_version (str, optional): The rust version to use. Defaults to the default of `cargo_bootstrap_repository`. 19**kwargs: kwargs to pass through to cargo_bootstrap_repository. 20 21Returns: 22list[struct(repo=str, is_dev_dep=bool)]: A list of the repositories 23defined by this macro. 24""" 25 26maybe ( 27cargo_bootstrap_repository , 28name = name , 29srcs = CARGO_BAZEL_SRCS , 30binary = "cargo-bazel" , 31cargo_lockfile = "@rules_rust//crate_universe:Cargo.lock" , 32cargo_toml = "@rules_rust//crate_universe:Cargo.toml" , 33version = rust_version , 34# The increased timeout helps avoid flakes in CI 35timeout = 900 , 36** kwargs 37) 38 39return [ struct ( 40repo = name , 41is_dev_dep = False , 42)]