|
| 1 | +SHELL :=/bin/bash -e -o pipefail |
| 2 | +PWD := $(shell pwd) |
| 3 | + |
| 4 | +.DEFAULT_GOAL := all |
| 5 | +.PHONY: all |
| 6 | +all: ## build pipeline |
| 7 | +all: format check test |
| 8 | + |
| 9 | +.PHONY: ci |
| 10 | +ci: ## CI build pipeline |
| 11 | +ci: all |
| 12 | + |
| 13 | +.PHONY: precommit |
| 14 | +precommit: ## validate the branch before commit |
| 15 | +precommit: all |
| 16 | + |
1 | 17 | .PHONY: help |
2 | | -help: ## help dialog |
3 | | - @echo 'Usage: make <OPTIONS> ... <TARGETS>' |
4 | | - @echo '' |
5 | | - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
| 18 | +help: |
| 19 | + @echo 'Usage: make <OPTIONS> ... <TARGETS>' |
| 20 | + @echo '' |
| 21 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
| 22 | + |
| 23 | +.PHONY: version |
| 24 | +version: ## Check flutter version |
| 25 | + @flutter --version |
| 26 | + |
| 27 | +.PHONY: doctor |
| 28 | +doctor: ## Check flutter doctor |
| 29 | + @flutter doctor |
| 30 | + |
| 31 | +.PHONY: format |
| 32 | +format: ## Format the code |
| 33 | + @dart format -l 80 --fix lib/ test/ |
| 34 | + |
| 35 | +.PHONY: fmt |
| 36 | +fmt: format |
| 37 | + |
| 38 | +.PHONY: fix |
| 39 | +fix: format ## Fix the code |
| 40 | + @dart fix --apply lib |
| 41 | + @dart fix --apply test |
| 42 | + |
| 43 | +.PHONY: get |
| 44 | +get: ## Get the dependencies |
| 45 | + @flutter pub get |
| 46 | + |
| 47 | +.PHONY: upgrade |
| 48 | +upgrade: get ## Upgrade dependencies |
| 49 | + @flutter pub upgrade |
| 50 | + |
| 51 | +.PHONY: upgrade-major |
| 52 | +upgrade-major: get ## Upgrade to major versions |
| 53 | + @flutter pub upgrade --major-versions |
| 54 | + |
| 55 | +.PHONY: outdated |
| 56 | +outdated: get ## Check for outdated dependencies |
| 57 | + @flutter pub outdated --show-all --dev-dependencies --dependency-overrides --transitive --no-prereleases |
| 58 | + |
| 59 | +.PHONY: dependencies |
| 60 | +dependencies: get ## Check outdated dependencies |
| 61 | + @flutter pub outdated --dependency-overrides \ |
| 62 | + --dev-dependencies --prereleases --show-all --transitive |
| 63 | + |
| 64 | +.PHONY: test |
| 65 | +test: get ## Run the tests |
| 66 | + @flutter test --coverage --concurrency=6 test/control_test.dart |
| 67 | + |
| 68 | +.PHONY: publish-check |
| 69 | +publish-check: ## Check the package before publishing |
| 70 | + @dart pub publish --dry-run |
| 71 | + |
| 72 | +.PHONY: publish |
| 73 | +publish: ## Publish the package |
| 74 | + @yes | dart pub publish |
| 75 | + |
| 76 | +.PHONY: analyze |
| 77 | +analyze: get ## Analyze the code |
| 78 | + @dart format --set-exit-if-changed -l 80 -o none lib/ test/ |
| 79 | + @flutter analyze --fatal-infos --fatal-warnings lib/ test/ |
| 80 | + |
| 81 | +.PHONY: check |
| 82 | +check: analyze publish-check ## Check the code |
| 83 | +# @flutter pub global activate pana |
| 84 | +# @pana --json --no-warning --line-length 80 > log.pana.json |
| 85 | + |
| 86 | +.PHONY: clean |
| 87 | +clean: ## Clean the project and remove all generated files |
| 88 | + @rm -rf dist bin out build |
| 89 | + @rm -rf coverage.* coverage .dart_tool .packages pubspec.lock |
6 | 90 |
|
7 | | --include tool/makefile/pub.mk tool/makefile/test.mk |
| 91 | +.PHONY: diff |
| 92 | +diff: ## git diff |
| 93 | + $(call print-target) |
| 94 | + @git diff --exit-code |
| 95 | + @RES=$$(git status --porcelain) ; if [ -n "$$RES" ]; then echo $$RES && exit 1 ; fi |
0 commit comments