From d450e3e0146eff061150b5007c43983fdb2277a8 Mon Sep 17 00:00:00 2001 From: JuanJo Ciarlante Date: Wed, 8 Nov 2017 15:34:14 -0300 Subject: [PATCH] [jjo] use only vendor/ dependencies --- .gitignore | 1 + Makefile | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index cb4f1ee2c8f..5965a53613c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ kubeapps generated +statik diff --git a/Makefile b/Makefile index a70eecc9bc4..0ab89047ac4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,9 @@ -GO = go +IMPORT_PATH:= github.com/kubeapps/installer +GOBIN = go +# Force builds to only use vendor/'ed dependencies +# i.e. ignore local $GOPATH/src installed sources +GOPATH_TMP = $(CURDIR)/.GOPATH +GO = /usr/bin/env GOPATH=$(GOPATH_TMP) $(GOBIN) GO_FLAGS = GOFMT = gofmt VERSION = dev-$(shell date +%FT%T%z) @@ -6,23 +11,27 @@ VERSION = dev-$(shell date +%FT%T%z) OS = linux ARCH = amd64 BINARY = kubeapps -GO_PACKAGES = ./cmd/... -GO_FILES := $(shell find $(shell $(GO) list -f '{{.Dir}}' $(GO_PACKAGES)) -name \*.go) +GO_PACKAGES = $(IMPORT_PATH)/cmd +GO_FILES := $(shell find $(shell $(GOBIN) list -f '{{.Dir}}' $(GO_PACKAGES)) -name \*.go) GO_FLAGS = -ldflags="-w -X github.com/kubeapps/installer/cmd.VERSION=${VERSION}" EMBEDDED_STATIC = generated/statik/statik.go default: binary -binary: $(EMBEDDED_STATIC) - $(GO) build -o $(BINARY) $(GO_FLAGS) . +binary: build-prep $(EMBEDDED_STATIC) + $(GO) build -i -o $(BINARY) $(GO_FLAGS) $(IMPORT_PATH) -test: $(EMBEDDED_STATIC) +test: build-prep $(EMBEDDED_STATIC) $(GO) test $(GO_FLAGS) $(GO_PACKAGES) -$(EMBEDDED_STATIC): $(wilcard static/*) +$(EMBEDDED_STATIC): build-prep $(wilcard static/*) $(GO) build -o statik ./vendor/github.com/rakyll/statik/statik.go $(GO) generate +build-prep: + mkdir -p $(dir $(GOPATH_TMP)/src/$(IMPORT_PATH)) + ln -snf $(CURDIR) $(GOPATH_TMP)/src/$(IMPORT_PATH) + fmt: $(GOFMT) -s -w $(GO_FILES) @@ -30,6 +39,7 @@ vet: $(GO) vet $(GO_FLAGS) $(GO_PACKAGES) clean: - $(RM) kubeapps $(EMBEDDED_STATIC) + $(RM) ./kubeapps ./statik $(EMBEDDED_STATIC) + $(RM) -r $(GOPATH_TMP) -.PHONY: default binary test fmt vet clean +.PHONY: default binary test fmt vet clean build-prep