Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#1525 from ditsuke/chore/add-apidif…
Browse files Browse the repository at this point in the history
…f-target-to-makefile

chore: Add apidiff target to Makefile
  • Loading branch information
k8s-ci-robot committed May 9, 2022
2 parents 6821812 + 675e083 commit ee4a286
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ GOVC := $(TOOLS_BIN_DIR)/govc
KIND := $(TOOLS_BIN_DIR)/kind
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
CONVERSION_VERIFIER := $(abspath $(TOOLS_BIN_DIR)/conversion-verifier)
TOOLING_BINARIES := $(CONTROLLER_GEN) $(CONVERSION_GEN) $(GINKGO) $(GOLANGCI_LINT) $(GOVC) $(KIND) $(KUSTOMIZE) $(CONVERSION_VERIFIER)
GO_APIDIFF := $(TOOLS_BIN_DIR)/go-apidiff
TOOLING_BINARIES := $(CONTROLLER_GEN) $(CONVERSION_GEN) $(GINKGO) $(GOLANGCI_LINT) $(GOVC) $(KIND) $(KUSTOMIZE) $(CONVERSION_VERIFIER) $(GO_APIDIFF)
ARTIFACTS_PATH := $(ROOT_DIR)/_artifacts

# Set --output-base for conversion-gen if we are not within GOPATH
Expand Down Expand Up @@ -227,6 +228,12 @@ lint-shell: ## Lint the project's shell scripts
fix: GOLANGCI_LINT_FLAGS = --fast=false --fix
fix: lint-go ## Tries to fix errors reported by lint-go-full target

APIDIFF_OLD_COMMIT ?= $(shell git rev-parse origin/main)

.PHONY: apidiff
apidiff: $(GO_APIDIFF) ## Run the apidiff tool
$(GO_APIDIFF) $(APIDIFF_OLD_COMMIT) --print-compatible

## --------------------------------------
## Generate
## --------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions hack/tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ KIND := $(BIN_DIR)/kind
GOVC := $(BIN_DIR)/govc
GINKGO := $(BIN_DIR)/ginkgo
CONVERSION_VERIFIER := $(BIN_DIR)/conversion-verifier
APIDIFF := $(BIN_DIR)/go-apidiff

## --------------------------------------
## Help
Expand Down Expand Up @@ -87,6 +88,10 @@ conversion-verifier: $(CONVERSION_VERIFIER) $(SRCS) ## fetch CAPI's conversion v
$(CONVERSION_VERIFIER): go.mod
go build -tags=tools -o $@ sigs.k8s.io/cluster-api/hack/tools/conversion-verifier

go-apidiff: $(APIDIFF) $(SRCS) ## Build go-apidiff
$(APIDIFF): go.mod
go build -tags=tools -o $@ github.com/joelanford/go-apidiff

## --------------------------------------
## Generate
## --------------------------------------
Expand Down
1 change: 1 addition & 0 deletions hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.15

require (
github.com/golangci/golangci-lint v1.44.0
github.com/joelanford/go-apidiff v0.1.0
github.com/onsi/ginkgo v1.16.5
github.com/vmware/govmomi v0.23.1
k8s.io/code-generator v0.22.2
Expand Down
7 changes: 4 additions & 3 deletions hack/tools/tools.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build tools
// +build tools

/*
Copyright 2019 The Kubernetes Authors.
Expand All @@ -14,14 +17,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//go:build tools
// +build tools

// This package imports things required by build scripts, to force `go mod` to see them as dependencies
package tools

import (
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/joelanford/go-apidiff"
_ "github.com/onsi/ginkgo/ginkgo"
_ "github.com/vmware/govmomi"
_ "github.com/vmware/govmomi/govc/flags"
Expand Down

0 comments on commit ee4a286

Please sign in to comment.