Skip to content

Commit

Permalink
Use tonic for rust proto and grpc. Updates to handle dependency chains.
Browse files Browse the repository at this point in the history
  • Loading branch information
echochamber committed Jun 6, 2023
1 parent 978b48d commit 5e60e62
Show file tree
Hide file tree
Showing 286 changed files with 11,640 additions and 16,225 deletions.
4 changes: 0 additions & 4 deletions .bazelrc

This file was deleted.

1 change: 0 additions & 1 deletion .bazelversion

This file was deleted.

2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencie

crate_universe_dependencies(bootstrap = True)

load("//rust/crates:crates.bzl", "crate_repositories")
load("//rust:crate_deps.bzl", "crate_repositories")

crate_repositories()

Expand Down
11 changes: 0 additions & 11 deletions example/rust/rust_grpc_compile/BUILD.bazel

This file was deleted.

30 changes: 0 additions & 30 deletions example/rust/rust_grpc_compile/WORKSPACE

This file was deleted.

9 changes: 0 additions & 9 deletions example/rust/rust_grpc_library/BUILD.bazel

This file was deleted.

30 changes: 0 additions & 30 deletions example/rust/rust_grpc_library/WORKSPACE

This file was deleted.

23 changes: 19 additions & 4 deletions example/rust/rust_prost_proto_compile/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
load("@rules_proto_grpc//rust:defs.bzl", "rust_prost_proto_compile")

rust_prost_proto_compile(
name = "person_rust_proto",
name = "person_prost",
declared_proto_packages = ["example.proto"],
options = {
"//rust:rust_prost_plugin": ["type_attribute=.other.space.Person=#[derive(Eq\\,Hash)]"],
},
protos = ["@rules_proto_grpc//example/proto:person_proto"],
)

rust_prost_proto_compile(
name = "place_rust_proto",
name = "place_prost",
declared_proto_packages = ["example.proto"],
options = {
"//rust:rust_prost_plugin": ["type_attribute=.other.space.Place=#[derive(Eq\\,Hash)]"],
},
protos = ["@rules_proto_grpc//example/proto:place_proto"],

prost_proto_deps = []
)

rust_prost_proto_compile(
name = "thing_rust_proto",
name = "thing_prost",
declared_proto_packages = ["example.proto"],
options = {
# Known limitation, can't derive if the type contains a pbjson type.
# "//rust:rust_prost_plugin": ["type_attribute=.other.space.Thing=#[derive(Eq\\,Hash)]"],
},
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)
)
17 changes: 7 additions & 10 deletions example/rust/rust_prost_proto_compile/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@ local_repository(
)

load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")

rules_proto_grpc_toolchains()

rules_proto_grpc_repos()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")

rules_proto_dependencies()

rules_proto_toolchains()

load("@rules_proto_grpc//rust:repositories.bzl", rules_proto_grpc_rust_repos = "rust_repos")

rules_proto_grpc_rust_repos()
load("@rules_proto_grpc//rust:repositories.bzl", "rust_repos")
rust_repos()

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

rules_rust_dependencies()

rust_register_toolchains(edition = "2021")

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
crate_universe_dependencies(bootstrap = True)
load("@rules_proto_grpc//rust:crate_deps.bzl", "crate_repositories")
crate_repositories()
26 changes: 24 additions & 2 deletions example/rust/rust_prost_proto_library/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
load("@rules_proto_grpc//rust:defs.bzl", "rust_prost_proto_library")


rust_prost_proto_library(
name = "proto_rust_prost_proto",
name = "personplace_prost",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:thing_proto",
],
options = {
"//rust:rust_prost_plugin": [
"type_attribute=.example.proto.Person=#[derive(Eq\\,Hash)]",
"type_attribute=.example.proto.Place=#[derive(Eq\\,Hash)]",
]},
prost_proto_deps = [
":thing_prost"
]
)

rust_prost_proto_library(
name = "thing_prost",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:thing_proto",
],
options = {
"//rust:rust_prost_plugin": [
# Intentionally Ommitted.
# "type_attribute=.example.proto.Thing=#[derive(Eq\\,Hash)]",
]}
)
17 changes: 7 additions & 10 deletions example/rust/rust_prost_proto_library/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@ local_repository(
)

load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")

rules_proto_grpc_toolchains()

rules_proto_grpc_repos()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")

rules_proto_dependencies()

rules_proto_toolchains()

load("@rules_proto_grpc//rust:repositories.bzl", rules_proto_grpc_rust_repos = "rust_repos")

rules_proto_grpc_rust_repos()
load("@rules_proto_grpc//rust:repositories.bzl", "rust_repos")
rust_repos()

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

rules_rust_dependencies()

rust_register_toolchains(edition = "2021")

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
crate_universe_dependencies(bootstrap = True)
load("@rules_proto_grpc//rust:crate_deps.bzl", "crate_repositories")
crate_repositories()
10 changes: 0 additions & 10 deletions example/rust/rust_proto_library/BUILD.bazel

This file was deleted.

30 changes: 0 additions & 30 deletions example/rust/rust_proto_library/WORKSPACE

This file was deleted.

19 changes: 10 additions & 9 deletions example/rust/rust_tonic_grpc_compile/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
load("@rules_proto_grpc//rust:defs.bzl", "rust_tonic_grpc_compile")
load("@rules_proto_grpc//rust:defs.bzl", "rust_tonic_grpc_compile", )

rust_tonic_grpc_compile(
name = "thing_rust_grpc",
protos = ["@rules_proto_grpc//example/proto:thing_proto"],
)

rust_tonic_grpc_compile(
name = "greeter_rust_grpc",
protos = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)
name = "greeter_tonic",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:greeter_grpc",
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:thing_proto",
]
)
17 changes: 7 additions & 10 deletions example/rust/rust_tonic_grpc_compile/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@ local_repository(
)

load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_repos", "rules_proto_grpc_toolchains")

rules_proto_grpc_toolchains()

rules_proto_grpc_repos()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")

rules_proto_dependencies()

rules_proto_toolchains()

load("@rules_proto_grpc//rust:repositories.bzl", rules_proto_grpc_rust_repos = "rust_repos")

rules_proto_grpc_rust_repos()
load("@rules_proto_grpc//rust:repositories.bzl", "rust_repos")
rust_repos()

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

rules_rust_dependencies()

rust_register_toolchains(edition = "2021")

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
crate_universe_dependencies(bootstrap = True)
load("@rules_proto_grpc//rust:crate_deps.bzl", "crate_repositories")
crate_repositories()
20 changes: 18 additions & 2 deletions example/rust/rust_tonic_grpc_library/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
load("@rules_proto_grpc//rust:defs.bzl", "rust_tonic_grpc_library")
load("@rules_proto_grpc//rust:defs.bzl", "rust_tonic_grpc_library", "rust_prost_proto_library")


rust_tonic_grpc_library(
name = "greeter_rust_tonic_grpc",
name = "greeter_tonic",
declared_proto_packages = ["example.proto"],
protos = [
"@rules_proto_grpc//example/proto:greeter_grpc",
"@rules_proto_grpc//example/proto:person_proto",
"@rules_proto_grpc//example/proto:place_proto",
"@rules_proto_grpc//example/proto:thing_proto",
],
options = {
"//rust:rust_prost_plugin": [
"type_attribute=.example.proto.Person=#[derive(Eq\\,Hash)]",
"type_attribute=.example.proto.Place=#[derive(Eq\\,Hash)]",
]},
)
# rust_prost_proto_library(
# name = "thing_prost",
# declared_proto_packages = ["example.proto"],
# protos = [
# "@rules_proto_grpc//example/proto:thing_proto",
# ],
# )
Loading

0 comments on commit 5e60e62

Please sign in to comment.