Skip to content

Commit

Permalink
Add go mod replace when proto changes happen
Browse files Browse the repository at this point in the history
Signed-off-by: Derek McGowan <derek@mcg.dev>
(cherry picked from commit e69efd5)
Signed-off-by: Derek McGowan <derek@mcg.dev>
  • Loading branch information
dmcgowan committed May 28, 2024
1 parent 6b9f8e4 commit 4a2ca38
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ GOTEST ?= $(GO) test
OUTPUTDIR = $(join $(ROOTDIR), _output)
CRIDIR=$(OUTPUTDIR)/cri

.PHONY: clean all AUTHORS build binaries test integration generate protos check-protos coverage ci check help install uninstall vendor release static-release mandir install-man genman install-cri-deps cri-release cri-cni-release cri-integration install-deps bin/cri-integration.test
.PHONY: clean all AUTHORS build binaries test integration generate protos check-protos coverage ci check help install uninstall vendor release static-release mandir install-man genman install-cri-deps cri-release cri-cni-release cri-integration install-deps bin/cri-integration.test remove-replace clean-vendor
.DEFAULT: default

# Forcibly set the default goal to all, in case an include above brought in a rule definition.
Expand Down Expand Up @@ -180,6 +180,8 @@ protos: bin/protoc-gen-go-fieldpath
@mv ${TMPDIR}/vendor ${ROOTDIR}
@rm -rf ${TMPDIR}
go-fix-acronym -w -a '(Id|Io|Uuid|Os)$$' $(shell find api/ runtime/ -name '*.pb.go')
@test -z "$$(git status --short | grep "api/next.pb.txt" | tee /dev/stderr)" || \
$(GO) mod edit -replace=github.com/containerd/containerd/api=./api

check-protos: protos ## check if protobufs needs to be generated again
@echo "$(WHALE) $@"
Expand Down Expand Up @@ -470,6 +472,10 @@ root-coverage: ## generate coverage profiles for unit tests that require root
fi; \
done )

remove-replace:
@echo "$(WHALE) $@"
@$(GO) mod edit -dropreplace=github.com/containerd/containerd/api

vendor: ## ensure all the go.mod/go.sum files are up-to-date including vendor/ directory
@echo "$(WHALE) $@"
@$(GO) mod tidy
Expand All @@ -489,6 +495,8 @@ verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date
@rm -rf ${TMPDIR}
@${ROOTDIR}/script/verify-go-modules.sh integration/client

clean-vendor: remove-replace vendor


help: ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort

0 comments on commit 4a2ca38

Please sign in to comment.