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_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

View File

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

View File

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

View File

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

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"] }
[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 = []

View File

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

View File

@ -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<Box<dyn CollabPlugin>> {
// If the user is local, we don't need to create a sync plugin.
if self.get_server_type().is_local() {

View File

@ -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<F1, F2, Output>(&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<ViewPB> {
trace!("Get view pb with id: {}", view_id);
let view_id = view_id.to_string();
let folder = self.mutex_folder.read();

View File

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

View File

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

View File

@ -159,6 +159,7 @@ impl UserManager {
Ok(())
}
#[instrument(level = "info", skip(self), err)]
pub async fn add_workspace(&self, workspace_name: &str) -> FlowyResult<UserWorkspace> {
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()?

View File

@ -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"
@ -17,6 +16,3 @@ serde.workspace = true
chrono = "0.4"
lazy_static = "1.4.0"
lib-infra.workspace = true
[features]
use_bunyan = []

View File

@ -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(())
}

View File

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