forked from milvus-io/milvus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance: Refine protobuf dependency installation in Makefile (milvus-…
…io#35072) Related to milvus-io#34394 --------- Signed-off-by: Congqi Xia <[email protected]>
- Loading branch information
1 parent
f7b5039
commit ac91960
Showing
1 changed file
with
23 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,14 @@ INSTALL_GOFUMPT := $(findstring $(GOFUMPT_VERSION),$(GOFUMPT_OUTPUT)) | |
GOTESTSUM_VERSION := 1.11.0 | ||
GOTESTSUM_OUTPUT := $(shell $(INSTALL_PATH)/gotestsum --version 2>/dev/null) | ||
INSTALL_GOTESTSUM := $(findstring $(GOTESTSUM_VERSION),$(GOTESTSUM_OUTPUT)) | ||
# protoc-gen-go | ||
PROTOC_GEN_GO_VERSION := 1.33.0 | ||
PROTOC_GEN_GO_OUTPUT := $(shell print | $(INSTALL_PATH)/protoc-gen-go --version 2>/dev/null) | ||
INSTALL_PROTOC_GEN_GO := $(findstring $(PROTOC_GEN_GO_VERSION),$(PROTOC_GEN_GO_OUTPUT)) | ||
# protoc-gen-go-grpc | ||
PROTOC_GEN_GO_GRPC_VERSION := 1.3.0 | ||
PROTOC_GEN_GO_GRPC_OUTPUT := $(shell print | $(INSTALL_PATH)/protoc-gen-go-grpc --version 2>/dev/null) | ||
INSTALL_PROTOC_GEN_GO_GRPC := $(findstring $(PROTOC_GEN_GO_GRPC_VERSION),$(PROTOC_GEN_GO_GRPC_OUTPUT)) | ||
|
||
index_engine = knowhere | ||
|
||
|
@@ -105,6 +113,19 @@ getdeps: | |
echo "gotestsum v$(GOTESTSUM_VERSION) already installed";\ | ||
fi | ||
|
||
get-proto-deps: | ||
@mkdir -p $(INSTALL_PATH) # make sure directory exists | ||
@if [ -z "$(INSTALL_PROTOC_GEN_GO)" ]; then \ | ||
echo "install protoc-gen-go $(PROTOC_GEN_GO_VERSION) to $(INSTALL_PATH)" && GOBIN=$(INSTALL_PATH) go install google.golang.org/protobuf/cmd/protoc-gen-go@v$(PROTOC_GEN_GO_VERSION); \ | ||
else \ | ||
echo "protoc-gen-go@v$(PROTOC_GEN_GO_VERSION) already installed";\ | ||
fi | ||
@if [ -z "$(INSTALL_PROTOC_GEN_GO_GRPC)" ]; then \ | ||
echo "install protoc-gen-go-grpc $(PROTOC_GEN_GO_GRPC_VERSION) to $(INSTALL_PATH)" && GOBIN=$(INSTALL_PATH) go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v$(PROTOC_GEN_GO_GRPC_VERSION); \ | ||
else \ | ||
echo "protoc-gen-go-grpc@v$(PROTOC_GEN_GO_GRPC_VERSION) already installed";\ | ||
fi | ||
|
||
tools/bin/revive: tools/check/go.mod | ||
cd tools/check; \ | ||
$(GO) build -pgo=$(PGO_PATH)/default.pgo -o ../bin/revive github.com/mgechev/revive | ||
|
@@ -218,18 +239,12 @@ build-3rdparty: | |
@echo "Build 3rdparty ..." | ||
@(env bash $(PWD)/scripts/3rdparty_build.sh -o ${use_opendal}) | ||
|
||
generated-proto-without-cpp: download-milvus-proto | ||
generated-proto-without-cpp: download-milvus-proto get-proto-deps | ||
@echo "Generate proto ..." | ||
@mkdir -p ${INSTALL_PATH} | ||
@which protoc-gen-go 1>/dev/null || (echo "Installing protoc-gen-go" && GOBIN=${INSTALL_PATH} go install google.golang.org/protobuf/cmd/[email protected]) | ||
@which protoc-gen-go-grpc 1>/dev/null || (echo "Installing protoc-gen-go-grpc" && GOBIN=${INSTALL_PATH} go install google.golang.org/grpc/cmd/[email protected]) | ||
@(env bash $(PWD)/scripts/generate_proto.sh ${INSTALL_PATH}) | ||
|
||
generated-proto: download-milvus-proto build-3rdparty | ||
generated-proto: download-milvus-proto build-3rdparty get-proto-deps | ||
@echo "Generate proto ..." | ||
@mkdir -p ${INSTALL_PATH} | ||
@which protoc-gen-go 1>/dev/null || (echo "Installing protoc-gen-go" && GOBIN=${INSTALL_PATH} go install google.golang.org/protobuf/cmd/[email protected]) | ||
@which protoc-gen-go-grpc 1>/dev/null || (echo "Installing protoc-gen-go-grpc" && GOBIN=${INSTALL_PATH} go install google.golang.org/grpc/cmd/[email protected]) | ||
@(env bash $(PWD)/scripts/generate_proto.sh ${INSTALL_PATH}) | ||
|
||
build-cpp: generated-proto | ||
|