Skip to content

Commit 24fee93

Browse files
authored
makefile: update deps target to use cache (#177)
1 parent 3ed3dc1 commit 24fee93

File tree

2 files changed

+74
-11
lines changed

2 files changed

+74
-11
lines changed

build/Makefile.deps

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,61 @@
11
## Installs all the required binaries for the makefile targets.
2-
.PHONY: deps
3-
deps:
4-
ifndef SKIP_DEPCHECK
5-
@ echo "-> Installing project dependencies..."
6-
@ GO111MODULE=off go get -u github.com/myitcv/gobin
7-
@ $(GOBIN)/gobin github.com/elastic/go-licenser@v0.3.0
8-
@ $(GOBIN)/gobin github.com/go-bindata/go-bindata/go-bindata@v0.0.0-20190711162640-ee3c2418e368
9-
@ $(GOBIN)/gobin golang.org/x/lint/golint
10-
@ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) v1.21.0
11-
@ echo "-> Done."
12-
endif
2+
3+
OS:=$(shell uname -s | tr '[:upper:]' '[:lower:]')
4+
ARCH:=$(shell $(PWD)/scripts/uname_arch.sh)
5+
VERSION_DIR:=$(GOBIN)/versions
6+
7+
VERSION_GOBIN:=v0.0.13
8+
VERSION_GOLINT:=v0.0.0-20191125180803-fdd1cda4f05f
9+
VERSION_GOLICENSER:=v0.3.0
10+
VERSION_GOLANGCILINT:=v1.21.0
11+
VERSION_GOBINDATA:=v0.0.0-20190711162640-ee3c2418e368
12+
13+
deps: $(GOBIN)/gobin $(GOBIN)/golint $(GOBIN)/go-licenser $(GOBIN)/golangci-lint $(GOBIN)/go-bindata
14+
15+
$(GOBIN):
16+
@ mkdir -p $(GOBIN)
17+
18+
$(VERSION_DIR): | $(GOBIN)
19+
@ mkdir -p $(GOBIN)/versions
20+
21+
22+
$(VERSION_DIR)/.version-gobin-$(VERSION_GOBIN): | $(VERSION_DIR)
23+
@ rm -f $(VERSION_DIR)/.version-gobin-*
24+
@ echo $(VERSION_GOBIN) > $(VERSION_DIR)/.version-gobin-$(VERSION_GOBIN)
25+
26+
$(GOBIN)/gobin: $(VERSION_DIR)/.version-gobin-$(VERSION_GOBIN) | $(GOBIN)
27+
@ echo "-> Installing gobin..."
28+
@ curl -sL -o $(GOBIN)/gobin https://github.com/myitcv/gobin/releases/download/$(VERSION_GOBIN)/$(OS)-$(ARCH)
29+
@ chmod +x $(GOBIN)/gobin
30+
31+
$(VERSION_DIR)/.version-golint-$(VERSION_GOLINT): | $(VERSION_DIR)
32+
@ rm -f $(VERSION_DIR)/.version-golint-*
33+
@ echo $(VERSION_GOLINT) > $(VERSION_DIR)/.version-golint-$(VERSION_GOLINT)
34+
35+
$(GOBIN)/golint: $(GOBIN)/gobin $(VERSION_DIR)/.version-golint-$(VERSION_GOLINT) | $(GOBIN)
36+
@ echo "-> Installing golint..."
37+
@ $(GOBIN)/gobin golang.org/x/lint/golint@$(VERSION_GOLINT)
38+
39+
$(VERSION_DIR)/.version-go-licenser-$(VERSION_GOLICENSER): | $(VERSION_DIR)
40+
@ rm -f $(VERSION_DIR)/.version-go-licenser-*
41+
@ echo $(VERSION_GOLICENSER) > $(VERSION_DIR)/.version-go-licenser-$(VERSION_GOLICENSER)
42+
43+
$(GOBIN)/go-licenser: $(GOBIN)/gobin $(VERSION_DIR)/.version-go-licenser-$(VERSION_GOLICENSER) | $(GOBIN)
44+
@ echo "-> Installing go-licenser..."
45+
@ $(GOBIN)/gobin github.com/elastic/go-licenser@$(VERSION_GOLICENSER)
46+
47+
$(VERSION_DIR)/.version-golangci-lint-$(VERSION_GOLANGCILINT): | $(VERSION_DIR)
48+
@ rm -f $(VERSION_DIR)/.version-golangci-lint-*
49+
@ echo $(VERSION_GOLANGCILINT) > $(VERSION_DIR)/.version-golangci-lint-$(VERSION_GOLANGCILINT)
50+
51+
$(GOBIN)/golangci-lint: $(VERSION_DIR)/.version-golangci-lint-$(VERSION_GOLANGCILINT) | $(GOBIN)
52+
@ echo "-> Installing golangci-lint..."
53+
@ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOBIN) $(VERSION_GOLANGCILINT)
54+
55+
$(VERSION_DIR)/.version-go-bindata-$(VERSION_GOBINDATA):
56+
@ rm -f $(VERSION_DIR)/.version-go-bindata-*
57+
@ echo $(VERSION_GOBINDATA) > $(VERSION_DIR)/.version-go-bindata-$(VERSION_GOBINDATA)
58+
59+
$(GOBIN)/go-bindata: $(GOBIN)/gobin $(VERSION_DIR)/.version-go-bindata-$(VERSION_GOBINDATA) | $(GOBIN)
60+
@ echo "-> Installing go-bindata..."
61+
@ $(GOBIN)/gobin github.com/go-bindata/go-bindata/go-bindata@$(VERSION_GOBINDATA)

scripts/uname_arch.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
arch=$(uname -m)
4+
case $arch in
5+
x86_64) arch="amd64" ;;
6+
x86) arch="386" ;;
7+
i686) arch="386" ;;
8+
i386) arch="386" ;;
9+
aarch64) arch="arm64" ;;
10+
armv5*) arch="armv5" ;;
11+
armv6*) arch="armv6" ;;
12+
armv7*) arch="armv7" ;;
13+
esac
14+
echo ${arch}

0 commit comments

Comments
 (0)