-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile.toml
760 lines (664 loc) · 20.9 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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["native/acter"]
ANDROID_PLATFORM_VERSION = "27"
TARGET_PLUGIN = "packages/rust_sdk"
LIB_OUT_DIR = "debug"
TARGET_OS = "unknown"
DEV = true
RELEASE = false
[env.release]
RELEASE = true
DEV = false
LIB_OUT_DIR = "release"
[tasks.setup-android]
# set up the system for android
script = [
"cargo install cargo-ndk",
]
[tasks.setup-ios]
# set up the system for iOS
condition = { platforms = ["mac"] }
script = [
"cargo install cargo-lipo",
]
[tasks.setup]
# set up the system
dependencies = [
"setup-android",
"setup-ios",
]
[tasks.ffigen]
script_runner = "@duckscript"
script = [
"""
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/acter/bindings.dart \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/lib/acter_flutter_sdk_ffi.dart
""",
]
dependencies = [
"check-ffi"
]
[tasks.init]
# initalise everything
dependencies = [
"flutter-get",
]
[tasks.flutter-get]
# update flutter dependencies
script_runner = "@shell"
script = [
"cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}",
"flutter pub get",
"cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app",
"flutter pub get",
]
[tasks.format]
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--", "--emit=files"]
[tasks.check-ffi]
dependencies = [
"check-ffi-debug",
"check-ffi-release",
]
[tasks.check-ffi-debug]
condition = { env_true = ["DEV"] }
private = true
command = "cargo"
args = ["check", "-p", "acter"]
[tasks.check-ffi-release]
condition = { env_true = ["RELEASE"] }
command = "cargo"
args = ["check", "--release", "-p", "acter"]
[tasks.test-flow]
disabled = true
[tasks.android-dev]
# development android x86_64 emulator
dependencies = [
"pre-android",
"android-x86_64",
"android-x86_64-release",
"ffigen",
"post-android-x86_64",
"post-android",
]
[tasks.android-ci]
# development android i686 emulator
dependencies = [
"pre-android",
"android-i686",
"android-i686-release",
"ffigen",
"post-android-i686",
"post-android",
]
[tasks.fixup]
dependencies = [
"format-fixup",
"clippy-fixup",
"dart-fixup",
]
[tasks.format-fixup]
command = "cargo"
args = ["fmt", "--all"]
[tasks.clippy-fixup]
command = "cargo"
args = ["clippy", "--all", "--tests", "--allow-dirty", "--allow-staged", "--fix"]
[tasks.dart-fixup]
script_runner = "@shell"
script = [
"cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}",
"dart fix --apply",
"cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/acter_notifify",
"dart fix --apply",
"cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app",
"dart fix --apply",
]
[tasks.build]
# Runs the rust compiler.
dependencies = ["android"]
command = "cargo"
args = ["build", "-p", "acter", "--release"]
[tasks.build.mac]
# Runs the rust compiler.
dependencies = ["android", "ios"]
[tasks.ios]
# Build ios targets.
condition = { platforms = ["mac"] }
dependencies = [
"ios-aarch64-apple-ios",
"ios-aarch64-apple-ios-release",
"ios-x86_64-apple-ios",
"post-ios",
"post-ios-release",
"make-ios-swift",
]
[tasks.ios-sim]
# Build ios targets.
condition = { platforms = ["mac"] }
dependencies = [
"ios-aarch64-apple-ios-sim",
"ios-aarch64-apple-ios-sim-release",
"ios-x86_64-apple-ios",
"ios-x86_64-apple-ios-release",
"post-ios-sim",
"make-ios-swift-sim",
]
[tasks.cargo-build-dev]
private = true
condition = { env_true = ["DEV"], env_set = ["CARGO_BUILD_TARGET"] }
#env = { CARGO_BUILD_RUSTFLAGS = "-C strip=debuginfo" }
command = "cargo"
args = [
"build",
"--target",
"${CARGO_BUILD_TARGET}",
"-Zbuild-std",
]
[tasks.cargo-build-release]
private = true
condition = { env_true = ["RELEASE"], env_set = ["CARGO_BUILD_TARGET"] }
command = "cargo"
args = [
"build",
"--target",
"${CARGO_BUILD_TARGET}",
"-Zbuild-std",
"--release"
]
[tasks.cargo-build-uniffi-dev]
private = true
condition = { env_true = ["DEV"], env_set = ["CARGO_BUILD_TARGET"] }
command = "cargo"
args = [
"build",
"--target",
"${CARGO_BUILD_TARGET}",
"-Zbuild-std",
"--features",
"uniffi"
]
[tasks.cargo-build-uniffi-release]
private = true
condition = { env_true = ["RELEASE"], env_set = ["CARGO_BUILD_TARGET"] }
command = "cargo"
args = [
"build",
"--target",
"${CARGO_BUILD_TARGET}",
"-Zbuild-std",
"--features",
"uniffi",
"--release"
]
[tasks.make-ios-swift]
private = true
condition = { platforms = ["mac"] }
dependencies = [
"build-swift-uniffi-aarch",
"build-swift-uniffi-ci",
]
script = [
"""
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}
cp target/swift-out/acterFFI.modulemap ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app/ios/acterFFI/module.modulemap
cp target/swift-out/acterFFI.h ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app/ios/acterFFI/acterFFI.h
cp target/swift-out/acter.swift ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app/ios/ActerPushServiceExtension/acter.swift
""",
]
[tasks.build-swift-uniffi-aarch]
private = true
condition = { env_false = ["CARGO_MAKE_CI"] }
command = "cargo"
args = [
"run",
"--target",
"aarch64-apple-darwin",
"-p",
"acter",
"--features",
"uniffi",
"--bin",
"uniffi-bindgen",
"generate",
"--library",
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-ios/${LIB_OUT_DIR}/libacter.a",
"--language",
"swift",
"--out-dir",
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/swift-out",
]
[tasks.build-swift-uniffi-ci]
private = true
condition = { env_true = ["CARGO_MAKE_CI"] }
command = "cargo"
args = [
"run",
"--target",
"x86_64-apple-darwin",
"-p",
"acter",
"--features",
"uniffi",
"--bin",
"uniffi-bindgen",
"generate",
"--library",
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-ios/${LIB_OUT_DIR}/libacter.a",
"--language",
"swift",
"--out-dir",
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/swift-out",
]
[tasks.make-ios-swift-sim]
private = true
condition = { platforms = ["mac"] }
dependencies = [
"build-swift-uniffi-sim",
]
script = [
"""
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}
cp target/swift-out/acterFFI.modulemap ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app/ios/acterFFI/module.modulemap
cp target/swift-out/acterFFI.h ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app/ios/acterFFI/acterFFI.h
cp target/swift-out/acter.swift ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app/ios/ActerPushServiceExtension/acter.swift
""",
]
[tasks.build-swift-uniffi-sim]
private = true
condition = { }
command = "cargo"
args = [
"run",
"--target",
"x86_64-apple-darwin",
"-p",
"acter",
"--features",
"uniffi",
"--bin",
"uniffi-bindgen",
"generate",
"--library",
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-ios-sim/${LIB_OUT_DIR}/libacter.a",
"--language",
"swift",
"--out-dir",
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/swift-out",
]
[tasks.ios-aarch64-apple-ios]
private = true
condition = { env_true = ["DEV"] }
env = { CARGO_BUILD_TARGET = "aarch64-apple-ios" }
run_task = "cargo-build-uniffi-dev"
[tasks.ios-aarch64-apple-ios-release]
private = true
condition = { env_true = ["RELEASE"] }
env = { CARGO_BUILD_TARGET = "aarch64-apple-ios" }
run_task = "cargo-build-uniffi-release"
[tasks.ios-x86_64-apple-ios]
private = true
condition = { env_true = ["DEV"] }
env = { CARGO_BUILD_TARGET = "x86_64-apple-ios" }
run_task = "cargo-build-uniffi-dev"
[tasks.ios-x86_64-apple-ios-release]
private = true
condition = { env_true = ["RELEASE"] }
env = { CARGO_BUILD_TARGET = "x86_64-apple-ios" }
run_task = "cargo-build-uniffi-release"
[tasks.ios-aarch64-apple-ios-sim]
private = true
condition = { env_true = ["DEV"] }
env = { CARGO_BUILD_TARGET = "aarch64-apple-ios-sim" }
run_task = "cargo-build-uniffi-dev"
[tasks.ios-aarch64-apple-ios-sim-release]
private = true
condition = { env_true = ["RELEASE"] }
env = { CARGO_BUILD_TARGET = "aarch64-apple-ios-sim" }
run_task = "cargo-build-uniffi-release"
[tasks.post-ios]
script_runner = "@shell"
condition = { env_true = ["DEV"] }
script = [
"""
LIBNAME=libacter.a
mkdir -p ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/ios-lipo
LIPO_LIB=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/ios-lipo/$LIBNAME
lipo -create -output $LIPO_LIB \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/x86_64-apple-ios/${LIB_OUT_DIR}/$LIBNAME \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-ios/${LIB_OUT_DIR}/$LIBNAME
cp "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/bindings.h" "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/ios/Classes/libacter.h"
cp "$LIPO_LIB" "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/ios/$LIBNAME"
""",
]
[tasks.post-ios-release]
script_runner = "@shell"
condition = { env_true = ["RELEASE"] }
script = [
"""
LIBNAME=libacter.a
cp "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/bindings.h" "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/ios/Classes/libacter.h"
cp "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-ios/${LIB_OUT_DIR}/$LIBNAME" "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/ios/$LIBNAME"
""",
]
[tasks.post-ios-sim]
script_runner = "@shell"
script = [
"""
LIBNAME=libacter.a
mkdir -p ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/ios-lipo
LIPO_LIB=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/ios-lipo/$LIBNAME
lipo -create -output $LIPO_LIB \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/x86_64-apple-ios/${LIB_OUT_DIR}/$LIBNAME \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-ios-sim/${LIB_OUT_DIR}/$LIBNAME
cp "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/bindings.h" "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/ios/Classes/libacter.h"
cp "$LIPO_LIB" "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/ios/$LIBNAME"
""",
]
[tasks.android-arm]
# Build android targets.
dependencies = [
"pre-android",
"android-aarch64",
"android-aarch64-release",
"post-android-aarch64",
"android-armv7",
"android-armv7-release",
"post-android-armv7",
]
[tasks.android]
# Build android targets.
dependencies = [
"pre-android",
"android-aarch64",
"android-aarch64-release",
"post-android-aarch64",
"android-armv7",
"android-armv7-release",
"post-android-armv7",
"android-i686",
"android-i686-release",
"post-android-i686",
"android-x86_64",
"android-x86_64-release",
"post-android-x86_64",
"post-android"
]
[tasks.android-build]
private = true
condition = { env_true = ["DEV"], env_set = ["ANDROID_BUILD_TARGET"] }
command = "cargo"
args = [
"ndk",
"--platform",
"${ANDROID_PLATFORM_VERSION}",
"--target",
"${ANDROID_BUILD_TARGET}",
"build",
]
[tasks.android-build-release]
private = true
condition = { env_true = ["RELEASE"], env_set = ["ANDROID_BUILD_TARGET"] }
command = "cargo"
args = [
"ndk",
"--platform",
"${ANDROID_PLATFORM_VERSION}",
"--target",
"${ANDROID_BUILD_TARGET}",
"build",
"--release"
]
[tasks.android-aarch64]
private = true
condition = { env_true = ["DEV"] }
env = { ANDROID_BUILD_TARGET = "arm64-v8a" }
run_task = "android-build"
[tasks.android-armv7]
private = true
condition = { env_true = ["DEV"] }
env = { ANDROID_BUILD_TARGET = "armeabi-v7a" }
run_task = "android-build"
[tasks.android-i686]
private = true
condition = { env_true = ["DEV"] }
env = { ANDROID_BUILD_TARGET = "x86" }
run_task = "android-build"
[tasks.android-x86_64]
private = true
condition = { env_true = ["DEV"] }
env = { ANDROID_BUILD_TARGET = "x86_64" }
run_task = "android-build"
[tasks.android-aarch64-release]
private = true
condition = { env_true = ["RELEASE"] }
env = { ANDROID_BUILD_TARGET = "arm64-v8a" }
run_task = "android-build-release"
[tasks.android-armv7-release]
private = true
condition = { env_true = ["RELEASE"] }
env = { ANDROID_BUILD_TARGET = "armeabi-v7a" }
run_task = "android-build-release"
[tasks.android-i686-release]
private = true
condition = { env_true = ["RELEASE"] }
env = { ANDROID_BUILD_TARGET = "x86" }
run_task = "android-build-release"
[tasks.android-x86_64-release]
private = true
condition = { env_true = ["RELEASE"] }
env = { ANDROID_BUILD_TARGET = "x86_64" }
run_task = "android-build-release"
[tasks.pre-android]
private = true
script_runner = "@duckscript"
script = [
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/android/src/main/jniLibs/arm64-v8a",
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/android/src/main/jniLibs/armeabi-v7a",
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/android/src/main/jniLibs/x86",
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/android/src/main/jniLibs/x86_64",
]
[tasks.copy-lib]
private = true
condition = { env_set = ["ANDROID_TARGET", "JNI_LIB_DIR"] }
script_runner = "@duckscript"
script = [
"""
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${ANDROID_TARGET}/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.so \
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/android/src/main/jniLibs/${JNI_LIB_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.so
""",
]
[tasks.post-android-aarch64]
private = true
env = { ANDROID_TARGET = "aarch64-linux-android", JNI_LIB_DIR = "arm64-v8a" }
run_task = "copy-lib"
[tasks.post-android-armv7]
private = true
env = { ANDROID_TARGET = "armv7-linux-androideabi", JNI_LIB_DIR = "armeabi-v7a" }
run_task = "copy-lib"
[tasks.post-android-i686]
private = true
env = { ANDROID_TARGET = "i686-linux-android", JNI_LIB_DIR = "x86" }
run_task = "copy-lib"
[tasks.post-android-x86_64]
private = true
env = { ANDROID_TARGET = "x86_64-linux-android", JNI_LIB_DIR = "x86_64" }
run_task = "copy-lib"
[tasks.post-android]
dependencies = ["ffigen"]
[tasks.desktop]
# Build rust SDK for desktop
dependencies = [
"desktop-build",
"desktop-build-release",
"desktop-build-release-mac",
"ffigen",
"copy-desktop-lib",
"copy-desktop-lib-release",
]
[tasks.desktop-proxyman]
# Build rust SDK for desktop
dependencies = [
"desktop-proxyman-inner",
"copy-desktop-lib",
]
[tasks.desktop-tracing]
# Build rust SDK for desktop
dependencies = [
"desktop-tracing-inner",
"copy-desktop-lib",
]
[tasks.desktop-tracing-inner]
private = true
condition = { env_true = ["DEV"] }
env = { RUSTFLAGS="--cfg tokio_unstable", MACOSX_DEPLOYMENT_TARGET = 12 }
command = "cargo"
args = ["build", "--lib", "--features", "tracing"]
[tasks.desktop-proxyman-inner]
private = true
condition = { env_true = ["DEV"] }
env = { RUSTFLAGS="--cfg tokio_unstable", MACOSX_DEPLOYMENT_TARGET = 12 }
command = "cargo"
args = ["build", "--lib", "--features", "proxyman"]
[tasks.desktop-build]
private = true
condition = { env_true = ["DEV"] }
env = { MACOSX_DEPLOYMENT_TARGET = 12 }
command = "cargo"
args = ["build", "--lib"]
[tasks.desktop-build-release]
private = true
condition = { env_true = ["RELEASE"], platforms = ["windows", "linux"] }
command = "cargo"
args = ["build", "--lib", "--release"]
[tasks.desktop-build-release-mac]
private = true
condition = { platforms = ["mac"], env_true = ["RELEASE"] }
script_runner = "@shell"
script = [
"""
export MAC_LIPO=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib
export MACOSX_DEPLOYMENT_TARGET=10.14
cargo build --lib --target x86_64-apple-darwin --release
export MACOSX_DEPLOYMENT_TARGET=12
cargo build --lib --target aarch64-apple-darwin --release
# fix inner reference name
install_name_tool -id "@rpath/libacter.dylib" ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-darwin/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib
install_name_tool -id "@rpath/libacter.dylib" ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/x86_64-apple-darwin/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib
lipo -create \
-output $MAC_LIPO \
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-darwin/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib" \
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/x86_64-apple-darwin/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib"
cp "$MAC_LIPO" "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/macos/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib"
cp "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/bindings.h" \
"${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/macos/Classes/libacter.h"
""",
]
[tasks.copy-desktop-lib]
# Copy desktop library to plugin
script_runner = "@duckscript"
condition = { env_true = ["DEV"] }
script = [
"""
os = os_family
if eq ${os} "linux"
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.so ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/linux/lib${CARGO_MAKE_CRATE_FS_NAME}.so
elseif eq ${os} "mac"
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/macos/lib${CARGO_MAKE_CRATE_FS_NAME}.dylib
elseif eq ${os} "windows"
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/${CARGO_MAKE_CRATE_FS_NAME}.dll ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/windows/${CARGO_MAKE_CRATE_FS_NAME}.dll
end
"""
]
[tasks.copy-desktop-lib-release]
# Copy desktop library to plugin
script_runner = "@duckscript"
condition = { env_true = ["RELEASE"] }
script = [
"""
os = os_family
if eq ${os} "linux"
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/lib${CARGO_MAKE_CRATE_FS_NAME}.so ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/linux/lib${CARGO_MAKE_CRATE_FS_NAME}.so
elseif eq ${os} "windows"
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${LIB_OUT_DIR}/${CARGO_MAKE_CRATE_FS_NAME}.dll ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/${TARGET_PLUGIN}/windows/${CARGO_MAKE_CRATE_FS_NAME}.dll
end
"""
]
# ## ## #### ######## ######## ###### ########
# ## ## ## ## ## ## ## ##
# ## ## ## ## ## ## ##
# ## ## ## ## ###### ###### ##
# ## ## ## ## ## ## ##
# ## ## ## ## ## ## ## ##
# ####### #### ## ######## ###### ##
[tasks.test-server]
# condition = { platforms = ["mac"], env_true = ["RELEASE"] }
script_runner = "@duckscript"
script = [
"""
os = os_family
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/util/test_server/
if eq ${os} "linux"
exec docker-compose up -d
else
exec vagrant up --provision
endif
"""
]
[tasks.ui-test-manager]
# condition = { platforms = ["mac"], env_true = ["RELEASE"] }
script_runner = "@duckscript"
category = "UI Test"
script = [
"""
os = os_family
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/util/conv_test_man
if eq ${os} "linux"
exec flutter run -d linux
elseif eq ${os} "windows"
exec flutter run -d windows
elseif eq ${os} "macos"
exec flutter run -d macos
end
"""
]
[tasks.ui-tester]
dependencies = [
"test-server",
"ui-test-manager"
]
[tasks.ui-test-app-android-emulator]
category = "UI Test"
script = [
"""
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app
flutter run integration_test/main_test.dart \
--host-vmservice-port 9753 \
--disable-service-auth-codes \
--dart-define CONVENIENT_TEST_APP_CODE_DIR=lib \
--dart-define CONVENIENT_TEST_MANAGER_HOST=10.0.2.2 \
--dart-define MAILHOG_URL=http://10.0.2.2:8025 \
--dart-define RAGESHAKE_URL=http://10.0.2.2:9110/api/submit \
--dart-define RAGESHAKE_LISTING_URL=http://10.0.2.2:9110/api/listing \
--dart-define DEFAULT_HOMESERVER_URL=http://10.0.2.2:8118 \
--dart-define DEFAULT_HOMESERVER_NAME=localhost
"""
]
[tasks.ui-test-app-local]
category = "UI Test"
script = [
"""
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app
flutter run integration_test/main_test.dart \
--host-vmservice-port 9753 \
--disable-service-auth-codes \
--dart-define CONVENIENT_TEST_APP_CODE_DIR=lib \
--dart-define CONVENIENT_TEST_MANAGER_HOST=localhost \
--dart-define RAGESHAKE_URL=http://localhost:9110/api/submit \
--dart-define MAILHOG_URL=http://localhost:8025 \
--dart-define RAGESHAKE_LISTING_URL=http://localhost:9110/api/listing \
--dart-define DEFAULT_HOMESERVER_URL=http://localhost:8118 \
--dart-define DEFAULT_HOMESERVER_NAME=localhost
"""
]