Skip to content

Commit

Permalink
proto: compile _grpc.pb.go files (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianneville authored Jan 31, 2025
1 parent 474381a commit 8295ab9
Show file tree
Hide file tree
Showing 7 changed files with 366 additions and 276 deletions.
15 changes: 15 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ http_archive(
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/4.6.0.tar.gz"],
)

# googleapis has not had a release since 2016 - take the master version as of 31-jan-25
http_archive(
name = "com_google_googleapis",
sha256 = "79919526bf4a5f65d698bf07ef392c8f2bf3e8bce84217849cf53a8d3ea83b77",
strip_prefix = "googleapis-dd1210af5bee414c9e606f5637e0eb0fd9d894e8",
urls = ["https://github.com/googleapis/googleapis/archive/dd1210af5bee414c9e606f5637e0eb0fd9d894e8.tar.gz"],
)

load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
switched_rules_by_language(
name = "com_google_googleapis_imports",
cc = True,
go = True,
)

load(
"@rules_proto_grpc//:repositories.bzl",
"bazel_gazelle",
Expand Down
28 changes: 28 additions & 0 deletions common.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
load("@io_bazel_rules_go//proto:compiler.bzl", "go_proto_compiler")
load("@io_bazel_rules_go//proto/wkt:well_known_types.bzl", "PROTO_RUNTIME_DEPS", "WELL_KNOWN_TYPES_APIV2")

def use_new_compilers():
go_proto_compiler(
name = "go_protoc_gen_go",
options = [
"paths=source_relative",
],
plugin = "@org_golang_google_protobuf//cmd/protoc-gen-go",
suffix = ".pb.go",
visibility = ["//visibility:public"],
deps = PROTO_RUNTIME_DEPS + WELL_KNOWN_TYPES_APIV2,
)
go_proto_compiler(
name = "go_protoc_gen_go_grpc",
options = [
"paths=source_relative",
],
plugin = "@org_golang_google_grpc_cmd_protoc_gen_go_grpc//:protoc-gen-go-grpc",
suffix = "_grpc.pb.go",
visibility = ["//visibility:public"],
deps = PROTO_RUNTIME_DEPS + [
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
],
)
11 changes: 8 additions & 3 deletions proto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//:common.bzl", "use_new_compilers")

package(default_visibility = ["//visibility:public"])

use_new_compilers()

proto_library(
name = "common_definitions_proto",
srcs = [
Expand All @@ -15,7 +18,7 @@ proto_library(
go_proto_library(
name = "common_definitions_go_proto",
compilers = [
"@io_bazel_rules_go//proto:go_grpc",
"go_protoc_gen_go",
],
importpath = "github.com/openconfig/attestz/proto/common_definitions",
proto = ":common_definitions_proto",
Expand All @@ -35,7 +38,8 @@ proto_library(
go_proto_library(
name = "tpm_enrollz_go_proto",
compilers = [
"@io_bazel_rules_go//proto:go_grpc",
"go_protoc_gen_go",
"go_protoc_gen_go_grpc",
],
importpath = "github.com/openconfig/attestz/proto/tpm_enrollz",
proto = ":tpm_enrollz_proto",
Expand Down Expand Up @@ -64,7 +68,8 @@ proto_library(
go_proto_library(
name = "tpm_attestz_go_proto",
compilers = [
"@io_bazel_rules_go//proto:go_grpc",
"go_protoc_gen_go",
"go_protoc_gen_go_grpc",
],
importpath = "github.com/openconfig/attestz/proto/tpm_attestz",
proto = ":tpm_attestz_proto",
Expand Down
84 changes: 0 additions & 84 deletions proto/tpm_attestz/tpm_attestz.pb.go

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

105 changes: 105 additions & 0 deletions proto/tpm_attestz/tpm_attestz_grpc.pb.go

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

Loading

0 comments on commit 8295ab9

Please sign in to comment.