fork/rules_rust

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

UebelAndreAdded missing CI for prost (#3053)a33f9011

main
2.4 KiB64 linesraw
1"""Dependencies for Rust prost rules"""
2
3load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
5load("//private/3rdparty/crates:crates.bzl", "crate_repositories")
6
7def rust_prost_dependencies(bzlmod = False):
8    """Declares repositories needed for prost.
9
10    Args:
11        bzlmod (bool): Whether bzlmod is enabled.
12
13    Returns:
14        list[struct(repo=str, is_dev_dep=bool)]: A list of the repositories
15        defined by this macro.
16    """
17
18    direct_deps = [
19        struct(repo = "rrprd__heck", is_dev_dep = False),
20    ]
21    if bzlmod:
22        # Without bzlmod, this function is normally called by the
23        # rust_prost_dependencies function in the private directory.
24        # However, the private directory is inaccessible, plus there's no
25        # reason to keep two rust_prost_dependencies functions with bzlmod.
26        direct_deps.extend(crate_repositories())
27    else:
28        maybe(
29            http_archive,
30            name = "rules_proto",
31            sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
32            strip_prefix = "rules_proto-6.0.2",
33            url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
34        )
35
36        maybe(
37            http_archive,
38            name = "com_google_protobuf",
39            integrity = "sha256-fD69eq7dhvpdxHmg/agD9gLKr3jYr/fOg7ieG4rnRCo=",
40            strip_prefix = "protobuf-28.3",
41            urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protobuf-28.3.tar.gz"],
42        )
43        maybe(
44            http_archive,
45            name = "zlib",
46            build_file = Label("//private/3rdparty:BUILD.zlib.bazel"),
47            sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
48            strip_prefix = "zlib-1.2.11",
49            urls = [
50                "https://zlib.net/zlib-1.2.11.tar.gz",
51                "https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.11.tar.gz",
52            ],
53        )
54
55    maybe(
56        http_archive,
57        name = "rrprd__heck",
58        integrity = "sha256-IwTgCYP4f/s4tVtES147YKiEtdMMD8p9gv4zRJu+Veo=",
59        type = "tar.gz",
60        urls = ["https://static.crates.io/crates/heck/heck-0.5.0.crate"],
61        strip_prefix = "heck-0.5.0",
62        build_file = Label("@rules_rust_prost//private/3rdparty/crates:BUILD.heck-0.5.0.bazel"),
63    )
64    return direct_deps