1*d4726bddSHONG Yifanmodule( 2*d4726bddSHONG Yifan name = "grpc-client-server", 3*d4726bddSHONG Yifan version = "0.0.0", 4*d4726bddSHONG Yifan) 5*d4726bddSHONG Yifan 6*d4726bddSHONG Yifan############################################################################### 7*d4726bddSHONG Yifan# B A Z E L C E N T R A L R E G I S T R Y # https://registry.bazel.build/ 8*d4726bddSHONG Yifan############################################################################### 9*d4726bddSHONG Yifan# https://github.com/bazelbuild/rules_rust/releases 10*d4726bddSHONG Yifanbazel_dep(name = "rules_rust", version = "0.46.0") 11*d4726bddSHONG Yifanlocal_path_override( 12*d4726bddSHONG Yifan module_name = "rules_rust", 13*d4726bddSHONG Yifan path = "../../..", 14*d4726bddSHONG Yifan) 15*d4726bddSHONG Yifan 16*d4726bddSHONG Yifan# 17*d4726bddSHONG Yifan# Rules for protobuf / gRPC 18*d4726bddSHONG Yifan# https://github.com/bazelbuild/rules_proto/releases 19*d4726bddSHONG Yifanbazel_dep(name = "rules_proto", version = "6.0.2") 20*d4726bddSHONG Yifan 21*d4726bddSHONG Yifan# https://github.com/aspect-build/toolchains_protoc/releases 22*d4726bddSHONG Yifanbazel_dep(name = "toolchains_protoc", version = "0.3.1") 23*d4726bddSHONG Yifan 24*d4726bddSHONG Yifan# https://registry.bazel.build/modules/protobuf 25*d4726bddSHONG Yifanbazel_dep(name = "protobuf", version = "27.1") 26*d4726bddSHONG Yifan 27*d4726bddSHONG Yifan# https://github.com/bazel-contrib/toolchains_llvm 28*d4726bddSHONG Yifanbazel_dep(name = "toolchains_llvm", version = "1.0.0") 29*d4726bddSHONG Yifan 30*d4726bddSHONG Yifan############################################################################### 31*d4726bddSHONG Yifan# L L V M 32*d4726bddSHONG Yifan# https://github.com/bazel-contrib/toolchains_llvm/blob/master/tests/MODULE.bazel 33*d4726bddSHONG Yifan############################################################################### 34*d4726bddSHONG Yifanllvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm") 35*d4726bddSHONG Yifan 36*d4726bddSHONG Yifan# LLVM Versions and platforms 37*d4726bddSHONG Yifan# https://github.com/bazel-contrib/toolchains_llvm/blob/master/toolchain/internal/llvm_distributions.bzl 38*d4726bddSHONG YifanLLVM_VERSIONS = { 39*d4726bddSHONG Yifan "": "16.0.0", 40*d4726bddSHONG Yifan "darwin-aarch64": "16.0.3", 41*d4726bddSHONG Yifan "darwin-x86_64": "15.0.7", 42*d4726bddSHONG Yifan} 43*d4726bddSHONG Yifan 44*d4726bddSHONG Yifan# Host LLVM toolchain. 45*d4726bddSHONG Yifanllvm.toolchain( 46*d4726bddSHONG Yifan name = "llvm_toolchain", 47*d4726bddSHONG Yifan llvm_versions = LLVM_VERSIONS, 48*d4726bddSHONG Yifan) 49*d4726bddSHONG Yifanuse_repo(llvm, "llvm_toolchain", "llvm_toolchain_llvm") 50*d4726bddSHONG Yifan 51*d4726bddSHONG Yifanregister_toolchains("@llvm_toolchain//:all") 52*d4726bddSHONG Yifan 53*d4726bddSHONG Yifan############################################################################### 54*d4726bddSHONG Yifan# T O O L C H A I N S 55*d4726bddSHONG Yifan############################################################################### 56*d4726bddSHONG Yifan 57*d4726bddSHONG Yifan# Rust toolchain 58*d4726bddSHONG YifanRUST_EDITION = "2021" 59*d4726bddSHONG Yifan 60*d4726bddSHONG YifanRUST_VERSION = "1.79.0" 61*d4726bddSHONG Yifan 62*d4726bddSHONG Yifanrust = use_extension("@rules_rust//rust:extensions.bzl", "rust") 63*d4726bddSHONG Yifanrust.toolchain( 64*d4726bddSHONG Yifan edition = RUST_EDITION, 65*d4726bddSHONG Yifan versions = [RUST_VERSION], 66*d4726bddSHONG Yifan) 67*d4726bddSHONG Yifanuse_repo(rust, "rust_toolchains") 68*d4726bddSHONG Yifan 69*d4726bddSHONG Yifanregister_toolchains("@rust_toolchains//:all") 70*d4726bddSHONG Yifan 71*d4726bddSHONG Yifan# Proto toolchain 72*d4726bddSHONG Yifanregister_toolchains("@rules_rust//proto/protobuf:default-proto-toolchain") 73*d4726bddSHONG Yifan 74*d4726bddSHONG Yifan# Custom Prost toolchain 75*d4726bddSHONG Yifanregister_toolchains("@//build/prost_toolchain") 76*d4726bddSHONG Yifan 77*d4726bddSHONG Yifan############################################################################### 78*d4726bddSHONG Yifan# R U S T C R A T E S 79*d4726bddSHONG Yifan############################################################################### 80*d4726bddSHONG Yifancrate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate") 81*d4726bddSHONG Yifan 82*d4726bddSHONG Yifan# 83*d4726bddSHONG Yifan# protobuf / gRPC dependencies 84*d4726bddSHONG Yifancrate.spec( 85*d4726bddSHONG Yifan package = "prost", 86*d4726bddSHONG Yifan version = "0.12", 87*d4726bddSHONG Yifan) 88*d4726bddSHONG Yifancrate.spec( 89*d4726bddSHONG Yifan default_features = False, 90*d4726bddSHONG Yifan package = "prost-types", 91*d4726bddSHONG Yifan version = "0.12", 92*d4726bddSHONG Yifan) 93*d4726bddSHONG Yifancrate.spec( 94*d4726bddSHONG Yifan features = ["transport"], 95*d4726bddSHONG Yifan package = "tonic", 96*d4726bddSHONG Yifan version = "0.11", 97*d4726bddSHONG Yifan) 98*d4726bddSHONG Yifancrate.spec( 99*d4726bddSHONG Yifan package = "tonic-build", 100*d4726bddSHONG Yifan version = "0.11", 101*d4726bddSHONG Yifan) 102*d4726bddSHONG Yifancrate.spec( 103*d4726bddSHONG Yifan package = "protoc-gen-prost", 104*d4726bddSHONG Yifan version = "0.3.1", 105*d4726bddSHONG Yifan) 106*d4726bddSHONG Yifancrate.annotation( 107*d4726bddSHONG Yifan crate = "protoc-gen-prost", 108*d4726bddSHONG Yifan gen_binaries = ["protoc-gen-prost"], 109*d4726bddSHONG Yifan) 110*d4726bddSHONG Yifancrate.spec( 111*d4726bddSHONG Yifan package = "protoc-gen-tonic", 112*d4726bddSHONG Yifan version = "0.4.0", 113*d4726bddSHONG Yifan) 114*d4726bddSHONG Yifancrate.annotation( 115*d4726bddSHONG Yifan crate = "protoc-gen-tonic", 116*d4726bddSHONG Yifan gen_binaries = ["protoc-gen-tonic"], 117*d4726bddSHONG Yifan) 118*d4726bddSHONG Yifan 119*d4726bddSHONG Yifan# 120*d4726bddSHONG Yifan# External crates 121*d4726bddSHONG Yifancrate.spec( 122*d4726bddSHONG Yifan default_features = False, 123*d4726bddSHONG Yifan features = [ 124*d4726bddSHONG Yifan "macros", 125*d4726bddSHONG Yifan "net", 126*d4726bddSHONG Yifan "rt-multi-thread", 127*d4726bddSHONG Yifan "signal", 128*d4726bddSHONG Yifan ], 129*d4726bddSHONG Yifan package = "tokio", 130*d4726bddSHONG Yifan version = "1.38", 131*d4726bddSHONG Yifan) 132*d4726bddSHONG Yifancrate.from_specs() 133*d4726bddSHONG Yifanuse_repo(crate, "crates") 134