Merge pull request #7863 from rifelpet/make-cleanup

Cleanup make targets
This commit is contained in:
Kubernetes Prow Robot 2019-11-07 10:43:43 -08:00 committed by GitHub
commit 82891fa3fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 52 deletions

View File

@ -98,20 +98,7 @@ PROTOKUBE_TAG := $(subst +,-,${VERSION})
KOPS_SERVER_TAG := $(subst +,-,${VERSION})
# Go exports:
GO15VENDOREXPERIMENT=1
export GO15VENDOREXPERIMENT
COMPILERVERSION := $(shell go version | cut -d' ' -f3 | sed 's/go//g' | tr -d '\n')
COMPILER_VER_MAJOR := $(shell echo $(COMPILERVERSION) | cut -f1 -d.)
COMPILER_VER_MINOR := $(shell echo $(COMPILERVERSION) | cut -f2 -d.)
COMPILER_GT_1_10 := $(shell [ $(COMPILER_VER_MAJOR) -gt 1 -o \( $(COMPILER_VER_MAJOR) -eq 1 -a $(COMPILER_VER_MINOR) -ge 10 \) ] && echo true)
ifeq ($(COMPILER_GT_1_10), true)
LDFLAGS := -ldflags=all=
else
LDFLAGS := -ldflags=
endif
ifdef STATIC_BUILD
CGO_ENABLED=0
@ -197,23 +184,17 @@ upup/models/bindata.go: ${GOBINDATA} ${UPUP_MODELS_BINDATA_SOURCES}
# Build in a docker container with golang 1.X
# Used to test we have not broken 1.X
# 1.10 is the default for k8s 1.11. Others are best-effort
.PHONY: check-builds-in-go18
check-builds-in-go18:
# Note we only check that kops builds; we know the tests don't compile because of type aliasing in uber zap
docker run -v ${GOPATH_1ST}/src/k8s.io/kops:/go/src/k8s.io/kops golang:1.8 make -C /go/src/k8s.io/kops kops
.PHONY: check-builds-in-go19
check-builds-in-go19:
docker run -v ${GOPATH_1ST}/src/k8s.io/kops:/go/src/k8s.io/kops golang:1.9 make -C /go/src/k8s.io/kops ci
.PHONY: check-builds-in-go110
check-builds-in-go110:
docker run -v ${GOPATH_1ST}/src/k8s.io/kops:/go/src/k8s.io/kops golang:1.10 make -C /go/src/k8s.io/kops ci
.PHONY: check-builds-in-go111
check-builds-in-go111:
docker run -v ${GOPATH_1ST}/src/k8s.io/kops:/go/src/k8s.io/kops golang:1.11 make -C /go/src/k8s.io/kops ci
docker run -e GO111MODULE=on -e EXTRA_BUILDFLAGS=-mod=vendor -v ${GOPATH_1ST}/src/k8s.io/kops:/go/src/k8s.io/kops golang:1.11 make -C /go/src/k8s.io/kops all
.PHONY: check-builds-in-go112
check-builds-in-go112:
docker run -e GO111MODULE=on -e EXTRA_BUILDFLAGS=-mod=vendor -v ${GOPATH_1ST}/src/k8s.io/kops:/go/src/k8s.io/kops golang:1.12 make -C /go/src/k8s.io/kops all
.PHONY: check-builds-in-go113
check-builds-in-go113:
docker run -e EXTRA_BUILDFLAGS=-mod=vendor -v ${GOPATH_1ST}/src/k8s.io/kops:/go/src/k8s.io/kops golang:1.13 make -C /go/src/k8s.io/kops all
.PHONY: codegen
codegen: kops-gobindata
@ -408,7 +389,7 @@ push-aws-run: push
.PHONY: ${PROTOKUBE}
${PROTOKUBE}:
go build ${GCFLAGS} -o $@ -tags 'peer_name_alternative peer_name_hash' k8s.io/kops/protokube/cmd/protokube
go build ${GCFLAGS} ${EXTRA_BUILDFLAGS} -o $@ -tags 'peer_name_alternative peer_name_hash' k8s.io/kops/protokube/cmd/protokube
.PHONY: protokube
protokube: ${PROTOKUBE}
@ -494,35 +475,17 @@ bazel-utils-dist:
# --------------------------------------------------
# development targets
.PHONY: dep-prereqs
dep-prereqs:
(which hg > /dev/null) || (echo "dep requires that mercurial is installed"; exit 1)
(which dep > /dev/null) || (echo "dep-ensure requires that dep is installed"; exit 1)
(which bazel > /dev/null) || (echo "dep-ensure requires that bazel is installed"; exit 1)
.PHONY: gomod-prereqs
gomod-prereqs:
(which bazel > /dev/null) || (echo "gomod requires that bazel is installed"; exit 1)
.PHONY: dep-ensure
dep-ensure: dep-prereqs
dep-ensure:
echo "`make dep-ensure` has been replaced by `make gomod`"
exit 1
dep ensure -v
# Switch weavemesh to use peer_name_hash - bazel rule-go doesn't support build tags yet
rm vendor/github.com/weaveworks/mesh/peer_name_mac.go
sed -i -e 's/peer_name_hash/!peer_name_mac/g' vendor/github.com/weaveworks/mesh/peer_name_hash.go
# Remove all bazel build files that were vendored and regenerate (we assume they are go-gettable)
find vendor/ -name "BUILD" -delete
find vendor/ -name "BUILD.bazel" -delete
# Remove recursive symlinks that really confuse bazel
rm -rf vendor/github.com/coreos/etcd/cmd/
rm -rf vendor/github.com/jteeuwen/go-bindata/testdata/
# Remove dependencies that dep just can't figure out
rm -rf vendor/k8s.io/code-generator/cmd/set-gen/
rm -rf vendor/k8s.io/code-generator/cmd/go-to-protobuf/
rm -rf vendor/k8s.io/code-generator/cmd/import-boss/
rm -rf vendor/github.com/docker/docker/contrib/
make gazelle
.PHONY: gomod
gomod:
gomod: gomod-prereqs
GO111MODULE=on go mod vendor
# Switch weavemesh to use peer_name_hash - bazel rule-go doesn't support build tags yet
rm vendor/github.com/weaveworks/mesh/peer_name_mac.go