refactor: generate dart pb files with feature flag: dart

This commit is contained in:
appflowy
2022-02-08 14:57:16 +08:00
parent 9135b92a39
commit d0b02cb4fd
42 changed files with 172 additions and 573 deletions

View File

@ -214,17 +214,6 @@ dependencies = [
"serde",
]
[[package]]
name = "cargo_toml"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e270ef0cd868745878982f7ce470aa898d0d4bb248af67f0cf66f54617913ef"
dependencies = [
"serde",
"serde_derive",
"toml",
]
[[package]]
name = "cast"
version = "0.2.7"
@ -1572,7 +1561,6 @@ name = "lib-infra"
version = "0.1.0"
dependencies = [
"bytes",
"cargo_toml",
"chrono",
"cmd_lib",
"futures-core",
@ -2836,15 +2824,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "toml"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
dependencies = [
"serde",
]
[[package]]
name = "tower-service"
version = "0.3.1"

View File

@ -24,7 +24,7 @@ bytes = { version = "1.0" }
once_cell = "1"
lib-dispatch = {path = "../lib-dispatch" }
flowy-sdk = {path = "../flowy-sdk"}
flowy-sdk = {path = "../flowy-sdk", features = ["dart"]}
dart-notify = {path = "../dart-notify" }
flowy-derive = {path = "../../../shared-lib/flowy-derive" }
@ -35,4 +35,4 @@ http_server = ["flowy-sdk/http_server", "flowy-sdk/use_bunyan"]
#use_protobuf= ["protobuf"]
[build-dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["gen_pb"] }
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["pb_gen", "dart"] }

View File

@ -1,5 +1,5 @@
use lib_infra::pb;
use lib_infra::pb_gen;
fn main() {
pb::gen("dart-ffi", "./src/protobuf/proto");
pb_gen::gen("dart-ffi", "./src/protobuf/proto");
}

View File

@ -16,7 +16,7 @@ flowy-derive = {path = "../../../shared-lib/flowy-derive" }
lib-dispatch = {path = "../lib-dispatch" }
[features]
dart = []
dart = ["lib-infra/dart"]
[build-dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["gen_pb"] }
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["pb_gen"] }

View File

@ -1,5 +1,5 @@
use lib_infra::pb;
use lib_infra::pb_gen;
fn main() {
pb::gen("dart-notify", "./src/protobuf/proto");
pb_gen::gen("dart-notify", "./src/protobuf/proto");
}

View File

@ -7,7 +7,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
flowy-collaboration = { path = "../../../shared-lib/flowy-collaboration" }
flowy-collaboration = { path = "../../../shared-lib/flowy-collaboration"}
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
lib-ot = { path = "../../../shared-lib/lib-ot" }
lib-ws = { path = "../../../shared-lib/lib-ws" }
@ -52,7 +52,6 @@ color-eyre = { version = "0.5", default-features = false }
criterion = "0.3"
rand = "0.7.3"
[features]
http_server = []
flowy_unit_test = ["lib-ot/flowy_unit_test", "flowy-sync/flowy_unit_test"]

View File

@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
error-code = { path = "../../../shared-lib/error-code" }
error-code = { path = "../../../shared-lib/error-code"}
lib-dispatch = { path = "../lib-dispatch" }
protobuf = {version = "2.20.0"}
bytes = "1.0"
@ -27,6 +27,7 @@ ot = ["lib-ot"]
serde = ["serde_json"]
http_server = ["http-flowy"]
db = ["flowy-database", "lib-sqlite", "r2d2"]
dart = ["error-code/dart", "lib-infra/dart"]
[build-dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["gen_pb"] }
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["pb_gen"] }

View File

@ -1,5 +1,5 @@
use lib_infra::pb;
use lib_infra::pb_gen;
fn main() {
pb::gen("flowy-error", "./src/protobuf/proto");
pb_gen::gen("flowy-error", "./src/protobuf/proto");
}

View File

@ -53,6 +53,7 @@ flowy-test = { path = "../flowy-test" }
default = []
http_server = []
flowy_unit_test = ["lib-ot/flowy_unit_test", "flowy-sync/flowy_unit_test"]
dart = ["lib-infra/dart", "flowy-folder/dart", "flowy-folder/dart",]
[build-dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["gen_pb"] }
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["pb_gen"] }

View File

@ -1,5 +1,5 @@
use lib_infra::pb;
use lib_infra::pb_gen;
fn main() {
pb::gen("flowy-folder", "./src/protobuf/proto");
pb_gen::gen("flowy-folder", "./src/protobuf/proto");
}

View File

@ -10,7 +10,7 @@ lib-dispatch = { path = "../lib-dispatch" }
flowy-error = { path = "../flowy-error", features = ["collaboration", "http_server"] }
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
flowy-collaboration = { path = "../../../shared-lib/flowy-collaboration"}
flowy-folder-data-model = { path = "../../../shared-lib/flowy-folder-data-model" }
flowy-folder-data-model = { path = "../../../shared-lib/flowy-folder-data-model"}
flowy-user-data-model = { path = "../../../shared-lib/flowy-user-data-model"}
flowy-folder = { path = "../flowy-folder" }
flowy-user = { path = "../flowy-user" }
@ -40,6 +40,14 @@ serde_json = "1.0"
[features]
http_server = []
dart = [
"lib-infra/dart",
"flowy-user/dart",
"flowy-collaboration/dart",
"flowy-error/dart",
"flowy-user-data-model/dart",
"flowy-folder-data-model/dart"
]
[build-dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["gen_pb"] }
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["pb_gen"] }

View File

@ -1,5 +1,5 @@
use lib_infra::pb;
use lib_infra::pb_gen;
fn main() {
pb::gen("flowy-net", "./src/protobuf/proto");
pb_gen::gen("flowy-net", "./src/protobuf/proto");
}

View File

@ -38,4 +38,5 @@ futures-util = "0.3.15"
[features]
http_server = ["flowy-user/http_server", "flowy-folder/http_server", "flowy-document/http_server"]
use_bunyan = ["lib-log/use_bunyan"]
use_bunyan = ["lib-log/use_bunyan"]
dart = ["flowy-user/dart", "flowy-net/dart", "flowy-folder/dart", "flowy-collaboration/dart"]

View File

@ -33,4 +33,7 @@ quickcheck_macros = "0.9.1"
fake = "~2.3.0"
claim = "0.4.0"
futures = "0.3.15"
serial_test = "0.5.1"
serial_test = "0.5.1"
[features]
dart = ["flowy-sdk/dart"]

View File

@ -45,6 +45,7 @@ serial_test = "0.5.1"
[features]
http_server = []
dart = ["lib-infra/dart"]
[build-dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["gen_pb"] }
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["pb_gen"] }

View File

@ -1,5 +1,5 @@
use lib_infra::pb;
use lib_infra::pb_gen;
fn main() {
pb::gen("flowy-user", "./src/protobuf/proto");
pb_gen::gen("flowy-user", "./src/protobuf/proto");
}