-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile.toml
108 lines (94 loc) · 1.98 KB
/
Makefile.toml
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
[config]
skip_core_tasks = true
[tasks.build]
description = "Build All"
dependencies = ["build-web"]
[tasks.run-web]
dependencies = ["build-web"]
script = [
'''
flutter run -d chrome --web-renderer html
'''
]
[tasks.build-web]
dependencies = ["prepare-web"]
script = [
'''
flutter build web --web-renderer html --csp
'''
]
[tasks.build-android]
dependencies = ["codegen-bridge"]
script = [
'''
flutter build apk
'''
]
[tasks.prepare-web]
dependencies = ["copy-wasm-web"]
[tasks.copy-wasm-web]
dependencies = ["build-wasm"]
script = [
'''
dir="web/generated/wasmlib"
rm -rf $dir
mkdir -pv $dir
for ext in js wasm
do
cp -vf wasmlib/pkg/*.$ext $dir/
done
'''
]
[tasks.build-wasm]
dependencies = ["install-wasm-pack", "codegen-bridge"]
script = [
'''
cd wasmlib
export AR=/usr/local/opt/llvm/bin/llvm-ar
export CC=/usr/local/opt/llvm/bin/clang
wasm-pack build --target web
'''
]
[tasks.install-wasm-pack]
script = [
'''
type wasm-pack || (curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh)
'''
]
[tasks.codegen-bridge]
dependencies = ["install-flutter_rust_bridge", "flutter-get", "clean-codegen-bridge"]
script = [
'''
cargo install cargo-ndk cbindgen
flutter_rust_bridge_codegen \
--rust-input wasmlib/src/api.rs \
--dart-output lib/bridge_generated.dart \
--dart-decl-output lib/bridge_generated.definitions.dart \
--wasm \
--verbose
flutter pub run build_runner build
'''
]
[tasks.clean-codegen-bridge]
dependencies = ["install-flutter_rust_bridge", "flutter-get"]
script = [
'''
for file in $(find . -name 'bridge_generated.*')
do
rm -vf $file
done
'''
]
[tasks.flutter-get]
script = [
'''
flutter pub get
'''
]
[tasks.install-flutter_rust_bridge]
script = [
'''
cargo install flutter_rust_bridge_codegen --version 1.62.0
dart pub global activate ffigen
'''
]