-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (75 loc) · 2.43 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
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: format
format: ## Format the code
@dart format -l 80 --fix lib/ test/
@dart fix --apply .
.PHONY: get
get: ## Get the dependencies
@flutter pub get
.PHONY: outdated
outdated: get ## Check for outdated dependencies
@flutter pub outdated --show-all --dev-dependencies --dependency-overrides --transitive --no-prereleases
.PHONY: test
test: get ## Run the tests
@flutter test --concurrency=40 test/unit_test.dart test/widget_test.dart
.PHONY: publish-check
publish-check: ## Check the package before publishing
@flutter pub publish --dry-run
.PHONY: deploy-check
deploy-check: publish-check
.PHONY: publish
publish: ## Publish the package
@flutter pub publish
.PHONY: deploy
deploy: publish
.PHONY: coverage
coverage: get ## Generate the coverage report
@flutter test --coverage --concurrency=40 test/unit_test.dart test/widget_test.dart
# @lcov --remove coverage/lcov.info 'lib/**/*.g.dart' -o coverage/lcov.info
@lcov --list coverage/lcov.info
@genhtml -o coverage coverage/lcov.info
.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
@dart pub global activate pana
@pana --json --no-warning --line-length 80 > log.pana.json
.PHONY: pana
pana: check
#.PHONY: generate
#generate: get ## Generate the code
# @dart pub global activate protoc_plugin
# @protoc --proto_path=lib/src/protobuf --dart_out=lib/src/protobuf lib/src/protobuf/client.proto
# @dart run build_runner build --delete-conflicting-outputs
# @dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/protobuf/ test/
#.PHONY: gen
#gen: generate
#.PHONY: codegen
#codegen: generate
.PHONY: version
version: ## Show the Flutter version
@flutter --version
@which flutter
.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