Never attempt to build protocol buffers offline

Building protocol buffers requires fetching utilities from the
Internet. Typically this is done at development time and the finished
buffers are included in dist; but if timestamps get off this can lead
mock to try to rebuild them during an offline build, causing the build
to fail.

This change moves all of the protoc targets into a section of the
Makefile that is disabled during an offline build.

- Closes #1155

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-03-28 16:53:39 -06:00
parent 45c933c846
commit bd468537ed
2 changed files with 20 additions and 20 deletions

View File

@@ -160,25 +160,6 @@ reference: wwctl
latexpdf: reference
make -C userdocs latexpdf
protofiles = internal/pkg/api/routes/wwapiv1/routes.pb.go \
internal/pkg/api/routes/wwapiv1/routes.pb.gw.go \
internal/pkg/api/routes/wwapiv1/routes_grpc.pb.go
.PHONY: proto
proto: $(protofiles)
routes_proto = internal/pkg/api/routes/v1/routes.proto
$(protofiles): $(routes_proto)
PATH=$(TOOLS_BIN):$(PATH) $(PROTOC) \
-I /usr/include -I $(shell dirname $(routes_proto)) -I=. \
--grpc-gateway_opt logtostderr=true \
--go_out=. \
--go-grpc_out=. \
--grpc-gateway_out=. \
routes.proto
.PHONY: cleanproto
cleanproto:
rm -f $(protofiles)
.PHONY: cleanconfig
cleanconfig:
@@ -231,7 +212,25 @@ dist: vendor
lint: $(GOLANGCI_LINT)
$(protofiles): $(PROTOC) $(PROTOC_GEN_GRPC_GATEWAY) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC)
protofiles = internal/pkg/api/routes/wwapiv1/routes.pb.go \
internal/pkg/api/routes/wwapiv1/routes.pb.gw.go \
internal/pkg/api/routes/wwapiv1/routes_grpc.pb.go
.PHONY: proto
proto: $(protofiles)
routes_proto = internal/pkg/api/routes/v1/routes.proto
$(protofiles): $(routes_proto) $(PROTOC) $(PROTOC_GEN_GRPC_GATEWAY) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC)
PATH=$(TOOLS_BIN):$(PATH) $(PROTOC) \
-I /usr/include -I $(shell dirname $(routes_proto)) -I=. \
--grpc-gateway_opt logtostderr=true \
--go_out=. \
--go-grpc_out=. \
--grpc-gateway_out=. \
routes.proto
.PHONY: cleanproto
cleanproto:
rm -f $(protofiles)
clean: cleanvendor
endif