Skip to content

Commit

Permalink
Use protoc-gen-go instead of protoc-gen-gogoctrd
Browse files Browse the repository at this point in the history
Signed-off-by: Kazuyoshi Kato <[email protected]>
  • Loading branch information
kzys committed Apr 22, 2022
1 parent e044759 commit fd37cc7
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 352 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ generate: protos
@echo "$(WHALE) $@"
@PATH="${ROOTDIR}/bin:${PATH}" $(GO) generate -x ${PACKAGES}

protos: bin/protoc-gen-gogoctrd ## generate protobuf
protos: bin/protoc-gen-go-fieldpath
@echo "$(WHALE) $@"
@find . -path ./vendor -prune -false -o -name '*.pb.go' | xargs rm
$(eval TMPDIR := $(shell mktemp -d))
Expand All @@ -168,7 +168,7 @@ protos: bin/protoc-gen-gogoctrd ## generate protobuf
@(PATH="${ROOTDIR}/bin:${PATH}" protobuild --quiet ${NON_API_PACKAGES})
@mv ${TMPDIR}/vendor ${ROOTDIR}
@rm -rf ${TMPDIR}
go-fix-acronym -w -a '(Io|Uuid|Os)$$' $(shell find api -name '*.pb.go')
go-fix-acronym -w -a '(Id|Io|Uuid|Os)$$' $(shell find api/ runtime/ -name '*.pb.go')

check-protos: protos ## check if protobufs needs to be generated again
@echo "$(WHALE) $@"
Expand Down
21 changes: 4 additions & 17 deletions Protobuild.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version = "1"
generator = "gogoctrd"
plugins = ["grpc", "fieldpath"]
version = "2"
generators = ["go"]

# Control protoc include paths. Below are usually some good defaults, but feel
# free to try it without them if it works for your project.
Expand All @@ -12,33 +11,21 @@ plugins = ["grpc", "fieldpath"]
# Paths that should be treated as include roots in relation to the vendor
# directory. These will be calculated with the vendor directory nearest the
# target package.
packages = ["github.com/gogo/protobuf", "github.com/gogo/googleapis"]
packages = ["github.com/gogo/protobuf"]

# Paths that will be added untouched to the end of the includes. We use
# `/usr/local/include` to pickup the common install location of protobuf.
# This is the default.
after = ["/usr/local/include", "/usr/include"]

# This section maps protobuf imports to Go packages. These will become
# `-M` directives in the call to the go protobuf generator.
[packages]
"gogoproto/gogo.proto" = "github.com/gogo/protobuf/gogoproto"
"google/protobuf/any.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/empty.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/descriptor.proto" = "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
"google/protobuf/field_mask.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/timestamp.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/duration.proto" = "github.com/gogo/protobuf/types"
"google/rpc/status.proto" = "github.com/gogo/googleapis/google/rpc"

[[overrides]]
# enable ttrpc and disable fieldpath and grpc for the shim
prefixes = [
"github.com/containerd/containerd/runtime/v1/shim/v1",
"github.com/containerd/containerd/api/runtime/task/v2",
"github.com/containerd/containerd/api/runtime/sandbox/v1",
]
plugins = ["ttrpc"]
generators = ["go", "go-ttrpc"]

# Lock down runc config
[[descriptors]]
Expand Down
22 changes: 7 additions & 15 deletions api/Protobuild.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version = "1"
generator = "gogoctrd"
plugins = ["grpc", "fieldpath"]
version = "2"
generators = ["go", "go-grpc"]

# Control protoc include paths. Below are usually some good defaults, but feel
# free to try it without them if it works for your project.
Expand All @@ -12,7 +11,7 @@ plugins = ["grpc", "fieldpath"]
# Paths that should be treated as include roots in relation to the vendor
# directory. These will be calculated with the vendor directory nearest the
# target package.
packages = ["github.com/gogo/protobuf", "github.com/gogo/googleapis"]
packages = ["github.com/gogo/protobuf"]

# Paths that will be added untouched to the end of the includes. We use
# `/usr/local/include` to pickup the common install location of protobuf.
Expand All @@ -22,22 +21,15 @@ plugins = ["grpc", "fieldpath"]
# This section maps protobuf imports to Go packages. These will become
# `-M` directives in the call to the go protobuf generator.
[packages]
"gogoproto/gogo.proto" = "github.com/gogo/protobuf/gogoproto"
"google/protobuf/any.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/empty.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/descriptor.proto" = "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
"google/protobuf/field_mask.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/timestamp.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/duration.proto" = "github.com/gogo/protobuf/types"
"google/rpc/status.proto" = "github.com/gogo/googleapis/google/rpc"
"google/rpc/status.proto" = "google.golang.org/genproto/googleapis/rpc/status"

[[overrides]]
prefixes = ["github.com/containerd/containerd/api/events"]
plugins = ["fieldpath"] # disable grpc for this package
generators = ["go", "go-ttrpc", "go-fieldpath"]

[[overrides]]
prefixes = ["github.com/containerd/containerd/api/services/ttrpc/events/v1"]
plugins = ["ttrpc", "fieldpath"]
generators = ["go", "go-ttrpc", "go-fieldpath"]

[[overrides]]
# enable ttrpc and disable fieldpath and grpc for the shim
Expand All @@ -46,7 +38,7 @@ prefixes = [
"github.com/containerd/containerd/api/runtime/task/v2",
"github.com/containerd/containerd/api/runtime/sandbox/v1",
]
plugins = ["ttrpc"]
generators = ["go", "go-ttrpc"]

# Aggregrate the API descriptors to lock down API changes.
[[descriptors]]
Expand Down
73 changes: 0 additions & 73 deletions cmd/protoc-gen-gogoctrd/customnameid.go

This file was deleted.

45 changes: 0 additions & 45 deletions cmd/protoc-gen-gogoctrd/main.go

This file was deleted.

Loading

0 comments on commit fd37cc7

Please sign in to comment.