2020-04-08 14:55:40 -04:00
|
|
|
# Determine this makefile's path.
|
|
|
|
|
# Be sure to place this BEFORE `include` directives, if any.
|
|
|
|
|
THIS_FILE := $(lastword $(MAKEFILE_LIST))
|
|
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
TMP_DIR := $(shell mktemp -d)
|
|
|
|
|
REPO_PATH := github.com/hashicorp/watchtower
|
2020-04-08 14:55:40 -04:00
|
|
|
|
2020-05-04 11:23:35 -04:00
|
|
|
export APIGEN_BASEPATH := $(shell pwd)
|
|
|
|
|
|
2020-05-01 12:38:01 -07:00
|
|
|
bootstrap:
|
|
|
|
|
go generate -tags tools tools/tools.go
|
|
|
|
|
|
2020-05-04 14:58:18 -04:00
|
|
|
gen: proto api
|
|
|
|
|
|
2020-05-04 11:02:02 -04:00
|
|
|
api:
|
2020-05-04 11:23:35 -04:00
|
|
|
$(MAKE) --environment-overrides -C api/internal/genapi api
|
2020-05-04 11:02:02 -04:00
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
### 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
|
2020-04-08 14:55:40 -04:00
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
protolint:
|
|
|
|
|
@buf check lint
|
2020-04-08 14:55:40 -04:00
|
|
|
|
2020-04-28 11:20:37 -07:00
|
|
|
protobuild:
|
2020-05-04 11:23:35 -04:00
|
|
|
# To add a new directory containing a proto pass the proto's root path in
|
|
|
|
|
# through the --proto_path flag.
|
2020-04-28 11:20:37 -07:00
|
|
|
@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}/* .
|
|
|
|
|
|
2020-05-01 18:05:54 -04:00
|
|
|
@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/services/v1/*.proto
|
2020-04-28 11:20:37 -07:00
|
|
|
@protoc-go-inject-tag -input=./internal/oplog/store/oplog.pb.go
|
|
|
|
|
@protoc-go-inject-tag -input=./internal/oplog/oplog_test/oplog_test.pb.go
|
2020-05-08 11:36:28 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/iam/store/scope.pb.go
|
2020-05-05 13:29:47 -04:00
|
|
|
@protoc-go-inject-tag -input=./internal/db/db_test/db_test.pb.go
|
2020-04-28 11:20:37 -07:00
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
|
@rm -R ${TMP_DIR}
|
|
|
|
|
|
|
|
|
|
|
2020-05-04 14:58:18 -04:00
|
|
|
.PHONY: api bootstrap cleanup gen proto
|
2020-04-28 11:20:37 -07:00
|
|
|
|
|
|
|
|
.NOTPARALLEL:
|