mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-22 13:00:19 +00:00
build: more flexible handling of go build tags; added ceph_preview
ceph_preview tag is needed to make new go-ceph's RADOS read/write ops available Signed-off-by: Robert Vasek <robert.vasek@cern.ch>
This commit is contained in:
parent
afeae03069
commit
8fb5739f21
21
Makefile
21
Makefile
@ -46,22 +46,19 @@ endif
|
||||
|
||||
GO_PROJECT=github.com/ceph/ceph-csi
|
||||
|
||||
CEPH_VERSION ?= $(shell . $(CURDIR)/build.env ; echo $${CEPH_VERSION})
|
||||
# TODO: ceph_preview tag may be removed with go-ceph 0.16.0
|
||||
GO_TAGS_LIST ?= $(CEPH_VERSION) ceph_preview
|
||||
|
||||
# go build flags
|
||||
LDFLAGS ?=
|
||||
LDFLAGS += -X $(GO_PROJECT)/internal/util.GitCommit=$(GIT_COMMIT)
|
||||
# CSI_IMAGE_VERSION will be considered as the driver version
|
||||
LDFLAGS += -X $(GO_PROJECT)/internal/util.DriverVersion=$(CSI_IMAGE_VERSION)
|
||||
GO_TAGS ?= -tags=$(shell echo $(GO_TAGS_LIST) | tr ' ' ',')
|
||||
|
||||
BASE_IMAGE ?= $(shell . $(CURDIR)/build.env ; echo $${BASE_IMAGE})
|
||||
|
||||
ifndef CEPH_VERSION
|
||||
CEPH_VERSION = $(shell . $(CURDIR)/build.env ; echo $${CEPH_VERSION})
|
||||
endif
|
||||
ifdef CEPH_VERSION
|
||||
# pass -tags to go commands (for go-ceph build constraints)
|
||||
GO_TAGS = -tags=$(CEPH_VERSION)
|
||||
endif
|
||||
|
||||
# passing TARGET=static-check on the 'make containerized-test' or 'make
|
||||
# containerized-build' commandline will run the selected target instead of
|
||||
# 'make test' in the container. Obviously other targets can be passed as well,
|
||||
@ -109,8 +106,12 @@ mod-check: check-env
|
||||
@echo 'running: go mod verify'
|
||||
@go mod verify && [ "$(shell sha512sum go.mod)" = "`sha512sum go.mod`" ] || ( echo "ERROR: go.mod was modified by 'go mod verify'" && false )
|
||||
|
||||
scripts/golangci.yml: build.env scripts/golangci.yml.in
|
||||
sed "s/@@CEPH_VERSION@@/$(CEPH_VERSION)/g" < scripts/golangci.yml.in > scripts/golangci.yml
|
||||
scripts/golangci.yml: scripts/golangci.yml.in
|
||||
rm -f scripts/golangci.yml.buildtags.in
|
||||
for tag in $(GO_TAGS_LIST); do \
|
||||
echo " - $$tag" >> scripts/golangci.yml.buildtags.in ; \
|
||||
done
|
||||
sed "/@@BUILD_TAGS@@/r scripts/golangci.yml.buildtags.in" scripts/golangci.yml.in | sed '/@@BUILD_TAGS@@/d' > scripts/golangci.yml
|
||||
|
||||
go-lint: scripts/golangci.yml
|
||||
./scripts/lint-go.sh
|
||||
|
@ -6,7 +6,7 @@
|
||||
# options for analysis running
|
||||
run:
|
||||
build-tags:
|
||||
- @@CEPH_VERSION@@
|
||||
@@BUILD_TAGS@@
|
||||
|
||||
# default concurrency is a available CPU number
|
||||
concurrency: 4
|
||||
|
Loading…
Reference in New Issue
Block a user