-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
146 lines (116 loc) · 6.46 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Copyright (C) 2020, David PHAM-VAN <dev.nfet.net@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FLUTTER?=$(realpath $(dir $(realpath $(dir $(shell which flutter)))))
FLUTTER_BIN=$(FLUTTER)/bin/flutter
DART_BIN=$(FLUTTER)/bin/dart
DART_SRC=$(shell find . -name '*.dart')
COV_PORT=9292
all: format
format: image/lib/src/pubspec.dart demo/.metadata flutter/example/.metadata format-dart
format-dart: $(DART_SRC)
$(DART_BIN) format --fix $^
.coverage:
which coverage || $(DART_BIN) pub global activate coverage
touch $@
demo/.metadata:
cd demo; $(FLUTTER_BIN) create -t app --no-overwrite --org net.nfet --project-name demo .
rm -rf demo/test
flutter/example/.metadata:
cd flutter/example; $(FLUTTER_BIN) create -t app --no-overwrite --org net.nfet --project-name example .
rm -rf flutter/example/test
node_modules:
npm install lcov-summary
test-barcode: .coverage
cd barcode; $(DART_BIN) pub get
cd barcode; $(DART_BIN) run test --coverage=.coverage
cd barcode; $(DART_BIN) pub global run coverage:format_coverage --packages=.dart_tool/package_config.json -i .coverage --report-on lib --lcov --out ../lcov-barcode.info
test-image:
cd image; $(DART_BIN) pub get
cd image; $(DART_BIN) run test --coverage=.coverage
cd image; $(DART_BIN) pub global run coverage:format_coverage --packages=.dart_tool/package_config.json -i .coverage --report-on lib --lcov --out ../lcov-image.info
test-flutter:
cd flutter; $(FLUTTER_BIN) pub get
cd flutter; $(FLUTTER_BIN) test --coverage
mv flutter/coverage/lcov.info lcov-flutter.info
test: node_modules test-barcode test-image test-flutter barcodes
lcov --add-tracefile lcov-barcode.info -t test1 -a lcov-example.info -t test2 -a lcov-image.info -t test3 -a lcov-flutter.info -t test4 -o lcov.info
cat lcov.info | node_modules/.bin/lcov-summary
clean:
git clean -fdx -e .vscode
publish-barcode: format clean
test -z "$(shell git status --porcelain)"
@find barcode -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';'
cd barcode; $(DART_BIN) pub publish -f
@find barcode -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';'
git tag $(shell grep version barcode/pubspec.yaml | sed 's/version\s*:\s*/barcode-/g')
publish-flutter: format clean
test -z "$(shell git status --porcelain)"
@find flutter -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';'
cd flutter; $(DART_BIN) pub publish -f
@find flutter -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';'
git tag $(shell grep version flutter/pubspec.yaml | sed 's/version\s*:\s*/barcode_widget-/g')
publish-image: format clean
test -z "$(shell git status --porcelain)"
@find image -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';'
cd image; $(DART_BIN) pub publish -f
@find image -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';'
git tag $(shell grep version image/pubspec.yaml | sed 's/version\s*:\s*/barcode_image-/g')
.pana:
$(DART_BIN) pub global activate pana
touch $@
analyze-barcode: .pana
@find barcode -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';'
@$(DART_BIN) pub global run pana --no-warning --source path barcode
@find barcode -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';'
analyze-flutter: .pana
@find flutter -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';'
rm -f flutter/pubspec.lock
@$(FLUTTER_BIN) pub global run pana --no-warning --source path flutter
@find flutter -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';'
analyze-image: .pana
@find image -name pubspec.yaml -exec sed -i -e 's/^dependency_overrides:/_dependency_overrides:/g' '{}' ';'
@$(DART_BIN) pub global run pana --no-warning --source path image
@find image -name pubspec.yaml -exec sed -i -e 's/^_dependency_overrides:/dependency_overrides:/g' '{}' ';'
analyze: analyze-barcode analyze-flutter analyze-image
image/lib/src/pubspec.dart: image/pubspec.yaml
cd image; $(DART_BIN) run build_runner build
.dartfix:
which dartfix || $(DART_BIN) pub global activate dartfix
touch $@
fix: .dartfix
cd barcode; $(DART_BIN) pub get
cd barcode; $(DART_BIN) pub global run dartfix --overwrite .
barcodes: .coverage
cd barcode; $(DART_BIN) pub global run coverage:collect_coverage --port=$(COV_PORT) -o coverage.json --resume-isolates --wait-paused &\
$(DART_BIN) --enable-asserts --disable-service-auth-codes --enable-vm-service=$(COV_PORT) --pause-isolates-on-exit example/main.dart
cd barcode; $(DART_BIN) pub global run coverage:format_coverage --packages=.dart_tool/package_config.json -i coverage.json --report-on lib --lcov --out ../lcov-example.info
mv -f barcode/*.svg img/
icons:
$(DART_BIN) image/bin/barcode.dart -t CodeEAN2 -w 16 -h 16 --no-text -o flutter/example/web/favicon.png 42
$(DART_BIN) image/bin/barcode.dart -t QrCode -w 192 -h 192 --no-text -o flutter/example/web/icons/Icon-192.png Barcode
$(DART_BIN) image/bin/barcode.dart -t QrCode -w 512 -h 512 --no-text -o flutter/example/web/icons/Icon-512.png https://davbfr.github.io/dart_barcode
maps: build_maps.py
python3 build_maps.py > barcode/lib/src/barcode_maps.dart
dartfmt -w --fix barcode/lib/src/barcode_maps.dart
gh-pages:
test -z "$(shell git status --porcelain)"
cd demo; $(FLUTTER_BIN) build web --suppress-analytics --verbose --no-null-assertions --no-native-null-assertions --pwa-strategy none --no-source-maps --base-href '/dart_barcode/' --release
git checkout gh-pages
for f in $$(find demo/build/web -name '*.html' -o -name '*.css' -o -name '*.js' -a -not -name '*.dart.js'); do minify -o $$f $$f; done
cp -rf demo/build/web/* .
get:
cd barcode; $(DART_BIN) pub get
cd flutter; $(FLUTTER_BIN) packages get
cd image; $(DART_BIN) pub get
.PHONY: test format format-dart clean publish analyze