Enforce a minimum version for protoc (#17122)

This commit is contained in:
Josh Black 2022-09-13 19:46:35 -07:00 committed by GitHub
parent bb0f93044f
commit 14c8008181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -15,6 +15,7 @@ GOFMT_FILES?=$$(find . -name '*.go' | grep -v pb.go | grep -v vendor)
GO_VERSION_MIN=1.19.1
PROTOC_VERSION_MIN=3.21.5
GO_CMD?=go
CGO_ENABLED?=0
ifneq ($(FDB_ENABLED), )
@ -170,6 +171,7 @@ static-dist: ember-dist
static-dist-dev: ember-dist-dev
proto: bootstrap
@sh -c "'$(CURDIR)/scripts/protocversioncheck.sh' '$(PROTOC_VERSION_MIN)'"
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative vault/*.proto
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative vault/activity/activity_log.proto
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative helper/storagepacker/types.proto

17
scripts/protocversioncheck.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
PROTOC_CMD=${PROTOC_CMD:-protoc}
PROTOC_VERSION_EXACT="$1"
echo "==> Checking that protoc is at version $1..."
PROTOC_VERSION=$($PROTOC_CMD --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
if [ "$PROTOC_VERSION" == "$PROTOC_VERSION_EXACT" ]; then
echo "Using protoc version $PROTOC_VERSION"
else
echo "protoc should be at $PROTOC_VERSION_EXACT; found $PROTOC_VERSION."
echo "If your version is higher than the version this script is looking for, updating the Makefile with the newer version."
exit 1
fi