-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
90 lines (74 loc) · 3.54 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
GO := go
# Do not use trailing slashes here
STATIK_SRCS :=langserver/documentation/functions
STATIK_FILES := $(patsubst %, %_statik/statik.go, $(STATIK_SRCS))
BINARYS := $(patsubst cmd/%.go, %, $(MAIN_GO_FILES))
all: build test
generated: $(STATIK_FILES)
.PHONY: install
install: $(STATIK_FILES)
$(GO) get ./cmd/...
.PHONY: build
build:
$(GO) build ./cmd/...
.PHONY: clean
clean:
rm -f $(STATIK_FILES)
rm -f $(BINARYS)
%_statik/statik.go: $(wildcard $*/*)
statik -src "$*" -dest $(dir $*) -p $(notdir $*_statik) -f -m
gofmt -w $@
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: test
test:
go test -race -v -cover ./...
.PHONY: update_internal_packages
update_internal_packages:
for dir in `ls -d internal/vendored/*/`; \
do \
echo "Updating:"; \
NAME=`basename $$dir`; \
echo "Name: " $$NAME; \
REPO=`cat internal/vendored/$$NAME.repo`; \
echo "Repo: " $$REPO; \
FCMD=`cat internal/vendored/$$NAME.cmd`; \
echo "File cmd: " $$FCMD; \
DIRS=`cat internal/vendored/$$NAME.dirs`; \
echo "Directories: " $$DIRS; \
VERSION=`cat internal/vendored/$$NAME.version`; \
echo "Version: " $$VERSION; \
echo "Cleaning up"; \
rm -rf $$dir*; \
TMPDIR=`mktemp -d`; \
echo "Temp dir: " $$TMPDIR; \
git clone $$REPO $$TMPDIR; \
git --git-dir=$$TMPDIR/.git --work-tree=$$TMPDIR checkout $$VERSION; \
echo "Copying Files"; \
for subdir in $$DIRS; \
do \
echo mkdir -p `dirname $$dir$$subdir`; \
mkdir -p `dirname $$dir$$subdir`; \
cp -r $$TMPDIR/internal/$$subdir $$dir$$subdir; \
done; \
cp $$TMPDIR/LICENSE $$dir; \
for file in `find $$dir -type f`; \
do \
CMD=`echo $$FCMD $$file`; \
echo $$CMD; \
bash -c "$$CMD"; \
done; \
rm -rf $$TMPDIR; \
make fmt; \
done
.PHONY: htmlcover
htmlcover:
go test -coverprofile=coverage.out ./langserver/...
go tool cover -html=coverage.out
.PHONY: crossbuild
crossbuild:
goreleaser --skip-publish --rm-dist --snapshot
.PHONY: release
release:
goreleaser