|
@@ -1,5 +1,6 @@
|
|
|
|
|
|
-#RUST_LOG="debug" flutter test -j, --concurrency=1 'path to the file' --name 'test case name'
|
|
|
+# If you want to test a single file with single case, you can try this command:
|
|
|
+# RUST_LOG="debug" flutter test -j, --concurrency=1 'path to the file' --name 'test case name'
|
|
|
[tasks.flutter_test]
|
|
|
description = "Run flutter test with single case in single file. Input: cargo make flutter_test 'path to the file' --name 'test case name'"
|
|
|
script = '''
|
|
@@ -28,7 +29,7 @@ script_runner = "@shell"
|
|
|
|
|
|
[tasks.run_dart_unit_test]
|
|
|
env = { RUST_LOG = "info" }
|
|
|
-dependencies = ["build_test_backend"]
|
|
|
+dependencies = ["inner_build_test_backend"]
|
|
|
description = "Run flutter unit tests"
|
|
|
script = '''
|
|
|
cd appflowy_flutter
|
|
@@ -222,3 +223,96 @@ run_task = { name = [
|
|
|
"get_lcov_report",
|
|
|
"clean_profraw_files",
|
|
|
] }
|
|
|
+
|
|
|
+
|
|
|
+[tasks.build_test_backend]
|
|
|
+script = '''
|
|
|
+cargo make --profile test-macos-$(uname -m) inner_build_test_backend
|
|
|
+'''
|
|
|
+script_runner = "@shell"
|
|
|
+
|
|
|
+[tasks.build_test_backend.windows]
|
|
|
+script = '''
|
|
|
+cargo make --profile test-windows inner_build_test_backend
|
|
|
+'''
|
|
|
+script_runner = "@shell"
|
|
|
+
|
|
|
+[tasks.build_test_backend.linux]
|
|
|
+script = '''
|
|
|
+cargo make --profile test-linux inner_build_test_backend
|
|
|
+'''
|
|
|
+script_runner = "@shell"
|
|
|
+
|
|
|
+[tasks.inner_build_test_backend]
|
|
|
+category = "Build"
|
|
|
+dependencies = ["env_check"]
|
|
|
+run_task = { name = [
|
|
|
+ "setup-test-crate-type",
|
|
|
+ "compile_test_backend",
|
|
|
+ "copy-to-sandbox-folder",
|
|
|
+ "restore-test-crate-type",
|
|
|
+] }
|
|
|
+
|
|
|
+[tasks.compile_test_backend]
|
|
|
+mac_alias = "compile_test_backend_default"
|
|
|
+windows_alias = "compile_test_backend_windows"
|
|
|
+linux_alias = "compile_test_backend_default"
|
|
|
+
|
|
|
+[tasks.compile_test_backend_default]
|
|
|
+private = true
|
|
|
+script = [
|
|
|
+ """
|
|
|
+ cd rust-lib/
|
|
|
+ rustup show
|
|
|
+ echo RUST_LOG=${RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
|
|
|
+ RUST_LOG=${RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
|
|
|
+ cd ../
|
|
|
+ """,
|
|
|
+]
|
|
|
+script_runner = "@shell"
|
|
|
+
|
|
|
+[tasks.compile_test_backend_windows]
|
|
|
+private = true
|
|
|
+script = [
|
|
|
+ """
|
|
|
+ cd rust-lib/
|
|
|
+ rustup show
|
|
|
+ echo cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
|
|
|
+ RUST_LOG=${RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
|
|
|
+ cd ../
|
|
|
+ """,
|
|
|
+]
|
|
|
+script_runner = "@shell"
|
|
|
+
|
|
|
+[tasks.copy-to-sandbox-folder]
|
|
|
+mac_alias = "copy-to-sandbox-folder-default"
|
|
|
+windows_alias = "copy-to-sandbox-folder-windows"
|
|
|
+linux_alias = "copy-to-sandbox-folder-default"
|
|
|
+
|
|
|
+[tasks.copy-to-sandbox-folder-windows]
|
|
|
+private = true
|
|
|
+script = [
|
|
|
+ """
|
|
|
+ # Copy the appflowy_backend lib to system temp directory for flutter unit test.
|
|
|
+ lib = set ${LIB_NAME}.${TEST_LIB_EXT}
|
|
|
+ dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib}
|
|
|
+ rm ${dest}
|
|
|
+ cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \
|
|
|
+ ${dest}
|
|
|
+ """,
|
|
|
+]
|
|
|
+script_runner = "@duckscript"
|
|
|
+
|
|
|
+[tasks.copy-to-sandbox-folder-default]
|
|
|
+private = true
|
|
|
+script = [
|
|
|
+ """
|
|
|
+ # Copy the appflowy_backend lib to system temp directory for flutter unit test.
|
|
|
+ lib = set lib${LIB_NAME}.${TEST_LIB_EXT}
|
|
|
+ dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib}
|
|
|
+ rm ${dest}
|
|
|
+ cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \
|
|
|
+ ${dest}
|
|
|
+ """,
|
|
|
+]
|
|
|
+script_runner = "@duckscript"
|