fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
1ade1876
cleanup
1local_repository ( 2name = "rules_rust" , 3path = "../.." , 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 ( 16name = "darwin_x86_64_to_x86_64_musl_tuple" , 17edition = EDITION , 18exec_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. 20extra_target_triples = { 21"x86_64-unknown-linux-musl" : [ 22"@//linker_config:musl" , 23"@platforms//cpu:x86_64" , 24"@platforms//os:linux" , 25], 26}, 27versions = [ RUST_VERSION ], 28) 29 30rust_repository_set ( 31name = "darwin_arm64_to_x86_64_musl_tuple" , 32edition = EDITION , 33exec_triple = "aarch64-apple-darwin" , 34extra_target_triples = { 35"x86_64-unknown-linux-musl" : [ 36"@//linker_config:musl" , 37"@platforms//cpu:x86_64" , 38"@platforms//os:linux" , 39], 40}, 41versions = [ RUST_VERSION ], 42) 43 44rust_repository_set ( 45name = "darwin_x86_64_to_arm64_musl_tuple" , 46edition = EDITION , 47exec_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. 49extra_target_triples = { 50"aarch64-unknown-linux-musl" : [ 51"@//linker_config:musl" , 52"@platforms//cpu:arm64" , 53"@platforms//os:linux" , 54], 55}, 56versions = [ RUST_VERSION ], 57) 58 59rust_repository_set ( 60name = "darwin_arm64_to_arm64_musl_tuple" , 61edition = EDITION , 62exec_triple = "aarch64-apple-darwin" , 63extra_target_triples = { 64"aarch64-unknown-linux-musl" : [ 65"@//linker_config:musl" , 66"@platforms//cpu:arm64" , 67"@platforms//os:linux" , 68], 69}, 70versions = [ 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 ( 76name = "rust_linux_x86_64" , 77edition = EDITION , 78exec_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. 80extra_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}, 97versions = [ RUST_VERSION ], 98) 99 100rust_register_toolchains ( 101edition = EDITION , 102versions = [ RUST_VERSION ], 103) 104 105load ( "@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" ) 106 107http_archive ( 108name = "aspect_bazel_lib" , 109sha256 = "f5ea76682b209cc0bd90d0f5a3b26d2f7a6a2885f0c5f615e72913f4805dbb0d" , 110strip_prefix = "bazel-lib-2.5.0" , 111url = "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 ( 121name = "musl_toolchains" , 122sha256 = "1e6cf99f35277dbb9c3b341a9986d0f33cf70e0cc76a58f062d2d9b7ab56eeeb" , 123url = "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 ( 142name = "cu" , 143cargo_lockfile = "//:Cargo.Bazel.lock" , 144# `generator` is not necessary in official releases. 145# See load statement for `cargo_bazel_bootstrap`. 146generator = "@cargo_bazel_bootstrap//:cargo-bazel" , 147lockfile = "//:Cargo.Bazel.lock.json" , 148manifests = [ 149"//:Cargo.toml" , 150"//:local_proc_macro/Cargo.toml" , 151], 152) 153 154load ( "@cu//:defs.bzl" , "crate_repositories" ) 155 156crate_repositories ()