forked from fzyzcjy/flutter_rust_bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
96 lines (78 loc) · 3.45 KB
/
justfile
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
# To use this file, install Just: cargo install just
frb_bin := "frb_codegen/target/debug/flutter_rust_bridge_codegen"
frb_pure := "frb_example/pure_dart"
frb_flutter := "frb_example/with_flutter"
line_length := "120"
dylib := if os() == "windows" {
"flutter_rust_bridge_example.dll"
} else if os() == "macos" {
"libflutter_rust_bridge_example.dylib"
} else {
"libflutter_rust_bridge_example.so"
}
default: gen-bridge
alias b := build
build:
cd frb_codegen && cargo build
alias g := gen-bridge
gen-bridge: build
{{frb_bin}} -r {{frb_pure}}/rust/src/api.rs \
-d {{frb_pure}}/dart/lib/bridge_generated.dart \
--dart-format-line-length {{line_length}}
{{frb_bin}} -r {{frb_flutter}}/rust/src/api.rs \
-d {{frb_flutter}}/lib/bridge_generated.dart \
-c {{frb_flutter}}/ios/Runner/bridge_generated.h \
-c {{frb_flutter}}/macos/Runner/bridge_generated.h \
--dart-format-line-length {{line_length}}
alias l := lint
lint:
dart format --fix .
dart format --fix -l {{line_length}} {{frb_pure}}
dart format --fix -l {{line_length}} {{frb_flutter}}
alias t := test
test: test-pure test-integration
test-pure:
cd {{frb_pure}}/rust && cargo b
cd {{frb_pure}}/dart && \
dart pub get && \
dart lib/main.dart ../rust/target/debug/{{dylib}}
test-integration:
cd {{frb_flutter}} && flutter test integration_test/main.dart
alias c := clean
clean:
cd {{frb_pure}}/dart && flutter clean
cd {{frb_pure}}/rust && cargo clean
cd {{frb_flutter}} && flutter clean
cd {{frb_flutter}}/rust && cargo clean
refresh_all:
(cd frb_rust && cargo clippy -- -D warnings)
(cd frb_macros && cargo clippy -- -D warnings)
(cd frb_example/pure_dart/rust && cargo clippy -- -D warnings)
(cd frb_example/with_flutter/rust && cargo clippy -- -D warnings)
(cd frb_example/pure_dart/dart && dart pub get)
(cd frb_example/with_flutter && flutter pub get)
just lint
sed -i "" -e 's/pub.flutter-io.cn/pub.dartlang.org/g' frb_example/pure_dart/dart/pubspec.lock
sed -i "" -e 's/pub.flutter-io.cn/pub.dartlang.org/g' frb_example/with_flutter/pubspec.lock
publish_all:
(cd frb_codegen && cargo publish)
(cd frb_rust && cargo publish)
(cd frb_macros && cargo publish)
(cd frb_dart && flutter pub publish --force --server=https://pub.dartlang.org)
release old_version new_version:
grep -q 'version = "{{old_version}}"' frb_codegen/Cargo.toml
grep -q '{{new_version}}' CHANGELOG.md
sed -i '' 's/version = "{{old_version}}"/version = "{{new_version}}"/g' frb_codegen/Cargo.toml
sed -i '' 's/version = "{{old_version}}"/version = "{{new_version}}"/g' frb_rust/Cargo.toml
sed -i '' 's/version = "{{old_version}}"/version = "{{new_version}}"/g' frb_macros/Cargo.toml
sed -i '' 's/version: {{old_version}}/version: {{new_version}}/g' frb_dart/pubspec.yaml
just refresh_all
git add --all
git status && git diff --staged | grep ''
git commit -m "bump from {{old_version}} to {{new_version}}"
git push
awk '/## {{new_version}}/{flag=1; next} /## {{old_version}}/{flag=0} flag' CHANGELOG.md | gh release create v{{new_version}} --notes-file "-" --draft --title v{{new_version}}
echo 'A *DRAFT* release has been created. Please go to the webpage and really release if you find it correct.'
open https://github.com/fzyzcjy/flutter_rust_bridge/releases
just publish_all
# vim:expandtab:ts=4:sw=4