From 77d600a742611e28fb897e99e3bbfd34d18b5afa Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:26:58 +0800 Subject: [PATCH] chore: remove unused features (#5196) * chore: remove unused features * chore: update logs --- .github/workflows/rust_ci.yaml | 2 +- frontend/Makefile.toml | 76 ++++----- frontend/appflowy_tauri/src-tauri/Cargo.toml | 1 - .../appflowy_web_app/src-tauri/Cargo.toml | 1 - frontend/rust-lib/dart-ffi/Cargo.toml | 5 +- frontend/rust-lib/flowy-core/Cargo.toml | 3 - .../flowy-core/src/integrate/trait_impls.rs | 3 +- frontend/rust-lib/flowy-folder/src/manager.rs | 4 +- frontend/rust-lib/flowy-user/Cargo.toml | 4 +- .../flowy-user/src/user_manager/manager.rs | 6 +- .../user_manager/manager_user_workspace.rs | 10 ++ frontend/rust-lib/lib-log/Cargo.toml | 6 +- frontend/rust-lib/lib-log/src/layer.rs | 2 +- frontend/scripts/makefile/tests.toml | 155 +++++++++--------- 14 files changed, 137 insertions(+), 141 deletions(-) diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index d553c5dad5..891805fe4c 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -94,7 +94,7 @@ jobs: af_cloud_test_ws_url: ws://localhost/ws/v1 af_cloud_test_gotrue_url: http://localhost/gotrue run: | - DISABLE_CI_TEST_LOG="true" cargo test --no-default-features --features="rev-sqlite,dart" -- --nocapture + DISABLE_CI_TEST_LOG="true" cargo test --no-default-features --features="dart" -- --nocapture - name: rustfmt rust-lib run: cargo fmt --all -- --check diff --git a/frontend/Makefile.toml b/frontend/Makefile.toml index f9f1fb74ba..ab1c6c4443 100644 --- a/frontend/Makefile.toml +++ b/frontend/Makefile.toml @@ -1,16 +1,16 @@ #https://github.com/sagiegurari/cargo-make extend = [ - { path = "scripts/makefile/desktop.toml" }, - { path = "scripts/makefile/mobile.toml" }, - { path = "scripts/makefile/protobuf.toml" }, - { path = "scripts/makefile/tests.toml" }, - { path = "scripts/makefile/docker.toml" }, - { path = "scripts/makefile/env.toml" }, - { path = "scripts/makefile/flutter.toml" }, - { path = "scripts/makefile/tool.toml" }, - { path = "scripts/makefile/tauri.toml" }, - { path = "scripts/makefile/web.toml" }, + { path = "scripts/makefile/desktop.toml" }, + { path = "scripts/makefile/mobile.toml" }, + { path = "scripts/makefile/protobuf.toml" }, + { path = "scripts/makefile/tests.toml" }, + { path = "scripts/makefile/docker.toml" }, + { path = "scripts/makefile/env.toml" }, + { path = "scripts/makefile/flutter.toml" }, + { path = "scripts/makefile/tool.toml" }, + { path = "scripts/makefile/tauri.toml" }, + { path = "scripts/makefile/web.toml" }, ] [config] @@ -27,7 +27,7 @@ CARGO_MAKE_CRATE_FS_NAME = "dart_ffi" CARGO_MAKE_CRATE_NAME = "dart-ffi" LIB_NAME = "dart_ffi" APPFLOWY_VERSION = "0.5.5" -FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite" +FLUTTER_DESKTOP_FEATURES = "dart" PRODUCT_NAME = "AppFlowy" MACOSX_DEPLOYMENT_TARGET = "11.0" # CRATE_TYPE: https://doc.rust-lang.org/reference/linkage.html @@ -162,7 +162,7 @@ CRATE_TYPE = "cdylib" FLUTTER_OUTPUT_DIR = "Debug" LIB_EXT = "so" LINUX_ARCH = "arm64" -FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored" +FLUTTER_DESKTOP_FEATURES = "dart,openssl_vendored" [env.production-linux-aarch64] CARGO_PROFILE = "release" @@ -174,7 +174,7 @@ FLUTTER_OUTPUT_DIR = "Release" LIB_EXT = "so" LINUX_ARCH = "arm64" APP_ENVIRONMENT = "production" -FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored" +FLUTTER_DESKTOP_FEATURES = "dart,openssl_vendored" [env.development-ios-arm64-sim] BUILD_FLAG = "debug" @@ -207,7 +207,7 @@ CRATE_TYPE = "cdylib" FLUTTER_OUTPUT_DIR = "Debug" LIB_EXT = "so" PRODUCT_EXT = "apk" -FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored" +FLUTTER_DESKTOP_FEATURES = "dart,openssl_vendored" [env.production-android] BUILD_FLAG = "release" @@ -235,24 +235,24 @@ script_runner = "@shell" [tasks.setup-crate-type] private = true script = [ - """ - toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml - val = replace ${toml} "staticlib" ${CRATE_TYPE} - result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} - assert ${result} - """, + """ + toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml + val = replace ${toml} "staticlib" ${CRATE_TYPE} + result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} + assert ${result} + """, ] script_runner = "@duckscript" [tasks.restore-crate-type] private = true script = [ - """ - toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml - val = replace ${toml} ${CRATE_TYPE} "staticlib" - result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} - assert ${result} - """, + """ + toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml + val = replace ${toml} ${CRATE_TYPE} "staticlib" + result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} + assert ${result} + """, ] script_runner = "@duckscript" @@ -280,24 +280,24 @@ TEST_COMPILE_TARGET = "x86_64-pc-windows-msvc" [tasks.setup-test-crate-type] private = true script = [ - """ - toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml - val = replace ${toml} "staticlib" ${TEST_CRATE_TYPE} - result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} - assert ${result} - """, + """ + toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml + val = replace ${toml} "staticlib" ${TEST_CRATE_TYPE} + result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} + assert ${result} + """, ] script_runner = "@duckscript" [tasks.restore-test-crate-type] private = true script = [ - """ - toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml - val = replace ${toml} ${TEST_CRATE_TYPE} "staticlib" - result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} - assert ${result} - """, + """ + toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml + val = replace ${toml} ${TEST_CRATE_TYPE} "staticlib" + result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} + assert ${result} + """, ] script_runner = "@duckscript" diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml index 551c3dca18..d37784295f 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.toml +++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml @@ -46,7 +46,6 @@ lib-dispatch = { path = "../../rust-lib/lib-dispatch", features = [ "use_serde", ] } flowy-core = { path = "../../rust-lib/flowy-core", features = [ - "rev-sqlite", "ts", ] } flowy-user = { path = "../../rust-lib/flowy-user", features = ["tauri_ts"] } diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.toml b/frontend/appflowy_web_app/src-tauri/Cargo.toml index bec9dabcd1..98c60e4056 100644 --- a/frontend/appflowy_web_app/src-tauri/Cargo.toml +++ b/frontend/appflowy_web_app/src-tauri/Cargo.toml @@ -46,7 +46,6 @@ lib-dispatch = { path = "../../rust-lib/lib-dispatch", features = [ "use_serde", ] } flowy-core = { path = "../../rust-lib/flowy-core", features = [ - "rev-sqlite", "ts", ] } flowy-user = { path = "../../rust-lib/flowy-user", features = ["tauri_ts"] } diff --git a/frontend/rust-lib/dart-ffi/Cargo.toml b/frontend/rust-lib/dart-ffi/Cargo.toml index faae54dac4..5585abf57b 100644 --- a/frontend/rust-lib/dart-ffi/Cargo.toml +++ b/frontend/rust-lib/dart-ffi/Cargo.toml @@ -47,10 +47,9 @@ serde_yaml = "0.9.27" flowy-error = { workspace = true, features = ["impl_from_sqlite", "impl_from_dispatch_error", "impl_from_appflowy_cloud", "impl_from_reqwest", "impl_from_serde", "dart"] } [features] -default = ["dart", "rev-sqlite"] +default = ["dart"] dart = ["flowy-core/dart"] -rev-sqlite = ["flowy-core/rev-sqlite"] -http_sync = ["flowy-core/http_sync", "flowy-core/use_bunyan"] +http_sync = ["flowy-core/http_sync"] openssl_vendored = ["flowy-core/openssl_vendored"] verbose_log = [] diff --git a/frontend/rust-lib/flowy-core/Cargo.toml b/frontend/rust-lib/flowy-core/Cargo.toml index 97455e7a45..89f4a03343 100644 --- a/frontend/rust-lib/flowy-core/Cargo.toml +++ b/frontend/rust-lib/flowy-core/Cargo.toml @@ -52,11 +52,9 @@ sysinfo = "0.30.5" semver = "1.0.22" [features] -default = ["rev-sqlite"] profiling = ["console-subscriber", "tokio/tracing"] http_sync = [] native_sync = [] -use_bunyan = ["lib-log/use_bunyan"] dart = [ "flowy-user/dart", "flowy-date/dart", @@ -71,7 +69,6 @@ ts = [ "flowy-database2/ts", "flowy-config/tauri_ts", ] -rev-sqlite = ["flowy-user/rev-sqlite"] openssl_vendored = ["flowy-sqlite/openssl_vendored"] # Enable/Disable AppFlowy Verbose Log Configuration diff --git a/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs index 2d1bec045e..f0ed50267e 100644 --- a/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs +++ b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs @@ -9,7 +9,7 @@ use collab::preclude::CollabPlugin; use collab_entity::CollabType; use collab_plugins::cloud_storage::postgres::SupabaseDBPlugin; use tokio_stream::wrappers::WatchStream; -use tracing::{debug, instrument}; +use tracing::debug; use collab_integrate::collab_builder::{ CollabCloudPluginProvider, CollabPluginProviderContext, CollabPluginProviderType, @@ -325,7 +325,6 @@ impl CollabCloudPluginProvider for ServerProvider { self.get_server_type().into() } - #[instrument(level = "debug", skip(self, context), fields(server_type = %self.get_server_type()))] fn get_plugins(&self, context: CollabPluginProviderContext) -> Vec> { // If the user is local, we don't need to create a sync plugin. if self.get_server_type().is_local() { diff --git a/frontend/rust-lib/flowy-folder/src/manager.rs b/frontend/rust-lib/flowy-folder/src/manager.rs index 0b1842b945..6228e9560d 100644 --- a/frontend/rust-lib/flowy-folder/src/manager.rs +++ b/frontend/rust-lib/flowy-folder/src/manager.rs @@ -35,7 +35,7 @@ use parking_lot::RwLock; use std::fmt::{Display, Formatter}; use std::ops::Deref; use std::sync::{Arc, Weak}; -use tracing::{error, info, instrument, trace}; +use tracing::{error, info, instrument}; conditional_send_sync_trait! { "[crate::manager::FolderUser] represents the user for folder."; @@ -367,7 +367,6 @@ impl FolderManager { /// /// * `none_callback`: A callback function that is invoked when `mutex_folder` contains `None`. /// * `f2`: A callback function that is invoked when `mutex_folder` contains a `Some` value. The contained folder is passed as an argument to this callback. - #[instrument(level = "debug", skip_all)] fn with_folder(&self, none_callback: F1, f2: F2) -> Output where F1: FnOnce() -> Output, @@ -482,7 +481,6 @@ impl FolderManager { /// again using the ID of the child view you wish to access. #[tracing::instrument(level = "debug", skip(self))] pub async fn get_view_pb(&self, view_id: &str) -> FlowyResult { - trace!("Get view pb with id: {}", view_id); let view_id = view_id.to_string(); let folder = self.mutex_folder.read(); diff --git a/frontend/rust-lib/flowy-user/Cargo.toml b/frontend/rust-lib/flowy-user/Cargo.toml index 03ded3b584..426275e470 100644 --- a/frontend/rust-lib/flowy-user/Cargo.toml +++ b/frontend/rust-lib/flowy-user/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] flowy-derive.workspace = true -flowy-sqlite = { workspace = true, optional = true } +flowy-sqlite = { workspace = true } flowy-encrypt = { workspace = true } flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_from_sqlite", "impl_from_collab_folder", "impl_from_collab_persistence"] } flowy-folder-pub = { workspace = true } @@ -57,8 +57,6 @@ rand_core = "0.6.2" quickcheck_macros = "1.0" [features] -default = ["rev-sqlite"] -rev-sqlite = ["flowy-sqlite"] dart = ["flowy-codegen/dart", "flowy-notification/dart"] tauri_ts = ["flowy-codegen/ts", "flowy-notification/tauri_ts"] diff --git a/frontend/rust-lib/flowy-user/src/user_manager/manager.rs b/frontend/rust-lib/flowy-user/src/user_manager/manager.rs index dc4cda199e..83e3034a5b 100644 --- a/frontend/rust-lib/flowy-user/src/user_manager/manager.rs +++ b/frontend/rust-lib/flowy-user/src/user_manager/manager.rs @@ -133,6 +133,7 @@ impl UserManager { if let Ok(session) = self.get_session() { let user = self.get_user_profile_from_disk(session.user_id).await?; + // Get the current authenticator from the environment variable let current_authenticator = current_authenticator(); @@ -151,9 +152,10 @@ impl UserManager { event!( tracing::Level::INFO, - "init user session: {}:{}", + "init user session: {}:{}, authenticator: {:?}", user.uid, - user.email + user.email, + user.authenticator, ); self.prepare_user(&session).await; diff --git a/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs b/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs index 2cc75d0155..c991983efb 100644 --- a/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs +++ b/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs @@ -159,6 +159,7 @@ impl UserManager { Ok(()) } + #[instrument(level = "info", skip(self), err)] pub async fn add_workspace(&self, workspace_name: &str) -> FlowyResult { let new_workspace = self .cloud_services @@ -166,6 +167,11 @@ impl UserManager { .create_workspace(workspace_name) .await?; + info!( + "new workspace: {}, name:{}", + new_workspace.id, new_workspace.name + ); + // save the workspace to sqlite db let uid = self.user_id()?; let mut conn = self.db_connection(uid)?; @@ -208,7 +214,9 @@ impl UserManager { save_user_workspaces(uid, conn, &[user_workspace]) } + #[instrument(level = "info", skip(self), err)] pub async fn leave_workspace(&self, workspace_id: &str) -> FlowyResult<()> { + info!("leave workspace: {}", workspace_id); self .cloud_services .get_user_service()? @@ -221,7 +229,9 @@ impl UserManager { delete_user_workspaces(conn, workspace_id) } + #[instrument(level = "info", skip(self), err)] pub async fn delete_workspace(&self, workspace_id: &str) -> FlowyResult<()> { + info!("delete workspace: {}", workspace_id); self .cloud_services .get_user_service()? diff --git a/frontend/rust-lib/lib-log/Cargo.toml b/frontend/rust-lib/lib-log/Cargo.toml index 6674c0855c..1b8ebcb2bc 100644 --- a/frontend/rust-lib/lib-log/Cargo.toml +++ b/frontend/rust-lib/lib-log/Cargo.toml @@ -6,7 +6,6 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] - tracing-subscriber = { version = "0.3.17", features = ["registry", "env-filter", "ansi", "json"] } tracing-bunyan-formatter = "0.3.9" tracing-appender = "0.2.3" @@ -16,7 +15,4 @@ serde_json.workspace = true serde.workspace = true chrono = "0.4" lazy_static = "1.4.0" -lib-infra.workspace = true - -[features] -use_bunyan = [] +lib-infra.workspace = true \ No newline at end of file diff --git a/frontend/rust-lib/lib-log/src/layer.rs b/frontend/rust-lib/lib-log/src/layer.rs index 8a87e91fc1..28bd54b01f 100644 --- a/frontend/rust-lib/lib-log/src/layer.rs +++ b/frontend/rust-lib/lib-log/src/layer.rs @@ -46,7 +46,7 @@ where ) -> Result<(), std::io::Error> { map_serializer.serialize_entry(MESSAGE, &message)?; // map_serializer.serialize_entry(LEVEL, &format!("{}", level))?; - map_serializer.serialize_entry(TIME, &Local::now().format("%Y-%m-%d %H:%M:%S").to_string())?; + map_serializer.serialize_entry(TIME, &Local::now().format("%m-%d %H:%M:%S").to_string())?; Ok(()) } diff --git a/frontend/scripts/makefile/tests.toml b/frontend/scripts/makefile/tests.toml index 909e022fc5..8ac3ab8dae 100644 --- a/frontend/scripts/makefile/tests.toml +++ b/frontend/scripts/makefile/tests.toml @@ -1,4 +1,3 @@ - # If you want to test a single file with single case, you can try this command: # RUST_LOG="debug" flutter test -d macOS -j, 'path to the file' --name 'test case name' [tasks.flutter_test] @@ -77,7 +76,7 @@ env = { RUST_LOG = "info" } description = "Run rust-lib unit tests" script = ''' cd rust-lib -RUST_LOG=info DISABLE_CI_TEST_LOG="true" RUST_BACKTRACE=1 cargo test --no-default-features --features "rev-sqlite" +RUST_LOG=info DISABLE_CI_TEST_LOG="true" RUST_BACKTRACE=1 cargo test --no-default-features ''' @@ -126,7 +125,7 @@ script = [""" CARGO_INCREMENTAL=0 \ RUSTFLAGS='-C instrument-coverage' \ LLVM_PROFILE_FILE='prof-%p-%m.profraw' \ - cargo test --no-default-features --features="rev-sqlite" + cargo test --no-default-features """] [tasks.run_sharedlib_coverage_tests] @@ -147,27 +146,27 @@ script = [""" description = "Get `grcov` HTML report for test coverage for rust-lib" script_runner = "@shell" script = [ - """ - echo --- Getting 'grcov' results for 'rust-lib' --- - cd rust-lib/ + """ + echo --- Getting 'grcov' results for 'rust-lib' --- + cd rust-lib/ - grcov . \ - --binary-path target/debug/deps \ - --source-dir . \ - --output-type html \ - --branch \ - --ignore-not-existing \ - --log-level WARN \ - --output-path target/coverage-html + grcov . \ + --binary-path target/debug/deps \ + --source-dir . \ + --output-type html \ + --branch \ + --ignore-not-existing \ + --log-level WARN \ + --output-path target/coverage-html - echo "--- Done! Generated HTML report under 'target/coverage-html' for rustlib." - """, + echo "--- Done! Generated HTML report under 'target/coverage-html' for rustlib." + """, ] [tasks.get_grcov_report] description = "Get `grcov` HTML report for test coverage" run_task = { name = [ - "get_rustlib_grcov_report", + "get_rustlib_grcov_report", ], parallel = true } [tasks.get_rustlib_lcov_report] @@ -193,18 +192,18 @@ script = [""" [tasks.get_lcov_report] description = "Get `lcov` reports for test coverage" run_task = { name = [ - "get_rustlib_lcov_report", + "get_rustlib_lcov_report", ], parallel = true } [tasks.rust_unit_test_with_coverage] description = "Run rust unit test with code coverage" run_task = { name = [ - "check_grcov", - 'appflowy-flutter-deps-tools', - "run_rustlib_coverage_tests", - "run_sharedlib_coverage_tests", - "get_lcov_report", - "clean_profraw_files", + "check_grcov", + 'appflowy-flutter-deps-tools', + "run_rustlib_coverage_tests", + "run_sharedlib_coverage_tests", + "get_lcov_report", + "clean_profraw_files", ] } @@ -231,10 +230,10 @@ script_runner = "@shell" category = "Build" dependencies = ["env_check"] run_task = { name = [ - "setup-test-crate-type", - "compile_test_backend", - "copy-to-sandbox-folder", - "restore-test-crate-type", + "setup-test-crate-type", + "compile_test_backend", + "copy-to-sandbox-folder", + "restore-test-crate-type", ] } [tasks.compile_test_backend] @@ -246,26 +245,26 @@ linux_alias = "compile_test_backend_default" env = { RUST_LOG = "trace" } 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 ../ - """, + """ + 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 ../ - """, + """ + 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" @@ -277,28 +276,28 @@ 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} - """, + """ + # 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} - """, + """ + # 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" @@ -310,39 +309,39 @@ linux_alias = "copy-from-build-to-sandbox-folder-linux" [tasks.copy-from-build-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} - dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/windows/flutter/dart_ffi - rm ${dest} + """ + # 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} + dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/windows/flutter/dart_ffi + rm ${dest} - cp ${dart_ffi_dir}/${lib} ${dest} - """, + cp ${dart_ffi_dir}/${lib} ${dest} + """, ] script_runner = "@duckscript" [tasks.copy-from-build-to-sandbox-folder-macos] private = true script = [ - """ - echo "This is not possible for mac because the tests wont work with .a lib" - exit 127 - """, + """ + echo "This is not possible for mac because the tests wont work with .a lib" + exit 127 + """, ] script_runner = "@duckscript" [tasks.copy-from-build-to-sandbox-folder-linux] 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} - dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/linux/flutter/dart_ffi - rm ${dest} + """ + # 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} + dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/linux/flutter/dart_ffi + rm ${dest} - cp ${dart_ffi_dir}/${lib} ${dest} - """, + cp ${dart_ffi_dir}/${lib} ${dest} + """, ] script_runner = "@duckscript"