• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1local_repository(
2    name = "rules_rust",
3    path = "../..",
4)
5
6load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set")
7
8rules_rust_dependencies()
9
10EDITION = "2021"
11
12# Before 1.80.0, proc macros couldn't be used when exec!=target where exec and target platforms use different shared library extension (i.e. so vs dylib) because of an error in rustc's handling of extensions.
13RUST_VERSION = "1.80.0"
14
15rust_register_toolchains(
16    edition = EDITION,
17)
18
19rust_repository_set(
20    name = "darwin_x86_64_to_x86_64_musl_tuple",
21    edition = EDITION,
22    exec_triple = "x86_64-apple-darwin",
23    # Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered.
24    extra_target_triples = {"x86_64-unknown-linux-musl": [
25        "@//linker_config:musl",
26        "@platforms//cpu:x86_64",
27        "@platforms//os:linux",
28    ]},
29    versions = [RUST_VERSION],
30)
31
32rust_repository_set(
33    name = "darwin_arm64_to_x86_64_musl_tuple",
34    edition = EDITION,
35    exec_triple = "aarch64-apple-darwin",
36    extra_target_triples = {"x86_64-unknown-linux-musl": [
37        "@//linker_config:musl",
38        "@platforms//cpu:x86_64",
39        "@platforms//os:linux",
40    ]},
41    versions = [RUST_VERSION],
42)
43
44rust_repository_set(
45    name = "darwin_x86_64_to_arm64_musl_tuple",
46    edition = EDITION,
47    exec_triple = "x86_64-apple-darwin",
48    # Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered.
49    extra_target_triples = {"aarch64-unknown-linux-musl": [
50        "@//linker_config:musl",
51        "@platforms//cpu:arm64",
52        "@platforms//os:linux",
53    ]},
54    versions = [RUST_VERSION],
55)
56
57rust_repository_set(
58    name = "darwin_arm64_to_arm64_musl_tuple",
59    edition = EDITION,
60    exec_triple = "aarch64-apple-darwin",
61    extra_target_triples = {"aarch64-unknown-linux-musl": [
62        "@//linker_config:musl",
63        "@platforms//cpu:arm64",
64        "@platforms//os:linux",
65    ]},
66    versions = [RUST_VERSION],
67)
68
69load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
70
71http_archive(
72    name = "aspect_bazel_lib",
73    sha256 = "f5ea76682b209cc0bd90d0f5a3b26d2f7a6a2885f0c5f615e72913f4805dbb0d",
74    strip_prefix = "bazel-lib-2.5.0",
75    url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.5.0/bazel-lib-v2.5.0.tar.gz",
76)
77
78load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
79
80aspect_bazel_lib_dependencies()
81
82aspect_bazel_lib_register_toolchains()
83
84http_archive(
85    name = "musl_toolchains",
86    sha256 = "1e6cf99f35277dbb9c3b341a9986d0f33cf70e0cc76a58f062d2d9b7ab56eeeb",
87    url = "https://github.com/bazel-contrib/musl-toolchain/releases/download/v0.1.17/musl_toolchain-v0.1.17.tar.gz",
88)
89
90load("@musl_toolchains//:repositories.bzl", "load_musl_toolchains")
91
92# Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered.
93load_musl_toolchains(extra_target_compatible_with = ["@//linker_config:musl"])
94
95load("@musl_toolchains//:toolchains.bzl", "register_musl_toolchains")
96
97register_musl_toolchains()
98
99load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
100
101crate_universe_dependencies(bootstrap = True)
102
103load("@rules_rust//crate_universe:defs.bzl", "crates_repository")
104
105crates_repository(
106    name = "cu",
107    cargo_lockfile = "//:Cargo.Bazel.lock",
108    # `generator` is not necessary in official releases.
109    # See load statement for `cargo_bazel_bootstrap`.
110    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
111    lockfile = "//:Cargo.Bazel.lock.json",
112    manifests = [
113        "//:Cargo.toml",
114        "//:local_proc_macro/Cargo.toml",
115    ],
116)
117
118load("@cu//:defs.bzl", "crate_repositories")
119
120crate_repositories()
121