-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bazel): make pgv compiler usable (#766) #patch
It wasn't using absolute labels, so the pgv_go_proto_library macro tries to reference non-existent labels in the users workspace. Also define the go_proto_compiler rule once, rather than one per go_proto_library.
- Loading branch information
Showing
2 changed files
with
26 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Define our protoc plugin in a rule that can be provided to go_proto_library#compilers | ||
This is in a separate BUILD file from /bazel/BUILD to avoid a dependency on rules_go for all users who load from it. | ||
If you use Gazelle, you can use a directive so that the pgv_plugin_go is automatically added to generated go_proto_library rules. | ||
See https://github.com/bazelbuild/bazel-gazelle#directives | ||
For example, in some/BUILD.bazel: | ||
# gazelle:go_grpc_compilers @com_envoyproxy_protoc_gen_validate//bazel/go:pgv_plugin_go, @io_bazel_rules_go//proto:go_grpc | ||
""" | ||
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler") | ||
|
||
go_proto_compiler( | ||
name = "pgv_plugin_go", | ||
suffix = ".pb.validate.go", | ||
valid_archive = False, | ||
plugin = "@com_envoyproxy_protoc_gen_validate//:protoc-gen-validate", | ||
options = ["lang=go"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters