-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (75 loc) · 1.97 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
91
92
93
94
95
96
# ensure target stops if there is an error; run on a single shell
# .ONESHELL:
# SHELL = /usr/bin/perl
# .SHELLFLAGS = -e
# check if fvm command exists, otherwise use empty string
FVM_CMD := $(shell command -v fvm 2> /dev/null)
DART_CMD := $(FVM_CMD) dart
export PATH := $(HOME)/.pub-cache/bin:$(PATH)
.PHONY: all
all: version get analyze doc dry-run test
.PHONY: kill
kill:
@echo "Killing service..."
@kill -9 $(shell lsof -t -i:8181) || echo "Port 8181 is not in use"
.PHONY: publish
publish: all
@echo "Publishing package..."
$(DART_CMD) pub publish --force
.PHONY: dry-run
dry-run: kill
@echo "Running dry-run..."
$(DART_CMD) pub publish --dry-run
.PHONY: test
test:
@echo "Running tests..."
$(DART_CMD) test --test-randomize-ordering-seed=random
.PHONY: coverage
coverage:
@echo "Running tests..."
$(DART_CMD) pub global activate coverage
$(DART_CMD) run coverage:test_with_coverage
$(MAKE) format_lcov
.PHONY: get
get:
@echo "Getting dependencies..."
$(DART_CMD) pub get
.PHONY: upgrade
upgrade:
@echo "Upgrading dependencies..."
$(DART_CMD) pub upgrade
.PHONY: downgrade
downgrade:
@echo "Downgrading dependencies..."
$(DART_CMD) pub downgrade
.PHONY: doc
doc:
@echo "Generating documentation..."
@$(DART_CMD) doc || echo "Failed to generate documentation - maybe it's dart 2.12?"
.PHONY: analyze
analyze:
@echo "Analyzing..."
$(DART_CMD) analyze --fatal-infos --fatal-warnings
$(DART_CMD) format --set-exit-if-changed .
.PHONY: fix
fix:
$(DART_CMD) format .
$(DART_CMD) fix --apply
$(DART_CMD) format .
.PHONY: version
version:
@echo "Checking version..."
$(DART_CMD) --version
### Coverage ###
# ensure all files listed in the coverage report are relative paths
CWD := $(shell pwd)
FILES := $(shell find coverage/*.info -type f ! -path "$(CWD)")
.PHONY: format_lcov
format_lcov:
@mkdir -p coverage
@echo "Formatting lcov.info..."
@echo "CWD: $(CWD)"
@echo "FILES: $(FILES)"
@for file in $(FILES); do \
sed -i'' -e 's|$(CWD)/||g' $$file ; \
done