Skip to content

Commit

Permalink
Adjust protoc command line for latest versions of plugins; fix protoc…
Browse files Browse the repository at this point in the history
… Go plugin versions and install plugins locally.

Signed-off-by: Felix Fontein <[email protected]>
  • Loading branch information
felixfontein committed Dec 2, 2024
1 parent 47a6c97 commit eda6ec1
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 219 deletions.
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ SYFT_VERSION ?= v0.87.0
GORELEASER := $(BIN_DIR)/goreleaser
GORELEASER_VERSION ?= v1.20.0

PROTOC_GO := $(BIN_DIR)/protoc-gen-go
PROTOC_GO_VERSION ?= v1.35.2

PROTOC_GO_GRPC := $(BIN_DIR)/protoc-gen-go-grpc
PROTOC_GO_GRPC_VERSION ?= v1.5.1

RSTCHECK := $(shell command -v rstcheck)
MARKDOWNLINT := $(shell command -v mdl)

Expand Down Expand Up @@ -74,11 +80,11 @@ showcoverage: test
$(GO) tool cover -html=profile.out

.PHONY: generate
generate: keyservice/keyservice.pb.go
generate: install-protoc-go install-protoc-go-grpc keyservice/keyservice.pb.go
$(GO) generate

%.pb.go: %.proto
protoc --go_grpc_opt=require_unimplemented_servers=false --go_grpc_out=. --go_out=. $<
protoc --plugin gen-go=$(PROTOC_GO) --plugin gen-go-grpc=$(PLUGIN_GO_GRPC) --go-grpc_opt=require_unimplemented_servers=false --go-grpc_out=. --go_out=. $<

.PHONY: functional-tests
functional-tests:
Expand Down Expand Up @@ -112,6 +118,14 @@ install-goreleaser:
install-syft:
$(call go-install-tool,$(SYFT),github.com/anchore/syft/cmd/syft@$(SYFT_VERSION),$(SYFT_VERSION))

.PHONY: install-protoc-go
install-protoc-go:
$(call go-install-tool,$(PROTOC_GO),google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GO_VERSION),$(PROTOC_GO_VERSION))

.PHONY: install-protoc-go-grpc
install-protoc-go-grpc:
$(call go-install-tool,$(PROTOC_GO_GRPC),google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GO_GRPC_VERSION),$(PROTOC_GO_GRPC_VERSION))

# go-install-tool will 'go install' any package $2 and install it to $1.
define go-install-tool
@[ -f $(1)-$(3) ] || { \
Expand Down
Loading

0 comments on commit eda6ec1

Please sign in to comment.