Browse Source

Merge pull request #1082 from AppFlowy-IO/feat/optional_openssl_build

Nathan.fooo 2 years ago
parent
commit
f1d818bec7

+ 16 - 12
frontend/Makefile.toml

@@ -14,7 +14,7 @@ extend = [
 on_error_task = "catch"
 
 [tasks.catch]
-run_task = {name = ["restore-crate-type"]}
+run_task = { name = ["restore-crate-type"] }
 
 [env]
 RUST_LOG = "info"
@@ -42,8 +42,8 @@ PRODUCT_NAME = "AppFlowy"
 CRATE_TYPE = "staticlib"
 SDK_EXT = "a"
 APP_ENVIRONMENT = "local"
-FLUTTER_FLOWY_SDK_PATH="app_flowy/packages/flowy_sdk"
-PROTOBUF_DERIVE_CACHE="../shared-lib/flowy-derive/src/derive_cache/derive_cache.rs"
+FLUTTER_FLOWY_SDK_PATH = "app_flowy/packages/flowy_sdk"
+PROTOBUF_DERIVE_CACHE = "../shared-lib/flowy-derive/src/derive_cache/derive_cache.rs"
 
 [env.development-mac-arm64]
 RUST_LOG = "info"
@@ -139,8 +139,7 @@ LINUX_ARCH = "arm64"
 APP_ENVIRONMENT = "production"
 
 [tasks.echo_env]
-script = [
-    '''
+script = ['''
     echo "-------- Env Parameters --------"
     echo CRATE_TYPE: ${CRATE_TYPE}
     echo BUILD_FLAG: ${BUILD_FLAG}
@@ -151,8 +150,7 @@ script = [
     echo APP_ENVIRONMENT: ${APP_ENVIRONMENT}
     echo ${platforms}
     echo ${BUILD_ARCHS}
-    '''
-]
+    ''']
 script_runner = "@shell"
 
 [env.production-ios]
@@ -166,6 +164,14 @@ BUILD_FLAG = "debug"
 TARGET_OS = "android"
 CRATE_TYPE = "cdylib"
 FLUTTER_OUTPUT_DIR = "Debug"
+FEATURES = "flutter,openssl_vendored"
+
+[env.production-android]
+BUILD_FLAG = "release"
+TARGET_OS = "android"
+CRATE_TYPE = "cdylib"
+FLUTTER_OUTPUT_DIR = "Release"
+FEATURES = "flutter,openssl_vendored"
 
 [tasks.setup-crate-type]
 private = true
@@ -192,11 +198,9 @@ script = [
 script_runner = "@duckscript"
 
 [tasks.test-build]
-condition = { env_set = [ "FLUTTER_FLOWY_SDK_PATH"] }
-script = [
-    """
+condition = { env_set = ["FLUTTER_FLOWY_SDK_PATH"] }
+script = ["""
       cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib/flowy-net
       cargo build -vv --features=dart
-      """,
-]
+      """]
 script_runner = "@shell"

+ 0 - 2
frontend/app_flowy/packages/flowy_infra_ui/pubspec.yaml

@@ -29,8 +29,6 @@ dependencies:
     path: flowy_infra_ui_web
   appflowy_popover:
     path: ../appflowy_popover
-
-  # Flowy packages
   flowy_infra:
     path: ../flowy_infra
 

+ 15 - 1
frontend/app_flowy/pubspec.lock

@@ -35,7 +35,7 @@ packages:
       path: "packages/appflowy_editor"
       relative: true
     source: path
-    version: "0.0.4"
+    version: "0.0.5"
   appflowy_popover:
     dependency: "direct main"
     description:
@@ -43,6 +43,13 @@ packages:
       relative: true
     source: path
     version: "0.0.1"
+  archive:
+    dependency: transitive
+    description:
+      name: archive
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "3.3.1"
   args:
     dependency: transitive
     description:
@@ -660,6 +667,13 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "0.17.0"
+  intl_utils:
+    dependency: transitive
+    description:
+      name: intl_utils
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "2.7.0"
   io:
     dependency: transitive
     description:

+ 14 - 12
frontend/rust-lib/dart-ffi/Cargo.toml

@@ -12,30 +12,32 @@ crate-type = ["staticlib"]
 
 
 [dependencies]
-allo-isolate = {version = "^0.1", features = ["catch-unwind",]}
-byteorder = {version = "1.3.4"}
-ffi-support = {version = "0.4.2"}
-protobuf = {version = "2.20.0"}
+allo-isolate = { version = "^0.1", features = ["catch-unwind"] }
+byteorder = { version = "1.3.4" }
+ffi-support = { version = "0.4.2" }
+protobuf = { version = "2.20.0" }
 tokio = { version = "1", features = ["rt", "rt-multi-thread"] }
 log = "0.4.14"
 serde = { version = "1.0", features = ["derive"] }
-serde_json = {version = "1.0"}
+serde_json = { version = "1.0" }
 bytes = { version = "1.0" }
 once_cell = "1"
 crossbeam-utils = "0.8.7"
 
 
-lib-dispatch = {path = "../lib-dispatch" }
-flowy-sdk = {path = "../flowy-sdk"}
-dart-notify = {path = "../dart-notify" }
-flowy-derive = {path = "../../../shared-lib/flowy-derive" }
+lib-dispatch = { path = "../lib-dispatch" }
+flowy-sdk = { path = "../flowy-sdk" }
+dart-notify = { path = "../dart-notify" }
+flowy-derive = { path = "../../../shared-lib/flowy-derive" }
 
 [features]
 default = ["flowy-sdk/dart", "dart-notify/dart", "flutter"]
 flutter = []
 http_sync = ["flowy-sdk/http_sync", "flowy-sdk/use_bunyan"]
-#use_serde = ["bincode"]
-#use_protobuf= ["protobuf"]
+openssl_vendored = ["flowy-sdk/openssl_vendored"]
 
 [build-dependencies]
-lib-infra = { path = "../../../shared-lib/lib-infra", features = ["protobuf_file_gen", "dart"] }
+lib-infra = { path = "../../../shared-lib/lib-infra", features = [
+    "protobuf_file_gen",
+    "dart",
+] }

+ 17 - 14
frontend/rust-lib/flowy-database/Cargo.toml

@@ -1,14 +1,17 @@
-[package]
-name = "flowy-database"
-version = "0.1.0"
-edition = "2018"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-diesel = {version = "1.4.8", features = ["sqlite"]}
-diesel_derives = {version = "1.4.1", features = ["sqlite"]}
-diesel_migrations = {version = "1.4.0", features = ["sqlite"]}
-lib-sqlite = { path = "../lib-sqlite" }
-log = "0.4"
-lazy_static = "1.4.0"
+[package]
+name = "flowy-database"
+version = "0.1.0"
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+diesel = { version = "1.4.8", features = ["sqlite"] }
+diesel_derives = { version = "1.4.1", features = ["sqlite"] }
+diesel_migrations = { version = "1.4.0", features = ["sqlite"] }
+lib-sqlite = { path = "../lib-sqlite" }
+log = "0.4"
+lazy_static = "1.4.0"
+
+[features]
+openssl_vendored = ["lib-sqlite/openssl_vendored"]

+ 52 - 44
frontend/rust-lib/flowy-sdk/Cargo.toml

@@ -1,44 +1,52 @@
-[package]
-name = "flowy-sdk"
-version = "0.1.0"
-edition = "2018"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-lib-dispatch = { path = "../lib-dispatch" }
-lib-log = { path = "../lib-log" }
-flowy-user = { path = "../flowy-user" }
-flowy-net = { path = "../flowy-net" }
-flowy-folder = { path = "../flowy-folder", default-features = false }
-flowy-grid = { path = "../flowy-grid", default-features = false }
-flowy-grid-data-model = { path = "../../../shared-lib/flowy-grid-data-model" }
-flowy-database = { path = "../flowy-database" }
-flowy-text-block = { path = "../flowy-text-block", default-features = false }
-flowy-revision = { path = "../flowy-revision" }
-
-tracing = { version = "0.1" }
-log = "0.4.14"
-futures-core = { version = "0.3", default-features = false }
-color-eyre = { version = "0.5", default-features = false }
-bytes = "1.0"
-tokio = { version = "1", features = ["rt"] }
-parking_lot = "0.11"
-
-flowy-sync = { path = "../../../shared-lib/flowy-sync" }
-lib-ws = { path = "../../../shared-lib/lib-ws" }
-lib-infra = { path = "../../../shared-lib/lib-infra" }
-
-[dev-dependencies]
-serde = { version = "1.0", features = ["derive"] }
-bincode = { version = "1.3"}
-protobuf = {version = "2.24.1"}
-claim = "0.5.0"
-tokio = { version = "1", features = ["full"]}
-futures-util = "0.3.15"
-
-[features]
-http_sync = ["flowy-folder/cloud_sync", "flowy-text-block/cloud_sync"]
-native_sync = ["flowy-folder/cloud_sync", "flowy-text-block/cloud_sync"]
-use_bunyan = ["lib-log/use_bunyan"]
-dart = ["flowy-user/dart", "flowy-net/dart", "flowy-folder/dart", "flowy-sync/dart", "flowy-grid/dart", "flowy-text-block/dart"]
+[package]
+name = "flowy-sdk"
+version = "0.1.0"
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+lib-dispatch = { path = "../lib-dispatch" }
+lib-log = { path = "../lib-log" }
+flowy-user = { path = "../flowy-user" }
+flowy-net = { path = "../flowy-net" }
+flowy-folder = { path = "../flowy-folder", default-features = false }
+flowy-grid = { path = "../flowy-grid", default-features = false }
+flowy-grid-data-model = { path = "../../../shared-lib/flowy-grid-data-model" }
+flowy-database = { path = "../flowy-database" }
+flowy-text-block = { path = "../flowy-text-block", default-features = false }
+flowy-revision = { path = "../flowy-revision" }
+
+tracing = { version = "0.1" }
+log = "0.4.14"
+futures-core = { version = "0.3", default-features = false }
+color-eyre = { version = "0.5", default-features = false }
+bytes = "1.0"
+tokio = { version = "1", features = ["rt"] }
+parking_lot = "0.11"
+
+flowy-sync = { path = "../../../shared-lib/flowy-sync" }
+lib-ws = { path = "../../../shared-lib/lib-ws" }
+lib-infra = { path = "../../../shared-lib/lib-infra" }
+
+[dev-dependencies]
+serde = { version = "1.0", features = ["derive"] }
+bincode = { version = "1.3" }
+protobuf = { version = "2.24.1" }
+claim = "0.5.0"
+tokio = { version = "1", features = ["full"] }
+futures-util = "0.3.15"
+
+[features]
+http_sync = ["flowy-folder/cloud_sync", "flowy-text-block/cloud_sync"]
+native_sync = ["flowy-folder/cloud_sync", "flowy-text-block/cloud_sync"]
+use_bunyan = ["lib-log/use_bunyan"]
+dart = [
+    "flowy-user/dart",
+    "flowy-net/dart",
+    "flowy-folder/dart",
+    "flowy-sync/dart",
+    "flowy-grid/dart",
+    "flowy-text-block/dart",
+]
+openssl_vendored = ["flowy-database/openssl_vendored"]

+ 1 - 0
frontend/rust-lib/flowy-text-block/src/editor.rs

@@ -24,6 +24,7 @@ use tokio::sync::{mpsc, oneshot};
 
 pub struct TextBlockEditor {
     pub doc_id: String,
+    #[allow(dead_code)]
     rev_manager: Arc<RevisionManager>,
     #[cfg(feature = "sync")]
     ws_manager: Arc<flowy_revision::RevisionWebSocketManager>,

+ 8 - 7
frontend/rust-lib/lib-sqlite/Cargo.toml

@@ -7,14 +7,15 @@ edition = "2018"
 
 [dependencies]
 r2d2 = "0.8.9"
-libsqlite3-sys = {version = ">=0.8.0, <0.24.0", features = ["bundled"]}
-diesel = {version = "1.4.8", features = ["sqlite"]}
-diesel_derives = {version = "1.4.1", features = ["sqlite"]}
-diesel_migrations = {version = "1.4.0", features = ["sqlite"]}
+libsqlite3-sys = { version = ">=0.8.0, <0.24.0", features = ["bundled"] }
+diesel = { version = "1.4.8", features = ["sqlite"] }
+diesel_derives = { version = "1.4.1", features = ["sqlite"] }
+diesel_migrations = { version = "1.4.0", features = ["sqlite"] }
 lazy_static = "1.4.0"
 scheduled-thread-pool = "0.2.5"
 error-chain = "=0.12.0"
 log = "0.4.11"
-openssl = { version = "0.10.38", features = ["vendored"] }
-#[features]
-#windows = ["libsqlite3-sys/bundled-windows"]
+openssl = { version = "0.10.38", optional = true }
+
+[features]
+openssl_vendored = ["openssl/vendored"]