| local_repository( |
| name = "rules_rust", |
| path = "../..", |
| ) |
| |
| load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set") |
| |
| rules_rust_dependencies() |
| |
| EDITION = "2021" |
| |
| # 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. |
| RUST_VERSION = "1.80.0" |
| |
| rust_repository_set( |
| name = "darwin_x86_64_to_x86_64_musl_tuple", |
| edition = EDITION, |
| exec_triple = "x86_64-apple-darwin", |
| # Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered. |
| extra_target_triples = { |
| "x86_64-unknown-linux-musl": [ |
| "@//linker_config:musl", |
| "@platforms//cpu:x86_64", |
| "@platforms//os:linux", |
| ], |
| }, |
| versions = [RUST_VERSION], |
| ) |
| |
| rust_repository_set( |
| name = "darwin_arm64_to_x86_64_musl_tuple", |
| edition = EDITION, |
| exec_triple = "aarch64-apple-darwin", |
| extra_target_triples = { |
| "x86_64-unknown-linux-musl": [ |
| "@//linker_config:musl", |
| "@platforms//cpu:x86_64", |
| "@platforms//os:linux", |
| ], |
| }, |
| versions = [RUST_VERSION], |
| ) |
| |
| rust_repository_set( |
| name = "darwin_x86_64_to_arm64_musl_tuple", |
| edition = EDITION, |
| exec_triple = "x86_64-apple-darwin", |
| # Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered. |
| extra_target_triples = { |
| "aarch64-unknown-linux-musl": [ |
| "@//linker_config:musl", |
| "@platforms//cpu:arm64", |
| "@platforms//os:linux", |
| ], |
| }, |
| versions = [RUST_VERSION], |
| ) |
| |
| rust_repository_set( |
| name = "darwin_arm64_to_arm64_musl_tuple", |
| edition = EDITION, |
| exec_triple = "aarch64-apple-darwin", |
| extra_target_triples = { |
| "aarch64-unknown-linux-musl": [ |
| "@//linker_config:musl", |
| "@platforms//cpu:arm64", |
| "@platforms//os:linux", |
| ], |
| }, |
| versions = [RUST_VERSION], |
| ) |
| |
| # This overrides a default rust_repository_set created by rust_register_toolchain. |
| # It must be named exactly this, and must be called before rust_register_toolchain is. |
| rust_repository_set( |
| name = "rust_linux_x86_64", |
| edition = EDITION, |
| exec_triple = "x86_64-unknown-linux-gnu", |
| # Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered. |
| extra_target_triples = { |
| "aarch64-unknown-linux-musl": [ |
| "@//linker_config:musl", |
| "@platforms//cpu:arm64", |
| "@platforms//os:linux", |
| ], |
| "x86_64-unknown-linux-gnu": [ |
| "@//linker_config:unknown", |
| "@platforms//cpu:x86_64", |
| "@platforms//os:linux", |
| ], |
| "x86_64-unknown-linux-musl": [ |
| "@//linker_config:musl", |
| "@platforms//cpu:x86_64", |
| "@platforms//os:linux", |
| ], |
| }, |
| versions = [RUST_VERSION], |
| ) |
| |
| rust_register_toolchains( |
| edition = EDITION, |
| ) |
| |
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| |
| http_archive( |
| name = "aspect_bazel_lib", |
| sha256 = "f5ea76682b209cc0bd90d0f5a3b26d2f7a6a2885f0c5f615e72913f4805dbb0d", |
| strip_prefix = "bazel-lib-2.5.0", |
| url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.5.0/bazel-lib-v2.5.0.tar.gz", |
| ) |
| |
| load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains") |
| |
| aspect_bazel_lib_dependencies() |
| |
| aspect_bazel_lib_register_toolchains() |
| |
| http_archive( |
| name = "musl_toolchains", |
| sha256 = "1e6cf99f35277dbb9c3b341a9986d0f33cf70e0cc76a58f062d2d9b7ab56eeeb", |
| url = "https://github.com/bazel-contrib/musl-toolchain/releases/download/v0.1.17/musl_toolchain-v0.1.17.tar.gz", |
| ) |
| |
| load("@musl_toolchains//:repositories.bzl", "load_musl_toolchains") |
| |
| # Setting this extra_target_triples allows differentiating the musl case from the non-musl case, in case multiple linux-targeting toolchains are registered. |
| load_musl_toolchains(extra_target_compatible_with = ["@//linker_config:musl"]) |
| |
| load("@musl_toolchains//:toolchains.bzl", "register_musl_toolchains") |
| |
| register_musl_toolchains() |
| |
| load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") |
| |
| crate_universe_dependencies(bootstrap = True) |
| |
| load("@rules_rust//crate_universe:defs.bzl", "crates_repository") |
| |
| crates_repository( |
| name = "cu", |
| cargo_lockfile = "//:Cargo.Bazel.lock", |
| # `generator` is not necessary in official releases. |
| # See load statement for `cargo_bazel_bootstrap`. |
| generator = "@cargo_bazel_bootstrap//:cargo-bazel", |
| lockfile = "//:Cargo.Bazel.lock.json", |
| manifests = [ |
| "//:Cargo.toml", |
| "//:local_proc_macro/Cargo.toml", |
| ], |
| ) |
| |
| load("@cu//:defs.bzl", "crate_repositories") |
| |
| crate_repositories() |