Skip to content

Commit

Permalink
Add and register toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
psalaberria002 committed May 21, 2024
1 parent 11311d1 commit 1f62032
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
6 changes: 6 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_license//rules:license.bzl", "license")
load("//proto:defs.bzl", "proto_toolchain")

license(
name = "license",
Expand All @@ -8,3 +9,8 @@ license(
licenses(["notice"])

exports_files(["LICENSE"])

proto_toolchain(
name = "proto_toolchain",
proto_compiler = "@com_google_protobuf//:protoc",
)
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ bazel_dep(name = "rules_cc", version = "0.0.1", dev_dependency = True)
bazel_dep(name = "googletest", version = "1.11.0", dev_dependency = True, repo_name = "com_google_googletest")
bazel_dep(name = "protobuf", version = "23.1", dev_dependency = True, repo_name = "com_google_protobuf")
bazel_dep(name = "platforms", version = "0.0.8", dev_dependency = True)

register_toolchains("//:proto_toolchain_toolchain", dev_dependency = True)
10 changes: 6 additions & 4 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions docs/defs.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions tests/current_toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
load("//proto:defs.bzl", "current_proto_toolchain")

current_proto_toolchain(
name = "current_proto_toolchain",
visibility = ["//visibility:public"],
)

genrule(
name = "gen_protoc_version_from_current_proto_toolchain",
srcs = [":current_proto_toolchain"],
outs = ["protoc_version_from_current_proto_toolchain"],
cmd = """
v=$$($(PROTOC) --version)
echo $$v > $(OUTS)
""",
toolchains = [":current_proto_toolchain"],
)

0 comments on commit 1f62032

Please sign in to comment.