summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile58
1 files changed, 33 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 6396405..1b9d897 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
###########################################################################
-# Copyright 2017-2018 IoT.bzh
+# Copyright 2017-2019 IoT.bzh
#
# author: Sebastien Douheret <sebastien@iot.bzh>
#
@@ -70,16 +70,18 @@ ROOT_GOPRJ := $(abspath $(ROOT_SRCDIR)/../../../../../..)
LOCAL_BINDIR := $(ROOT_SRCDIR)/bin
LOCAL_TOOLSDIR := $(ROOT_SRCDIR)/tools/${HOST_GOOS}
PACKAGE_DIR := $(ROOT_SRCDIR)/package
+PACKAGE_LIST=./lib/... ./test/... .
-export GOPATH := $(shell go env GOPATH):$(ROOT_GOPRJ)
+export GO111MODULE=on
+export GOPATH := $(ROOT_GOPRJ):$(shell go env GOPATH)
export PATH := $(PATH):$(LOCAL_TOOLSDIR)
# Check Go version
GOVERSION := $(shell go version |grep -o '[0-9\.]*'|head -n 1)
GOVERMAJ := $(shell echo $(GOVERSION) |cut -f1 -d.)
GOVERMIN := $(shell echo $(GOVERSION) |cut -f2 -d.)
-CHECKGOVER := $(shell [ $(GOVERMAJ) -gt 1 -o \( $(GOVERMAJ) -eq 1 -a $(GOVERMIN) -ge 9 \) ] && echo true)
-CHECKERRMSG := "ERROR: Go version 1.9.0 or higher is requested (current detected version: $(GOVERSION))."
+CHECKGOVER := $(shell [ $(GOVERMAJ) -gt 1 -o \( $(GOVERMAJ) -eq 1 -a $(GOVERMIN) -ge 12 \) ] && echo true)
+CHECKERRMSG := "ERROR: Go version 1.12 or higher is requested (current detected version: $(GOVERSION))."
VERBOSE_1 := -v
@@ -112,25 +114,26 @@ PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-$(VERSION).$(NB_COMMIT).zip
all: tools/syncthing build
.PHONY: build
-build: checkgover vendor xds webapp
+build: checkgover gomod xds webapp
xds: scripts tools/syncthing/copytobin
@echo "### Build XDS server (version $(VERSION), subversion $(SUB_VERSION)) - $(BUILD_MODE)";
@cd $(ROOT_SRCDIR); $(BUILD_ENV_FLAGS) go build $(VERBOSE_$(V)) -i -o $(LOCAL_BINDIR)/$(TARGET)$(EXT) -ldflags "$(GO_LDFLAGS) -X main.AppVersion=$(VERSION) -X main.AppSubVersion=$(SUB_VERSION)" -gcflags "$(GO_GCFLAGS)" .
.PHONY: test
-test: checkgorace tools/glide
+test: checkgorace
+ go clean -testcache
ifndef name
- GOCACHE=off go test --race ./test -v
+ go test --race ./test -v
else
- GOCACHE=off go test --race ./test -v -run $(name)
+ go test --race ./test -v -run $(name)
endif
-vet: tools/glide
- go vet $(shell $(LOCAL_TOOLSDIR)/glide novendor)
+vet:
+ go vet $(PACKAGE_LIST)
-fmt: tools/glide
- go fmt $(shell $(LOCAL_TOOLSDIR)/glide novendor)
+fmt:
+ go fmt $(PACKAGE_LIST)
run: build/xds tools/syncthing/copytobin
$(LOCAL_BINDIR)/$(TARGET)$(EXT) --log info $(XDS_SERVER_RUN_ARGS)
@@ -144,7 +147,12 @@ clean:
.PHONY: distclean
distclean: clean
- (cd $(ROOT_SRCDIR) && rm -rf $(LOCAL_BINDIR) ./tools ./glide.lock ./vendor ./*.zip ./webapp/dist ./webapp/node_modules ./scripts/sdks/agl/sdks_*.json)
+ (cd $(ROOT_SRCDIR) && rm -rf $(LOCAL_BINDIR) ./tools ./vendor ./*.zip ./webapp/dist ./webapp/node_modules ./scripts/sdks/agl/sdks_*.json)
+ go clean -modcache
+
+.PHONY: clean-lock
+clean-lock: distclean
+ (cd $(ROOT_SRCDIR) && rm -f ./go.sum ./webapp/package-lock.json)
webapp: webapp/install
mkdir -p $(ROOT_SRCDIR)/webapp/dist $(ROOT_SRCDIR)/webapp/dist/fonts
@@ -193,21 +201,21 @@ package:
.PHONY: package-all
package-all: package
-vendor: tools/glide glide.yaml
- $(LOCAL_TOOLSDIR)/glide install --strip-vendor
+.PHONY: gomod
+gomod:
+ go get
+
+gomod/debug:
+ @echo "replace gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git => $(ROOT_SRCDIR)/../xds-common" >> $(ROOT_SRCDIR)/go.mod
+ @echo "Add replace in go.mod file - done."
+
+vendor: gomod
+ go mod vendor
vendor/debug: vendor
(cd vendor/gerrit.automotivelinux.org/gerrit/src/xds && \
rm -rf xds-common.git && ln -s ../../../../../../xds-common xds-common.git )
-.PHONY: tools/glide
-tools/glide:
- @test -f $(LOCAL_TOOLSDIR)/glide || { \
- echo "Downloading glide"; \
- mkdir -p $(LOCAL_TOOLSDIR); \
- curl --silent --connect-timeout 60 --retry 3 -L https://glide.sh/get | GOBIN=$(LOCAL_TOOLSDIR) sh; \
- }
-
.PHONY: tools/syncthing
tools/syncthing:
@test -e $(LOCAL_TOOLSDIR)/syncthing$(EXT) -a -e $(LOCAL_TOOLSDIR)/syncthing-inotify$(EXT) || { \
@@ -217,7 +225,7 @@ tools/syncthing:
SYNCTHING_INOTIFY_VERSION=$(SYNCTHING_INOTIFY_VERSION) \
./scripts/xds-utils/get-syncthing.sh; }
-.PHONY:
+.PHONY: tools/syncthing/copytobin
tools/syncthing/copytobin:
@test -e $(LOCAL_TOOLSDIR)/syncthing$(EXT) -a -e $(LOCAL_TOOLSDIR)/syncthing-inotify$(EXT) || { echo "Please execute first: make tools/syncthing\n"; exit 1; }
@mkdir -p $(LOCAL_BINDIR)
@@ -234,7 +242,7 @@ checkgorace: checkgover
.PHONY: help
help:
@echo "Main supported rules:"
- @echo " all (default)"
+ @echo " all (default)"
@echo " build"
@echo " test (use: name=TestExec to run a specific test)"
@echo " package"