mirror of https://github.com/containerd/nri.git
Makefile: build proto files unconditionally
Ditch the makefile pattern rule which simply doesn't work in scenarios where both the source and the build targets are stored in the git repo (as git operations mangle the time stamps). So much grey hair avoided when the stuff just force generates everything instead of leaving you wonder why the tools didn't work as expected. Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
This commit is contained in:
parent
25d9391690
commit
9623748f54
18
Makefile
18
Makefile
|
|
@ -36,7 +36,6 @@ COVERAGE_PATH := $(BUILD_PATH)/coverage
|
|||
|
||||
PROTOBUF_VERSION = 3.20.1
|
||||
PROTO_SOURCES = $(shell find pkg -name '*.proto' | grep -v /vendor/)
|
||||
PROTO_GOFILES = $(patsubst %.proto,%.pb.go,$(PROTO_SOURCES))
|
||||
PROTO_INCLUDE = -I $(PWD) -I$(PROTOC_PATH)/include
|
||||
PROTO_OPTIONS = --proto_path=. $(PROTO_INCLUDE) \
|
||||
--go_opt=paths=source_relative --go_out=. \
|
||||
|
|
@ -80,11 +79,15 @@ FORCE:
|
|||
# build targets
|
||||
#
|
||||
|
||||
build-proto: check-protoc install-ttrpc-plugin install-wasm-plugin install-protoc-dependencies $(PROTO_GOFILES)
|
||||
build-proto: check-protoc install-ttrpc-plugin install-wasm-plugin install-protoc-dependencies
|
||||
for src in $(PROTO_SOURCES); do \
|
||||
$(PROTO_COMPILE) $$src; \
|
||||
done
|
||||
sed -i '1s;^;//go:build !wasip1\n\n;' pkg/api/api_ttrpc.pb.go
|
||||
|
||||
.PHONY: build-proto-dockerized
|
||||
build-proto-dockerized:
|
||||
$(Q)docker build --build-arg ARTIFACTS="$(dir $(PROTO_GOFILES))" --target final \
|
||||
$(Q)docker build --build-arg ARTIFACTS="$(dir $(PROTO_SOURCES))" --target final \
|
||||
--output type=local,dest=$(RESOLVED_PWD) \
|
||||
-f hack/Dockerfile.buildproto .
|
||||
$(Q)tar xf artifacts.tgz && rm -f artifacts.tgz
|
||||
|
|
@ -176,15 +179,6 @@ validate-repo-no-changes:
|
|||
exit 1; \
|
||||
}
|
||||
|
||||
#
|
||||
# proto generation targets
|
||||
#
|
||||
|
||||
%.pb.go: %.proto
|
||||
$(Q)echo "Generating $@..."; \
|
||||
$(PROTO_COMPILE) $<
|
||||
sed -i '1s;^;//go:build !wasip1\n\n;' pkg/api/api_ttrpc.pb.go
|
||||
|
||||
#
|
||||
# targets for installing dependencies
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in New Issue