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

@ -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"

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"
@ -17,6 +16,3 @@ 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]