Add crate rules to rust examples template

This commit is contained in:
Adam Liddell 2023-06-24 22:38:01 +01:00
parent 5e60e62762
commit d3580920b9
7 changed files with 112 additions and 21 deletions

View File

@ -53,6 +53,15 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
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()
``BUILD.bazel``
^^^^^^^^^^^^^^^
@ -160,6 +169,15 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
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()
``BUILD.bazel``
^^^^^^^^^^^^^^^
@ -263,6 +281,15 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
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()
``BUILD.bazel``
^^^^^^^^^^^^^^^
@ -373,6 +400,15 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
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()
``BUILD.bazel``
^^^^^^^^^^^^^^^

View File

@ -4,24 +4,36 @@ 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", "rust_repos")
rust_repos()
load("@rules_proto_grpc//rust:repositories.bzl", rules_proto_grpc_rust_repos = "rust_repos")
rules_proto_grpc_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()
crate_repositories()

View File

@ -4,24 +4,36 @@ 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", "rust_repos")
rust_repos()
load("@rules_proto_grpc//rust:repositories.bzl", rules_proto_grpc_rust_repos = "rust_repos")
rules_proto_grpc_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()
crate_repositories()

View File

@ -4,24 +4,36 @@ 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", "rust_repos")
rust_repos()
load("@rules_proto_grpc//rust:repositories.bzl", rules_proto_grpc_rust_repos = "rust_repos")
rules_proto_grpc_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()
crate_repositories()

View File

@ -4,24 +4,36 @@ 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", "rust_repos")
rust_repos()
load("@rules_proto_grpc//rust:repositories.bzl", rules_proto_grpc_rust_repos = "rust_repos")
rules_proto_grpc_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()
crate_repositories()

View File

@ -1,14 +1,12 @@
"""rust protobuf and grpc rules."""
load(":rust_prost_compile.bzl",
_rust_tonic_grpc_compile = "rust_tonic_grpc_compile",
_rust_prost_proto_compile = "rust_prost_proto_compile")
load(
":macros.bzl",
_rust_prost_proto_library = "rust_prost_proto_library",
_rust_tonic_grpc_library = "rust_tonic_grpc_library")
load(":rust_prost_proto_compile.bzl", _rust_prost_proto_compile = "rust_prost_proto_compile")
load(":rust_tonic_grpc_compile.bzl", _rust_tonic_grpc_compile = "rust_tonic_grpc_compile")
load(":rust_prost_proto_library.bzl", _rust_prost_proto_library = "rust_prost_proto_library")
load(":rust_tonic_grpc_library.bzl", _rust_tonic_grpc_library = "rust_tonic_grpc_library")
# Export rust rules
rust_prost_proto_compile = _rust_prost_proto_compile
rust_tonic_grpc_compile = _rust_tonic_grpc_compile
rust_prost_proto_library = _rust_prost_proto_library
rust_tonic_grpc_library = _rust_tonic_grpc_library
rust_tonic_grpc_library = _rust_tonic_grpc_library

View File

@ -12,7 +12,16 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_regi
rules_rust_dependencies()
rust_register_toolchains(edition = "2021")`)
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()
`)
var rustLibraryRuleTemplateString = `load("//{{ .Lang.Dir }}:{{ .Rule.Base }}_{{ .Rule.Kind }}_compile.bzl", "{{ .Rule.Base }}_{{ .Rule.Kind }}_compile")
load("//:defs.bzl", "bazel_build_rule_common_attrs", "proto_compile_attrs")