* Setup buf to see and process protos correctly. This commit adds a proposed directory structure for protos. Included is a rough draft of the Ec2Catalog protos. * Setup buf to see and process protos correctly. This commit adds a proposed directory structure for protos, but leaves the existing oplog related protos alone. Included is a rough draft of the Ec2Catalog protos. * Update makefile and add script to generate the appropriate pb.go files. * Add comment explaining google.golang.org/protobuf vs github.com/golang/protobuf * Move all protos and generated files to under the internal directory. This also required updating the buf config to explicitly name the excluded linted proto files under oplog since previously /internal/ was listed as a root in buf. Future commit will move oplog proto files to be with the others. * Moved oplog related protos to under the proto directory and regenerated. * Update the oplog protos to be compliant with buf lint.
43 lines
1.5 KiB
Makefile
43 lines
1.5 KiB
Makefile
# Determine this makefile's path.
|
|
# Be sure to place this BEFORE `include` directives, if any.
|
|
THIS_FILE := $(lastword $(MAKEFILE_LIST))
|
|
|
|
TMP_DIR := $(shell mktemp -d)
|
|
REPO_PATH := github.com/hashicorp/watchtower
|
|
|
|
### oplog requires protoc-gen-go v1.20.0 or later
|
|
# GO111MODULE=on go get -u github.com/golang/protobuf/protoc-gen-go@v1.40
|
|
proto: protolint protobuild cleanup
|
|
|
|
protolint:
|
|
@buf check lint
|
|
|
|
protobuild:
|
|
# To add a new directory containing a proto pass the proto's root path in through the --proto_path flag.
|
|
@bash make/protoc_gen_plugin.bash \
|
|
"--proto_path=internal/proto/local" \
|
|
"--proto_include_path=internal/proto/third_party" \
|
|
"--plugin_name=go" \
|
|
"--plugin_out=plugins=grpc:${TMP_DIR}"
|
|
@bash make/protoc_gen_plugin.bash \
|
|
"--proto_path=internal/proto/local/" \
|
|
"--proto_include_path=internal/proto/third_party" \
|
|
"--plugin_name=grpc-gateway" \
|
|
"--plugin_out=logtostderr=true:${TMP_DIR}"
|
|
|
|
# Move the generated files from the tmp file subdirectories into the current repo.
|
|
cp -R ${TMP_DIR}/${REPO_PATH}/* .
|
|
|
|
@protoc --proto_path=internal/proto/local --proto_path=internal/proto/third_party --swagger_out=logtostderr=true,disable_default_errors=true,include_package_in_tags=true,fqn_for_swagger_name=true,allow_merge,merge_file_name=controller:internal/gen/. internal/proto/local/controller/api/v1/*.proto
|
|
@protoc-go-inject-tag -input=./internal/oplog/store/oplog.pb.go
|
|
@protoc-go-inject-tag -input=./internal/oplog/oplog_test/oplog_test.pb.go
|
|
|
|
|
|
cleanup:
|
|
@rm -R ${TMP_DIR}
|
|
|
|
|
|
.PHONY: proto
|
|
|
|
.NOTPARALLEL:
|