Skip to content

Commit 9623748

Browse files
committed
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 <[email protected]>
1 parent 25d9391 commit 9623748

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

Makefile

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ COVERAGE_PATH := $(BUILD_PATH)/coverage
3636

3737
PROTOBUF_VERSION = 3.20.1
3838
PROTO_SOURCES = $(shell find pkg -name '*.proto' | grep -v /vendor/)
39-
PROTO_GOFILES = $(patsubst %.proto,%.pb.go,$(PROTO_SOURCES))
4039
PROTO_INCLUDE = -I $(PWD) -I$(PROTOC_PATH)/include
4140
PROTO_OPTIONS = --proto_path=. $(PROTO_INCLUDE) \
4241
--go_opt=paths=source_relative --go_out=. \
@@ -80,11 +79,15 @@ FORCE:
8079
# build targets
8180
#
8281

83-
build-proto: check-protoc install-ttrpc-plugin install-wasm-plugin install-protoc-dependencies $(PROTO_GOFILES)
82+
build-proto: check-protoc install-ttrpc-plugin install-wasm-plugin install-protoc-dependencies
83+
for src in $(PROTO_SOURCES); do \
84+
$(PROTO_COMPILE) $$src; \
85+
done
86+
sed -i '1s;^;//go:build !wasip1\n\n;' pkg/api/api_ttrpc.pb.go
8487

8588
.PHONY: build-proto-dockerized
8689
build-proto-dockerized:
87-
$(Q)docker build --build-arg ARTIFACTS="$(dir $(PROTO_GOFILES))" --target final \
90+
$(Q)docker build --build-arg ARTIFACTS="$(dir $(PROTO_SOURCES))" --target final \
8891
--output type=local,dest=$(RESOLVED_PWD) \
8992
-f hack/Dockerfile.buildproto .
9093
$(Q)tar xf artifacts.tgz && rm -f artifacts.tgz
@@ -176,15 +179,6 @@ validate-repo-no-changes:
176179
exit 1; \
177180
}
178181

179-
#
180-
# proto generation targets
181-
#
182-
183-
%.pb.go: %.proto
184-
$(Q)echo "Generating $@..."; \
185-
$(PROTO_COMPILE) $<
186-
sed -i '1s;^;//go:build !wasip1\n\n;' pkg/api/api_ttrpc.pb.go
187-
188182
#
189183
# targets for installing dependencies
190184
#

0 commit comments

Comments
 (0)