add grpc support
This commit is contained in:
23
Makefile
23
Makefile
@ -1,14 +1,23 @@
|
||||
CMD_NAME := ambient-local-exporter
|
||||
|
||||
.PHONY: all test build docker install clean
|
||||
.PHONY: all test build docker install clean proto check_protoc
|
||||
|
||||
VERSION ?= development # Default to "development" if VERSION is not set
|
||||
APIVERSION := v1alpha1
|
||||
API_DIR := api/$(APIVERSION)
|
||||
PROTO_DIRS := $(wildcard proto/*)
|
||||
PLATFORMS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
|
||||
OUTPUT_DIR := bin
|
||||
VER_PKG := gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version
|
||||
DOCKER_IMG := gitea.libretechconsulting.com/rmcguire/ambient-local-exporter
|
||||
|
||||
all: test build docker
|
||||
all: proto test build docker
|
||||
|
||||
proto: check_protoc $(API_DIR)
|
||||
protoc --proto_path=proto \
|
||||
--go_out=$(API_DIR) --go_opt=paths=source_relative \
|
||||
--go-grpc_out=$(API_DIR) --go-grpc_opt=paths=source_relative \
|
||||
$(foreach dir, $(PROTO_DIRS), $(wildcard $(dir)/*.proto))
|
||||
|
||||
test:
|
||||
go test -v ./...
|
||||
@ -37,3 +46,13 @@ install:
|
||||
|
||||
clean:
|
||||
rm -rf bin/${CMD_NAME}
|
||||
|
||||
check_protoc:
|
||||
@if ! command -v protoc-gen-go > /dev/null; then \
|
||||
echo "Error: protoc-gen-go not found in PATH"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if ! command -v protoc-gen-go-grpc > /dev/null; then \
|
||||
echo "Error: protoc-gen-go-grpc not found in PATH"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
Reference in New Issue
Block a user