fork/rules_rust

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

UebelAndreAdded Rust 1.81.0 (#2841)1ade1876

cleanup
5.1 KiB156 linesraw
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_repository_set(
16    name = "darwin_x86_64_to_x86_64_musl_tuple",
17    edition = EDITION,
18    exec_triple = "x86_64-apple-darwin",
19    # Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered.
20    extra_target_triples = {
21        "x86_64-unknown-linux-musl": [
22            "@//linker_config:musl",
23            "@platforms//cpu:x86_64",
24            "@platforms//os:linux",
25        ],
26    },
27    versions = [RUST_VERSION],
28)
29
30rust_repository_set(
31    name = "darwin_arm64_to_x86_64_musl_tuple",
32    edition = EDITION,
33    exec_triple = "aarch64-apple-darwin",
34    extra_target_triples = {
35        "x86_64-unknown-linux-musl": [
36            "@//linker_config:musl",
37            "@platforms//cpu:x86_64",
38            "@platforms//os:linux",
39        ],
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 = {
50        "aarch64-unknown-linux-musl": [
51            "@//linker_config:musl",
52            "@platforms//cpu:arm64",
53            "@platforms//os:linux",
54        ],
55    },
56    versions = [RUST_VERSION],
57)
58
59rust_repository_set(
60    name = "darwin_arm64_to_arm64_musl_tuple",
61    edition = EDITION,
62    exec_triple = "aarch64-apple-darwin",
63    extra_target_triples = {
64        "aarch64-unknown-linux-musl": [
65            "@//linker_config:musl",
66            "@platforms//cpu:arm64",
67            "@platforms//os:linux",
68        ],
69    },
70    versions = [RUST_VERSION],
71)
72
73# This overrides a default rust_repository_set created by rust_register_toolchain.
74# It must be named exactly this, and must be called before rust_register_toolchain is.
75rust_repository_set(
76    name = "rust_linux_x86_64",
77    edition = EDITION,
78    exec_triple = "x86_64-unknown-linux-gnu",
79    # Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered.
80    extra_target_triples = {
81        "aarch64-unknown-linux-musl": [
82            "@//linker_config:musl",
83            "@platforms//cpu:arm64",
84            "@platforms//os:linux",
85        ],
86        "x86_64-unknown-linux-gnu": [
87            "@//linker_config:unknown",
88            "@platforms//cpu:x86_64",
89            "@platforms//os:linux",
90        ],
91        "x86_64-unknown-linux-musl": [
92            "@//linker_config:musl",
93            "@platforms//cpu:x86_64",
94            "@platforms//os:linux",
95        ],
96    },
97    versions = [RUST_VERSION],
98)
99
100rust_register_toolchains(
101    edition = EDITION,
102    versions = [RUST_VERSION],
103)
104
105load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
106
107http_archive(
108    name = "aspect_bazel_lib",
109    sha256 = "f5ea76682b209cc0bd90d0f5a3b26d2f7a6a2885f0c5f615e72913f4805dbb0d",
110    strip_prefix = "bazel-lib-2.5.0",
111    url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.5.0/bazel-lib-v2.5.0.tar.gz",
112)
113
114load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
115
116aspect_bazel_lib_dependencies()
117
118aspect_bazel_lib_register_toolchains()
119
120http_archive(
121    name = "musl_toolchains",
122    sha256 = "1e6cf99f35277dbb9c3b341a9986d0f33cf70e0cc76a58f062d2d9b7ab56eeeb",
123    url = "https://github.com/bazel-contrib/musl-toolchain/releases/download/v0.1.17/musl_toolchain-v0.1.17.tar.gz",
124)
125
126load("@musl_toolchains//:repositories.bzl", "load_musl_toolchains")
127
128# Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered.
129load_musl_toolchains(extra_target_compatible_with = ["@//linker_config:musl"])
130
131load("@musl_toolchains//:toolchains.bzl", "register_musl_toolchains")
132
133register_musl_toolchains()
134
135load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
136
137crate_universe_dependencies(bootstrap = True)
138
139load("@rules_rust//crate_universe:defs.bzl", "crates_repository")
140
141crates_repository(
142    name = "cu",
143    cargo_lockfile = "//:Cargo.Bazel.lock",
144    # `generator` is not necessary in official releases.
145    # See load statement for `cargo_bazel_bootstrap`.
146    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
147    lockfile = "//:Cargo.Bazel.lock.json",
148    manifests = [
149        "//:Cargo.toml",
150        "//:local_proc_macro/Cargo.toml",
151    ],
152)
153
154load("@cu//:defs.bzl", "crate_repositories")
155
156crate_repositories()