chore: remove unused features (#5196)

* chore: remove unused features

* chore: update logs
This commit is contained in:
Nathan.fooo
2024-04-24 10:26:58 +08:00
committed by GitHub
parent 9aaada961f
commit 77d600a742
14 changed files with 137 additions and 141 deletions

View File

@ -94,7 +94,7 @@ jobs:
af_cloud_test_ws_url: ws://localhost/ws/v1 af_cloud_test_ws_url: ws://localhost/ws/v1
af_cloud_test_gotrue_url: http://localhost/gotrue af_cloud_test_gotrue_url: http://localhost/gotrue
run: | 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 - name: rustfmt rust-lib
run: cargo fmt --all -- --check run: cargo fmt --all -- --check

View File

@ -1,16 +1,16 @@
#https://github.com/sagiegurari/cargo-make #https://github.com/sagiegurari/cargo-make
extend = [ extend = [
{ path = "scripts/makefile/desktop.toml" }, { path = "scripts/makefile/desktop.toml" },
{ path = "scripts/makefile/mobile.toml" }, { path = "scripts/makefile/mobile.toml" },
{ path = "scripts/makefile/protobuf.toml" }, { path = "scripts/makefile/protobuf.toml" },
{ path = "scripts/makefile/tests.toml" }, { path = "scripts/makefile/tests.toml" },
{ path = "scripts/makefile/docker.toml" }, { path = "scripts/makefile/docker.toml" },
{ path = "scripts/makefile/env.toml" }, { path = "scripts/makefile/env.toml" },
{ path = "scripts/makefile/flutter.toml" }, { path = "scripts/makefile/flutter.toml" },
{ path = "scripts/makefile/tool.toml" }, { path = "scripts/makefile/tool.toml" },
{ path = "scripts/makefile/tauri.toml" }, { path = "scripts/makefile/tauri.toml" },
{ path = "scripts/makefile/web.toml" }, { path = "scripts/makefile/web.toml" },
] ]
[config] [config]
@ -27,7 +27,7 @@ CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
CARGO_MAKE_CRATE_NAME = "dart-ffi" CARGO_MAKE_CRATE_NAME = "dart-ffi"
LIB_NAME = "dart_ffi" LIB_NAME = "dart_ffi"
APPFLOWY_VERSION = "0.5.5" APPFLOWY_VERSION = "0.5.5"
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite" FLUTTER_DESKTOP_FEATURES = "dart"
PRODUCT_NAME = "AppFlowy" PRODUCT_NAME = "AppFlowy"
MACOSX_DEPLOYMENT_TARGET = "11.0" MACOSX_DEPLOYMENT_TARGET = "11.0"
# CRATE_TYPE: https://doc.rust-lang.org/reference/linkage.html # CRATE_TYPE: https://doc.rust-lang.org/reference/linkage.html
@ -162,7 +162,7 @@ CRATE_TYPE = "cdylib"
FLUTTER_OUTPUT_DIR = "Debug" FLUTTER_OUTPUT_DIR = "Debug"
LIB_EXT = "so" LIB_EXT = "so"
LINUX_ARCH = "arm64" LINUX_ARCH = "arm64"
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored" FLUTTER_DESKTOP_FEATURES = "dart,openssl_vendored"
[env.production-linux-aarch64] [env.production-linux-aarch64]
CARGO_PROFILE = "release" CARGO_PROFILE = "release"
@ -174,7 +174,7 @@ FLUTTER_OUTPUT_DIR = "Release"
LIB_EXT = "so" LIB_EXT = "so"
LINUX_ARCH = "arm64" LINUX_ARCH = "arm64"
APP_ENVIRONMENT = "production" APP_ENVIRONMENT = "production"
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored" FLUTTER_DESKTOP_FEATURES = "dart,openssl_vendored"
[env.development-ios-arm64-sim] [env.development-ios-arm64-sim]
BUILD_FLAG = "debug" BUILD_FLAG = "debug"
@ -207,7 +207,7 @@ CRATE_TYPE = "cdylib"
FLUTTER_OUTPUT_DIR = "Debug" FLUTTER_OUTPUT_DIR = "Debug"
LIB_EXT = "so" LIB_EXT = "so"
PRODUCT_EXT = "apk" PRODUCT_EXT = "apk"
FLUTTER_DESKTOP_FEATURES = "dart,rev-sqlite,openssl_vendored" FLUTTER_DESKTOP_FEATURES = "dart,openssl_vendored"
[env.production-android] [env.production-android]
BUILD_FLAG = "release" BUILD_FLAG = "release"
@ -235,24 +235,24 @@ script_runner = "@shell"
[tasks.setup-crate-type] [tasks.setup-crate-type]
private = true private = true
script = [ script = [
""" """
toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml
val = replace ${toml} "staticlib" ${CRATE_TYPE} val = replace ${toml} "staticlib" ${CRATE_TYPE}
result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val}
assert ${result} assert ${result}
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"
[tasks.restore-crate-type] [tasks.restore-crate-type]
private = true private = true
script = [ script = [
""" """
toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml
val = replace ${toml} ${CRATE_TYPE} "staticlib" val = replace ${toml} ${CRATE_TYPE} "staticlib"
result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val}
assert ${result} assert ${result}
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"
@ -280,24 +280,24 @@ TEST_COMPILE_TARGET = "x86_64-pc-windows-msvc"
[tasks.setup-test-crate-type] [tasks.setup-test-crate-type]
private = true private = true
script = [ script = [
""" """
toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml
val = replace ${toml} "staticlib" ${TEST_CRATE_TYPE} val = replace ${toml} "staticlib" ${TEST_CRATE_TYPE}
result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val}
assert ${result} assert ${result}
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"
[tasks.restore-test-crate-type] [tasks.restore-test-crate-type]
private = true private = true
script = [ script = [
""" """
toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml
val = replace ${toml} ${TEST_CRATE_TYPE} "staticlib" val = replace ${toml} ${TEST_CRATE_TYPE} "staticlib"
result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val} result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/${CARGO_MAKE_CRATE_NAME}/Cargo.toml ${val}
assert ${result} assert ${result}
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"

View File

@ -46,7 +46,6 @@ lib-dispatch = { path = "../../rust-lib/lib-dispatch", features = [
"use_serde", "use_serde",
] } ] }
flowy-core = { path = "../../rust-lib/flowy-core", features = [ flowy-core = { path = "../../rust-lib/flowy-core", features = [
"rev-sqlite",
"ts", "ts",
] } ] }
flowy-user = { path = "../../rust-lib/flowy-user", features = ["tauri_ts"] } flowy-user = { path = "../../rust-lib/flowy-user", features = ["tauri_ts"] }

View File

@ -46,7 +46,6 @@ lib-dispatch = { path = "../../rust-lib/lib-dispatch", features = [
"use_serde", "use_serde",
] } ] }
flowy-core = { path = "../../rust-lib/flowy-core", features = [ flowy-core = { path = "../../rust-lib/flowy-core", features = [
"rev-sqlite",
"ts", "ts",
] } ] }
flowy-user = { path = "../../rust-lib/flowy-user", features = ["tauri_ts"] } flowy-user = { path = "../../rust-lib/flowy-user", features = ["tauri_ts"] }

View File

@ -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"] } flowy-error = { workspace = true, features = ["impl_from_sqlite", "impl_from_dispatch_error", "impl_from_appflowy_cloud", "impl_from_reqwest", "impl_from_serde", "dart"] }
[features] [features]
default = ["dart", "rev-sqlite"] default = ["dart"]
dart = ["flowy-core/dart"] dart = ["flowy-core/dart"]
rev-sqlite = ["flowy-core/rev-sqlite"] http_sync = ["flowy-core/http_sync"]
http_sync = ["flowy-core/http_sync", "flowy-core/use_bunyan"]
openssl_vendored = ["flowy-core/openssl_vendored"] openssl_vendored = ["flowy-core/openssl_vendored"]
verbose_log = [] verbose_log = []

View File

@ -52,11 +52,9 @@ sysinfo = "0.30.5"
semver = "1.0.22" semver = "1.0.22"
[features] [features]
default = ["rev-sqlite"]
profiling = ["console-subscriber", "tokio/tracing"] profiling = ["console-subscriber", "tokio/tracing"]
http_sync = [] http_sync = []
native_sync = [] native_sync = []
use_bunyan = ["lib-log/use_bunyan"]
dart = [ dart = [
"flowy-user/dart", "flowy-user/dart",
"flowy-date/dart", "flowy-date/dart",
@ -71,7 +69,6 @@ ts = [
"flowy-database2/ts", "flowy-database2/ts",
"flowy-config/tauri_ts", "flowy-config/tauri_ts",
] ]
rev-sqlite = ["flowy-user/rev-sqlite"]
openssl_vendored = ["flowy-sqlite/openssl_vendored"] openssl_vendored = ["flowy-sqlite/openssl_vendored"]
# Enable/Disable AppFlowy Verbose Log Configuration # Enable/Disable AppFlowy Verbose Log Configuration

View File

@ -9,7 +9,7 @@ use collab::preclude::CollabPlugin;
use collab_entity::CollabType; use collab_entity::CollabType;
use collab_plugins::cloud_storage::postgres::SupabaseDBPlugin; use collab_plugins::cloud_storage::postgres::SupabaseDBPlugin;
use tokio_stream::wrappers::WatchStream; use tokio_stream::wrappers::WatchStream;
use tracing::{debug, instrument}; use tracing::debug;
use collab_integrate::collab_builder::{ use collab_integrate::collab_builder::{
CollabCloudPluginProvider, CollabPluginProviderContext, CollabPluginProviderType, CollabCloudPluginProvider, CollabPluginProviderContext, CollabPluginProviderType,
@ -325,7 +325,6 @@ impl CollabCloudPluginProvider for ServerProvider {
self.get_server_type().into() 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<Box<dyn CollabPlugin>> { fn get_plugins(&self, context: CollabPluginProviderContext) -> Vec<Box<dyn CollabPlugin>> {
// If the user is local, we don't need to create a sync plugin. // If the user is local, we don't need to create a sync plugin.
if self.get_server_type().is_local() { if self.get_server_type().is_local() {

View File

@ -35,7 +35,7 @@ use parking_lot::RwLock;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use std::ops::Deref; use std::ops::Deref;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use tracing::{error, info, instrument, trace}; use tracing::{error, info, instrument};
conditional_send_sync_trait! { conditional_send_sync_trait! {
"[crate::manager::FolderUser] represents the user for folder."; "[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`. /// * `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. /// * `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<F1, F2, Output>(&self, none_callback: F1, f2: F2) -> Output fn with_folder<F1, F2, Output>(&self, none_callback: F1, f2: F2) -> Output
where where
F1: FnOnce() -> Output, F1: FnOnce() -> Output,
@ -482,7 +481,6 @@ impl FolderManager {
/// again using the ID of the child view you wish to access. /// again using the ID of the child view you wish to access.
#[tracing::instrument(level = "debug", skip(self))] #[tracing::instrument(level = "debug", skip(self))]
pub async fn get_view_pb(&self, view_id: &str) -> FlowyResult<ViewPB> { pub async fn get_view_pb(&self, view_id: &str) -> FlowyResult<ViewPB> {
trace!("Get view pb with id: {}", view_id);
let view_id = view_id.to_string(); let view_id = view_id.to_string();
let folder = self.mutex_folder.read(); let folder = self.mutex_folder.read();

View File

@ -7,7 +7,7 @@ edition = "2018"
[dependencies] [dependencies]
flowy-derive.workspace = true flowy-derive.workspace = true
flowy-sqlite = { workspace = true, optional = true } flowy-sqlite = { workspace = true }
flowy-encrypt = { 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-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_from_sqlite", "impl_from_collab_folder", "impl_from_collab_persistence"] }
flowy-folder-pub = { workspace = true } flowy-folder-pub = { workspace = true }
@ -57,8 +57,6 @@ rand_core = "0.6.2"
quickcheck_macros = "1.0" quickcheck_macros = "1.0"
[features] [features]
default = ["rev-sqlite"]
rev-sqlite = ["flowy-sqlite"]
dart = ["flowy-codegen/dart", "flowy-notification/dart"] dart = ["flowy-codegen/dart", "flowy-notification/dart"]
tauri_ts = ["flowy-codegen/ts", "flowy-notification/tauri_ts"] tauri_ts = ["flowy-codegen/ts", "flowy-notification/tauri_ts"]

View File

@ -133,6 +133,7 @@ impl UserManager {
if let Ok(session) = self.get_session() { if let Ok(session) = self.get_session() {
let user = self.get_user_profile_from_disk(session.user_id).await?; let user = self.get_user_profile_from_disk(session.user_id).await?;
// Get the current authenticator from the environment variable // Get the current authenticator from the environment variable
let current_authenticator = current_authenticator(); let current_authenticator = current_authenticator();
@ -151,9 +152,10 @@ impl UserManager {
event!( event!(
tracing::Level::INFO, tracing::Level::INFO,
"init user session: {}:{}", "init user session: {}:{}, authenticator: {:?}",
user.uid, user.uid,
user.email user.email,
user.authenticator,
); );
self.prepare_user(&session).await; self.prepare_user(&session).await;

View File

@ -159,6 +159,7 @@ impl UserManager {
Ok(()) Ok(())
} }
#[instrument(level = "info", skip(self), err)]
pub async fn add_workspace(&self, workspace_name: &str) -> FlowyResult<UserWorkspace> { pub async fn add_workspace(&self, workspace_name: &str) -> FlowyResult<UserWorkspace> {
let new_workspace = self let new_workspace = self
.cloud_services .cloud_services
@ -166,6 +167,11 @@ impl UserManager {
.create_workspace(workspace_name) .create_workspace(workspace_name)
.await?; .await?;
info!(
"new workspace: {}, name:{}",
new_workspace.id, new_workspace.name
);
// save the workspace to sqlite db // save the workspace to sqlite db
let uid = self.user_id()?; let uid = self.user_id()?;
let mut conn = self.db_connection(uid)?; let mut conn = self.db_connection(uid)?;
@ -208,7 +214,9 @@ impl UserManager {
save_user_workspaces(uid, conn, &[user_workspace]) save_user_workspaces(uid, conn, &[user_workspace])
} }
#[instrument(level = "info", skip(self), err)]
pub async fn leave_workspace(&self, workspace_id: &str) -> FlowyResult<()> { pub async fn leave_workspace(&self, workspace_id: &str) -> FlowyResult<()> {
info!("leave workspace: {}", workspace_id);
self self
.cloud_services .cloud_services
.get_user_service()? .get_user_service()?
@ -221,7 +229,9 @@ impl UserManager {
delete_user_workspaces(conn, workspace_id) delete_user_workspaces(conn, workspace_id)
} }
#[instrument(level = "info", skip(self), err)]
pub async fn delete_workspace(&self, workspace_id: &str) -> FlowyResult<()> { pub async fn delete_workspace(&self, workspace_id: &str) -> FlowyResult<()> {
info!("delete workspace: {}", workspace_id);
self self
.cloud_services .cloud_services
.get_user_service()? .get_user_service()?

View File

@ -6,7 +6,6 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
tracing-subscriber = { version = "0.3.17", features = ["registry", "env-filter", "ansi", "json"] } tracing-subscriber = { version = "0.3.17", features = ["registry", "env-filter", "ansi", "json"] }
tracing-bunyan-formatter = "0.3.9" tracing-bunyan-formatter = "0.3.9"
tracing-appender = "0.2.3" tracing-appender = "0.2.3"
@ -16,7 +15,4 @@ serde_json.workspace = true
serde.workspace = true serde.workspace = true
chrono = "0.4" chrono = "0.4"
lazy_static = "1.4.0" lazy_static = "1.4.0"
lib-infra.workspace = true lib-infra.workspace = true
[features]
use_bunyan = []

View File

@ -46,7 +46,7 @@ where
) -> Result<(), std::io::Error> { ) -> Result<(), std::io::Error> {
map_serializer.serialize_entry(MESSAGE, &message)?; map_serializer.serialize_entry(MESSAGE, &message)?;
// map_serializer.serialize_entry(LEVEL, &format!("{}", level))?; // 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(()) Ok(())
} }

View File

@ -1,4 +1,3 @@
# If you want to test a single file with single case, you can try this command: # 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' # RUST_LOG="debug" flutter test -d macOS -j, 'path to the file' --name 'test case name'
[tasks.flutter_test] [tasks.flutter_test]
@ -77,7 +76,7 @@ env = { RUST_LOG = "info" }
description = "Run rust-lib unit tests" description = "Run rust-lib unit tests"
script = ''' script = '''
cd rust-lib 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 \ CARGO_INCREMENTAL=0 \
RUSTFLAGS='-C instrument-coverage' \ RUSTFLAGS='-C instrument-coverage' \
LLVM_PROFILE_FILE='prof-%p-%m.profraw' \ 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] [tasks.run_sharedlib_coverage_tests]
@ -147,27 +146,27 @@ script = ["""
description = "Get `grcov` HTML report for test coverage for rust-lib" description = "Get `grcov` HTML report for test coverage for rust-lib"
script_runner = "@shell" script_runner = "@shell"
script = [ script = [
""" """
echo --- Getting 'grcov' results for 'rust-lib' --- echo --- Getting 'grcov' results for 'rust-lib' ---
cd rust-lib/ cd rust-lib/
grcov . \ grcov . \
--binary-path target/debug/deps \ --binary-path target/debug/deps \
--source-dir . \ --source-dir . \
--output-type html \ --output-type html \
--branch \ --branch \
--ignore-not-existing \ --ignore-not-existing \
--log-level WARN \ --log-level WARN \
--output-path target/coverage-html --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] [tasks.get_grcov_report]
description = "Get `grcov` HTML report for test coverage" description = "Get `grcov` HTML report for test coverage"
run_task = { name = [ run_task = { name = [
"get_rustlib_grcov_report", "get_rustlib_grcov_report",
], parallel = true } ], parallel = true }
[tasks.get_rustlib_lcov_report] [tasks.get_rustlib_lcov_report]
@ -193,18 +192,18 @@ script = ["""
[tasks.get_lcov_report] [tasks.get_lcov_report]
description = "Get `lcov` reports for test coverage" description = "Get `lcov` reports for test coverage"
run_task = { name = [ run_task = { name = [
"get_rustlib_lcov_report", "get_rustlib_lcov_report",
], parallel = true } ], parallel = true }
[tasks.rust_unit_test_with_coverage] [tasks.rust_unit_test_with_coverage]
description = "Run rust unit test with code coverage" description = "Run rust unit test with code coverage"
run_task = { name = [ run_task = { name = [
"check_grcov", "check_grcov",
'appflowy-flutter-deps-tools', 'appflowy-flutter-deps-tools',
"run_rustlib_coverage_tests", "run_rustlib_coverage_tests",
"run_sharedlib_coverage_tests", "run_sharedlib_coverage_tests",
"get_lcov_report", "get_lcov_report",
"clean_profraw_files", "clean_profraw_files",
] } ] }
@ -231,10 +230,10 @@ script_runner = "@shell"
category = "Build" category = "Build"
dependencies = ["env_check"] dependencies = ["env_check"]
run_task = { name = [ run_task = { name = [
"setup-test-crate-type", "setup-test-crate-type",
"compile_test_backend", "compile_test_backend",
"copy-to-sandbox-folder", "copy-to-sandbox-folder",
"restore-test-crate-type", "restore-test-crate-type",
] } ] }
[tasks.compile_test_backend] [tasks.compile_test_backend]
@ -246,26 +245,26 @@ linux_alias = "compile_test_backend_default"
env = { RUST_LOG = "trace" } env = { RUST_LOG = "trace" }
private = true private = true
script = [ script = [
""" """
cd rust-lib/ cd rust-lib/
rustup show rustup show
echo RUST_LOG=${RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}" 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}" RUST_LOG=${RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
cd ../ cd ../
""", """,
] ]
script_runner = "@shell" script_runner = "@shell"
[tasks.compile_test_backend_windows] [tasks.compile_test_backend_windows]
private = true private = true
script = [ script = [
""" """
cd rust-lib/ cd rust-lib/
rustup show rustup show
echo cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}" 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}" RUST_LOG=${RUST_LOG} cargo build --package=dart-ffi --target ${TEST_COMPILE_TARGET} --features "${FLUTTER_DESKTOP_FEATURES}"
cd ../ cd ../
""", """,
] ]
script_runner = "@shell" script_runner = "@shell"
@ -277,28 +276,28 @@ linux_alias = "copy-to-sandbox-folder-default"
[tasks.copy-to-sandbox-folder-windows] [tasks.copy-to-sandbox-folder-windows]
private = true private = true
script = [ script = [
""" """
# Copy the appflowy_backend lib to system temp directory for flutter unit test. # Copy the appflowy_backend lib to system temp directory for flutter unit test.
lib = set ${LIB_NAME}.${TEST_LIB_EXT} lib = set ${LIB_NAME}.${TEST_LIB_EXT}
dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib} dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib}
rm ${dest} rm ${dest}
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \ cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \
${dest} ${dest}
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"
[tasks.copy-to-sandbox-folder-default] [tasks.copy-to-sandbox-folder-default]
private = true private = true
script = [ script = [
""" """
# Copy the appflowy_backend lib to system temp directory for flutter unit test. # Copy the appflowy_backend lib to system temp directory for flutter unit test.
lib = set lib${LIB_NAME}.${TEST_LIB_EXT} lib = set lib${LIB_NAME}.${TEST_LIB_EXT}
dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib} dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib}
rm ${dest} rm ${dest}
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \ cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/target/${TEST_COMPILE_TARGET}/${TEST_BUILD_FLAG}/${lib} \
${dest} ${dest}
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"
@ -310,39 +309,39 @@ linux_alias = "copy-from-build-to-sandbox-folder-linux"
[tasks.copy-from-build-to-sandbox-folder-windows] [tasks.copy-from-build-to-sandbox-folder-windows]
private = true private = true
script = [ script = [
""" """
# Copy the appflowy_backend lib to system temp directory for flutter unit test. # Copy the appflowy_backend lib to system temp directory for flutter unit test.
lib = set ${LIB_NAME}.${TEST_LIB_EXT} lib = set ${LIB_NAME}.${TEST_LIB_EXT}
dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib} 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 dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/windows/flutter/dart_ffi
rm ${dest} rm ${dest}
cp ${dart_ffi_dir}/${lib} ${dest} cp ${dart_ffi_dir}/${lib} ${dest}
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"
[tasks.copy-from-build-to-sandbox-folder-macos] [tasks.copy-from-build-to-sandbox-folder-macos]
private = true private = true
script = [ script = [
""" """
echo "This is not possible for mac because the tests wont work with .a lib" echo "This is not possible for mac because the tests wont work with .a lib"
exit 127 exit 127
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"
[tasks.copy-from-build-to-sandbox-folder-linux] [tasks.copy-from-build-to-sandbox-folder-linux]
private = true private = true
script = [ script = [
""" """
# Copy the appflowy_backend lib to system temp directory for flutter unit test. # Copy the appflowy_backend lib to system temp directory for flutter unit test.
lib = set lib${LIB_NAME}.${TEST_LIB_EXT} lib = set lib${LIB_NAME}.${TEST_LIB_EXT}
dest = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/.sandbox/${lib} 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 dart_ffi_dir= set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/appflowy_flutter/linux/flutter/dart_ffi
rm ${dest} rm ${dest}
cp ${dart_ffi_dir}/${lib} ${dest} cp ${dart_ffi_dir}/${lib} ${dest}
""", """,
] ]
script_runner = "@duckscript" script_runner = "@duckscript"