Skip to content

Commit

Permalink
Merge pull request #25 from jjo/jjo-use-vendor-only-deps
Browse files Browse the repository at this point in the history
[jjo] use only vendor/ dependencies
  • Loading branch information
ngtuna committed Nov 13, 2017
2 parents 22cde51 + d450e3e commit 1924f47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
kubeapps
generated
statik
28 changes: 19 additions & 9 deletions Makefile
@@ -1,35 +1,45 @@
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)

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)

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

0 comments on commit 1924f47

Please sign in to comment.