fork/rules_rust

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

UebelAndreAdded support for compact windows repository names, avoiding MAX_PATH (#3023)8e962a16

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