Skip to content

Updated Rust example 8 to run on downstream CI. #555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .bazelci/tutorial-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,12 @@ tasks:
name: "Rust grpc"
platform: ubuntu2204
working_directory: ../rust-examples/08-grpc-client-server
run_targets: # This step is needed to generate the vendor directory required for the build to succeed.
- "//thirdparty:crates_vendor"
build_targets:
- "//..."
rust-08-grpc-client-server-macos:
name: "Rust grpc"
platform: macos_arm64
working_directory: ../rust-examples/08-grpc-client-server
run_targets: # This step is needed to generate the vendor directory required for the build to succeed.
- "//thirdparty:crates_vendor"
build_targets:
- "//..."
rust-09-oci-container-linux:
Expand Down
2 changes: 1 addition & 1 deletion rust-examples/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.0.1
8.1.0
79 changes: 67 additions & 12 deletions rust-examples/08-grpc-client-server/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ bazel_dep(name = "toolchains_llvm", version = "1.2.0", dev_dependency = True)
###############################################################################
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
llvm_version = "18.1.8",
llvm_version = "19.1.6-1",
sha256 = {
# Generate checksums with shasum -a 256 filename.tar.zst
"darwin-aarch64": "41d8dea52d18c4e8b90c4fcd31965f9f297df9f40a38a33d60748dbe7f8330b8",
"darwin-x86_64": "",
"linux-aarch64": "",
"linux-x86_64": "",
"darwin-aarch64": "94ed965925dbdc25b29e6fcfa9a84b28d915d5c9da7c71405fc20bbcf8396bd1",
"darwin-x86_64": "9395b07fd5018816bcaee84522d9c9386fdbefe62fdf8afff89b57e1b7095463",
"linux-aarch64": "24fd3405f65ccbc39f0d14a5126ee2edb5904d7a9525ae483f34a510a1bdce3e",
"linux-x86_64": "bad3d776c222c99056eba8b64c085a1e08edd783cb102e1b6eba43b78ce2fe2b",
},
stdlib = {
"linux-x86_64": "stdc++",
"linux-aarch64": "stdc++",
},
urls = {
"darwin-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-18.1.8-4/darwin_aarch64.tar.zst"],
"darwin-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-18.1.8-4/darwin_x86_64.tar.zst"],
"linux-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-18.1.8-4/linux_aarch64.tar.zst"],
"linux-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-18.1.8-4/linux_x86_64.tar.zst"],
"darwin-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-19.1.6-1/darwin_aarch64.tar.zst"],
"darwin-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-19.1.6-1/darwin_x86_64.tar.zst"],
"linux-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-19.1.6-1/linux_aarch64.tar.zst"],
"linux-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-19.1.6-1/linux_x86_64.tar.zst"],
},
)

Expand All @@ -59,7 +59,62 @@ use_repo(rust, "rust_toolchains")

register_toolchains("@rust_toolchains//:all")

# Custom Rust Prost toolchain
register_toolchains("@//build/prost_toolchain")
# Custom Prost toolchain
register_toolchains(
"@//build/prost_toolchain",
)

###############################################################################
# Rust direct dependencies.
# https://bazelbuild.github.io/rules_rust/crate_universe_bzlmod.html#direct-dependencies
###############################################################################
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")

crate.spec(
package = "prost",
version = "0.13.0",
)
crate.spec(
default_features = False,
package = "prost-types",
version = "0.13.0",
)
crate.spec(
features = ["transport"],
package = "tonic",
version = "0.12.0",
)
crate.spec(
package = "tonic-build",
version = "0.12.0",
)
crate.spec(
package = "protoc-gen-prost",
version = "0.4",
)
crate.annotation(
crate = "protoc-gen-prost",
gen_binaries = ["protoc-gen-prost"],
)
crate.spec(
package = "protoc-gen-tonic",
version = "0.4",
)
crate.annotation(
crate = "protoc-gen-tonic",
gen_binaries = ["protoc-gen-tonic"],
)

# Rust dependencies. See thirdparty/BUILD.bazel
crate.spec(
default_features = False,
features = [
"macros",
"net",
"rt-multi-thread",
"signal",
],
package = "tokio",
version = "1.39.3",
)
crate.from_specs()
use_repo(crate, "crates")
Loading