Skip to content

Commit e922ade

Browse files
committed
basic loading of ring example
1 parent 7020ecc commit e922ade

File tree

9 files changed

+1051
-1
lines changed

9 files changed

+1051
-1
lines changed

examples/proto_with_toolchain/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
.DS_Store
33
/proto/.DS_Store
44
/proto/grpc_server/.DS_Store
5-
/proto/proto_bindings/.DS_Store
5+
/proto/proto_bindings/.DS_Store

examples/ring_example/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/bazel-*
2+
.DS_Store
3+
/proto/.DS_Store
4+
/proto/grpc_server/.DS_Store
5+
/proto/proto_bindings/.DS_Store

examples/ring_example/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
load("@rules_rust//rust:defs.bzl", "rust_binary")
2+
3+
rust_binary(
4+
name = "ring_demo",
5+
srcs = ["src/main.rs"],
6+
deps = [
7+
"@crates//:ring",
8+
],
9+
edition = "2021",
10+
)

examples/ring_example/Cargo.lock

Lines changed: 147 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/ring_example/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "ring_example"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
ring = "0.17.4"

examples/ring_example/MODULE.bazel

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Ring example using crate_universe from_cargo API"""
2+
3+
module(
4+
name = "ring_example",
5+
version = "0.0.0",
6+
)
7+
8+
###############################################################################
9+
# B A Z E L C E N T R A L R E G I S T R Y
10+
###############################################################################
11+
12+
bazel_dep(name = "rules_rust", version = "0.0.0")
13+
local_path_override(
14+
module_name = "rules_rust",
15+
path = "../..",
16+
)
17+
18+
bazel_dep(name = "platforms", version = "0.0.11")
19+
20+
###############################################################################
21+
# T O O L C H A I N S
22+
###############################################################################
23+
24+
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
25+
use_repo(rust, "rust_toolchains")
26+
27+
register_toolchains("@rust_toolchains//:all")
28+
29+
###############################################################################
30+
# C R A T E U N I V E R S E
31+
###############################################################################
32+
33+
crate = use_extension(
34+
"@rules_rust//crate_universe:extensions.bzl",
35+
"crate",
36+
)
37+
crate.from_cargo(
38+
name = "crates",
39+
cargo_lockfile = "//:Cargo.lock",
40+
manifests = [
41+
"//:Cargo.toml",
42+
],
43+
)
44+
use_repo(crate, "crates")

0 commit comments

Comments
 (0)