1414# limitations under the License.
1515#
1616
17- ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
17+ ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
18+
19+ # install tools in project (tool) dir to not pollute the system
20+ TOOL_DIR := $(ROOT_DIR ) /tools
21+ export GOBIN =$(TOOL_DIR ) /bin
22+ export PATH := $(TOOL_DIR ) /bin:$(PATH )
23+
1824MVN := mvn -f java/pom.xml ${MAVEN_EXTRA_OPTS}
1925OS := linux
2026ifeq ($(shell uname -s) , Darwin)
@@ -24,12 +30,15 @@ TRINO_VERSION ?= 376
2430PYTHON_VERSION = ${shell python --version | grep -Eo '[0-9]\.[0-9]+'}
2531
2632PYTHON_VERSIONS := 3.9 3.10 3.11
33+
2734define get_env_name
2835$(subst .,,py$(1 ) )
2936endef
3037
3138
3239# General
40+ $(TOOL_DIR ) :
41+ mkdir -p $@ /bin
3342
3443format : format-python format-java
3544
@@ -561,43 +570,60 @@ build-ui:
561570
562571
563572# Go SDK & embedded
564- install-protoc-dependencies :
565- pip install " protobuf>=4.24.0,<5.0.0" " grpcio-tools>=1.56.2,<2" " mypy-protobuf>=3.1"
573+ PB_REL = https://github.com/protocolbuffers/protobuf/releases
574+ PB_VERSION = 3.11.2
575+ PB_ARCH := $(shell uname -m)
576+ ifeq ($(PB_ARCH ) , arm64)
577+ PB_ARCH=aarch_64
578+ endif
579+ PB_PROTO_FOLDERS =core registry serving types storage
580+
581+ $(TOOL_DIR ) /protoc-$(PB_VERSION ) -$(OS ) -$(PB_ARCH ) .zip : $(TOOL_DIR )
582+ cd $(TOOL_DIR ) && \
583+ curl -LO $(PB_REL ) /download/v$(PB_VERSION ) /protoc-$(PB_VERSION ) -$(OS ) -$(PB_ARCH ) .zip
566584
567- install-go-proto-dependencies :
585+ .PHONY : install-go-proto-dependencies
586+ install-go-proto-dependencies : $(TOOL_DIR ) /protoc-$(PB_VERSION ) -$(OS ) -$(PB_ARCH ) .zip
587+ unzip -u $(TOOL_DIR ) /protoc-$(PB_VERSION ) -$(OS ) -$(PB_ARCH ) .zip -d $(TOOL_DIR )
568588 go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
569589 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
570590
591+ .PHONY : compile-protos-go
592+ compile-protos-go : install-go-proto-dependencies
593+ $(foreach folder,$(PB_PROTO_FOLDERS ) , \
594+ protoc --proto_path=$(ROOT_DIR ) /protos \
595+ --go_out=$(ROOT_DIR ) /go/protos \
596+ --go_opt=module=github.com/feast-dev/feast/go/protos \
597+ --go-grpc_out=$(ROOT_DIR ) /go/protos \
598+ --go-grpc_opt=module=github.com/feast-dev/feast/go/protos $(ROOT_DIR ) /protos/feast/$(folder ) /* .proto; ) true
599+
571600# install-go-ci-dependencies:
572601 # go install golang.org/x/tools/cmd/goimports
573602 # python -m pip install "pybindgen==0.22.1" "grpcio-tools>=1.56.2,<2" "mypy-protobuf>=3.1"
574603
575- build-go :
576- compile-protos-go
604+ .PHONY : build-go
605+ build-go : compile-protos-go
577606 go build -o feast ./go/main.go
578607
608+ .PHONY : install-feast-ci-locally
579609install-feast-ci-locally :
580- pip install -e " .[ci]"
610+ uv pip install -e " .[ci]"
581611
582- test-go :
583- compile-protos-go
584- compile-protos-python
585- install-feast-ci-locally
612+ .PHONY : test-go
613+ test-go : compile-protos-go install-feast-ci-locally compile-protos-python
586614 CGO_ENABLED=1 go test -coverprofile=coverage.out ./... && go tool cover -html=coverage.out -o coverage.html
587615
616+ .PHONY : format-go
588617format-go :
589618 gofmt -s -w go/
590619
591- lint-go :
592- compile-protos-go
620+ .PHONY : lint-go
621+ lint-go : compile-protos-go
593622 go vet ./go/internal/feast
594623
624+ .PHONY : build-go-docker-dev
595625build-go-docker-dev :
596626 docker buildx build --build-arg VERSION=dev \
597627 -t feastdev/feature-server-go:dev \
598628 -f go/infra/docker/feature-server/Dockerfile --load .
599629
600- compile-protos-go :
601- install-go-proto-dependencies
602- install-protoc-dependencies
603- python setup.py build_go_protos
0 commit comments