-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
95 lines (74 loc) · 2.29 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
SHELL :=/bin/bash -e -o pipefail
PWD := $(shell pwd)
.DEFAULT_GOAL := all
.PHONY: all
all: ## build pipeline
all: format check test
.PHONY: ci
ci: ## CI build pipeline
ci: all
.PHONY: precommit
precommit: ## validate the branch before commit
precommit: all
.PHONY: help
help:
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: version
version: ## Check flutter version
@flutter --version
.PHONY: doctor
doctor: ## Check flutter doctor
@flutter doctor
.PHONY: format
format: ## Format the code
@dart format -l 80 --fix lib/ test/
.PHONY: fmt
fmt: format
.PHONY: fix
fix: format ## Fix the code
@dart fix --apply lib
@dart fix --apply test
.PHONY: get
get: ## Get the dependencies
@flutter pub get
.PHONY: upgrade
upgrade: get ## Upgrade dependencies
@flutter pub upgrade
.PHONY: upgrade-major
upgrade-major: get ## Upgrade to major versions
@flutter pub upgrade --major-versions
.PHONY: outdated
outdated: get ## Check for outdated dependencies
@flutter pub outdated --show-all --dev-dependencies --dependency-overrides --transitive --no-prereleases
.PHONY: dependencies
dependencies: get ## Check outdated dependencies
@flutter pub outdated --dependency-overrides \
--dev-dependencies --prereleases --show-all --transitive
.PHONY: test
test: get ## Run the tests
@flutter test --coverage --concurrency=6 test/control_test.dart
.PHONY: publish-check
publish-check: ## Check the package before publishing
@flutter pub publish --dry-run
.PHONY: publish
publish: ## Publish the package
@flutter pub publish
.PHONY: analyze
analyze: get ## Analyze the code
@dart format --set-exit-if-changed -l 80 -o none lib/ test/
@flutter analyze --fatal-infos --fatal-warnings lib/ test/
.PHONY: check
check: analyze publish-check ## Check the code
# @flutter pub global activate pana
# @pana --json --no-warning --line-length 80 > log.pana.json
.PHONY: clean
clean: ## Clean the project and remove all generated files
@rm -rf dist bin out build
@rm -rf coverage.* coverage .dart_tool .packages pubspec.lock
.PHONY: diff
diff: ## git diff
$(call print-target)
@git diff --exit-code
@RES=$$(git status --porcelain) ; if [ -n "$$RES" ]; then echo $$RES && exit 1 ; fi