๐Ÿ“ฆ techouse / qs

๐Ÿ“„ Makefile ยท 55 lines
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# Makefile

.PHONY: test

help:
	@printf "%-20s %s\n" "Target" "Description"
	@printf "%-20s %s\n" "------" "-----------"
	@make -pqR : 2>/dev/null \
		| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
		| sort \
		| egrep -v -e '^[^[:alnum:]]' -e '^$@$$' \
		| xargs -I _ sh -c 'printf "%-20s " _; make _ -nB | (grep -i "^# Help:" || echo "") | tail -1 | sed "s/^# Help: //g"'

analyze:
	@# Help: Analyze the project's Dart code.
	dart analyze lib test --fatal-infos

check_format:
	@# Help: Check the formatting of one or more Dart files.
	dart format lib test --output=none --set-exit-if-changed .

check_outdated:
	@# Help: Check which of the project's packages are outdated.
	dart pub outdated

check_style:
	@# Help: Analyze the project's Dart code and check the formatting one or more Dart files.
	make analyze && make check_format

format:
	@# Help: Format one or more Dart files.
	dart format .

install:
	@# Help: Install all the project's packages
	dart pub get

sure:
	@# Help: Analyze the project's Dart code, check the formatting one or more Dart files and run unit tests for the current project.
	make check_style && make test

show_test_coverage:
	@# Help: Run Dart unit tests for the current project and show the coverage.
	dart pub global activate coverage && dart pub global run coverage:test_with_coverage
	genhtml coverage/lcov.info -o coverage/html
	source ./scripts/makefile_scripts.sh && open_link "coverage/html/index.html"

test:
	@# Help: Run VM tests
	dart test --platform vm

upgrade:
	@# Help: Upgrade all the project's packages.
	dart pub upgrade