mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
rename flowy-sys to flowy-dispatch
This commit is contained in:
parent
717d53412b
commit
53a041b6cd
@ -5,8 +5,8 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-ast/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-ast/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-derive/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-derive/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-derive/tests" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-derive/tests" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-sys/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-dispatch/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-sys/tests" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-dispatch/tests" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/rust-lib/dart-ffi/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/dart-ffi/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-log/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-log/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-sdk/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-sdk/src" isTestSource="false" />
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/// Auto gen code from rust ast, do not edit
|
/// Auto gen code from rust ast, do not edit
|
||||||
part of 'dispatch.dart';
|
part of 'dispatch.dart';
|
||||||
|
|
||||||
class UserEventAuthCheck {
|
class UserEventAuthCheck {
|
||||||
UserSignInParams params;
|
UserSignInParams params;
|
||||||
UserEventAuthCheck(this.params);
|
UserEventAuthCheck(this.params);
|
||||||
@ -44,3 +45,4 @@ class UserEventSignIn {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
import 'package:flowy_logger/flowy_logger.dart';
|
|
||||||
import 'package:flowy_sdk/dispatch/flowy_error.dart';
|
|
||||||
import 'package:flowy_sdk/protobuf/ffi_response.pb.dart';
|
import 'package:flowy_sdk/protobuf/ffi_response.pb.dart';
|
||||||
import 'package:isolates/isolates.dart';
|
import 'package:isolates/isolates.dart';
|
||||||
import 'package:isolates/ports.dart';
|
import 'package:isolates/ports.dart';
|
||||||
@ -14,6 +12,8 @@ import 'package:flowy_sdk/ffi/ffi.dart' as ffi;
|
|||||||
import 'package:flowy_sdk/protobuf.dart';
|
import 'package:flowy_sdk/protobuf.dart';
|
||||||
import 'package:protobuf/protobuf.dart';
|
import 'package:protobuf/protobuf.dart';
|
||||||
|
|
||||||
|
import 'error.dart';
|
||||||
|
|
||||||
part 'code_gen.dart';
|
part 'code_gen.dart';
|
||||||
|
|
||||||
enum FFIException {
|
enum FFIException {
|
||||||
@ -98,29 +98,3 @@ Either<Uint8List, FlowyError> paramsToBytes<T extends GeneratedMessage>(
|
|||||||
return right(FlowyError.fromError('${e.runtimeType}. Stack trace: $s'));
|
return right(FlowyError.fromError('${e.runtimeType}. Stack trace: $s'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StackTraceError {
|
|
||||||
Object error;
|
|
||||||
StackTrace trace;
|
|
||||||
StackTraceError(
|
|
||||||
this.error,
|
|
||||||
this.trace,
|
|
||||||
);
|
|
||||||
|
|
||||||
FlowyError toFlowyError() {
|
|
||||||
Log.error('${error.runtimeType}\n');
|
|
||||||
Log.error('Stack trace \n $trace');
|
|
||||||
return FlowyError.fromError('${error.runtimeType}. Stack trace: $trace');
|
|
||||||
}
|
|
||||||
|
|
||||||
String toString() {
|
|
||||||
return '${error.runtimeType}. Stack trace: $trace';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FFIResponse error_response(FFIRequest request, StackTraceError error) {
|
|
||||||
var response = FFIResponse();
|
|
||||||
response.code = FFIStatusCode.Err;
|
|
||||||
response.error = error.toString();
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
import '../protobuf/ffi_response.pb.dart';
|
|
||||||
|
|
||||||
class FlowyError {
|
|
||||||
late FFIStatusCode _statusCode;
|
|
||||||
late String _error;
|
|
||||||
|
|
||||||
FFIStatusCode get statusCode {
|
|
||||||
return _statusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
String get error {
|
|
||||||
return _error;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get has_error {
|
|
||||||
return _statusCode != FFIStatusCode.Ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
String toString() {
|
|
||||||
return "$_statusCode: $_error";
|
|
||||||
}
|
|
||||||
|
|
||||||
FlowyError({required FFIStatusCode statusCode, required String error}) {
|
|
||||||
_statusCode = statusCode;
|
|
||||||
_error = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
factory FlowyError.from(FFIResponse resp) {
|
|
||||||
return FlowyError(statusCode: resp.code, error: resp.error);
|
|
||||||
}
|
|
||||||
|
|
||||||
factory FlowyError.fromError(String error) {
|
|
||||||
return FlowyError(statusCode: FFIStatusCode.Err, error: error);
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,9 +3,9 @@ export 'package:async/async.dart';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
import 'package:flowy_sdk/dispatch/flowy_error.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
|
import 'dispatch/error.dart';
|
||||||
import 'ffi/ffi.dart' as ffi;
|
import 'ffi/ffi.dart' as ffi;
|
||||||
import 'package:ffi/ffi.dart';
|
import 'package:ffi/ffi.dart';
|
||||||
|
|
||||||
|
@ -7,8 +7,12 @@
|
|||||||
|
|
||||||
## 🎯 Goals of the System
|
## 🎯 Goals of the System
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 🤔 Some Design Considerations
|
## 🤔 Some Design Considerations
|
||||||
|
|
||||||
## 📜 High Level Design
|
## 📜 High Level Design
|
||||||
|
|
||||||
## 📚 Component Design
|
## 📚 Component Design
|
||||||
|
|
||||||
### 📕 Component 1
|
### 📕 Component 1
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"flowy-sys",
|
"flowy-dispatch",
|
||||||
"flowy-sdk",
|
"flowy-sdk",
|
||||||
"dart-ffi",
|
"dart-ffi",
|
||||||
"flowy-log",
|
"flowy-log",
|
||||||
|
@ -25,7 +25,7 @@ log = "0.4.14"
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = {version = "1.0"}
|
serde_json = {version = "1.0"}
|
||||||
|
|
||||||
flowy-sys = {path = "../flowy-sys"}
|
flowy-dispatch = {path = "../flowy-dispatch"}
|
||||||
flowy-sdk = {path = "../flowy-sdk"}
|
flowy-sdk = {path = "../flowy-sdk"}
|
||||||
flowy-derive = {path = "../flowy-derive"}
|
flowy-derive = {path = "../flowy-derive"}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ use crate::{
|
|||||||
c::{extend_front_four_bytes_into_bytes, forget_rust},
|
c::{extend_front_four_bytes_into_bytes, forget_rust},
|
||||||
model::{FFIRequest, FFIResponse},
|
model::{FFIRequest, FFIResponse},
|
||||||
};
|
};
|
||||||
|
use flowy_dispatch::prelude::*;
|
||||||
use flowy_sdk::*;
|
use flowy_sdk::*;
|
||||||
use flowy_sys::prelude::*;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use std::{ffi::CStr, os::raw::c_char};
|
use std::{ffi::CStr, os::raw::c_char};
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ pub extern "C" fn sync_command(input: *const u8, len: usize) -> *const u8 {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn link_me_please() {}
|
pub extern "C" fn link_me_please() {}
|
||||||
|
|
||||||
use flowy_sys::prelude::ToBytes;
|
use flowy_dispatch::prelude::ToBytes;
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
async fn post_to_flutter(response: EventResponse, port: i64) {
|
async fn post_to_flutter(response: EventResponse, port: i64) {
|
||||||
let isolate = allo_isolate::Isolate::new(port);
|
let isolate = allo_isolate::Isolate::new(port);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use flowy_derive::ProtoBuf;
|
use flowy_derive::ProtoBuf;
|
||||||
use flowy_sys::prelude::ModuleRequest;
|
use flowy_dispatch::prelude::ModuleRequest;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
#[derive(Default, ProtoBuf)]
|
#[derive(Default, ProtoBuf)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||||
use flowy_sys::prelude::{EventResponse, Payload, StatusCode};
|
use flowy_dispatch::prelude::{EventResponse, Payload, StatusCode};
|
||||||
|
|
||||||
#[derive(ProtoBuf_Enum, Clone, Copy)]
|
#[derive(ProtoBuf_Enum, Clone, Copy)]
|
||||||
pub enum FFIStatusCode {
|
pub enum FFIStatusCode {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flowy-sys"
|
name = "flowy-dispatch"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
@ -28,7 +28,7 @@ impl EventDispatch {
|
|||||||
F: FnOnce() -> Vec<Module>,
|
F: FnOnce() -> Vec<Module>,
|
||||||
{
|
{
|
||||||
let modules = module_factory();
|
let modules = module_factory();
|
||||||
log::debug!("{}", module_info(&modules));
|
log::trace!("{}", module_info(&modules));
|
||||||
let module_map = as_module_map(modules);
|
let module_map = as_module_map(modules);
|
||||||
let runtime = tokio_default_runtime().unwrap();
|
let runtime = tokio_default_runtime().unwrap();
|
||||||
let dispatch = EventDispatch {
|
let dispatch = EventDispatch {
|
||||||
@ -50,11 +50,7 @@ impl EventDispatch {
|
|||||||
let dispatch = dispatch.as_ref().unwrap();
|
let dispatch = dispatch.as_ref().unwrap();
|
||||||
let module_map = dispatch.module_map.clone();
|
let module_map = dispatch.module_map.clone();
|
||||||
let service = Box::new(DispatchService { module_map });
|
let service = Box::new(DispatchService { module_map });
|
||||||
log::trace!(
|
log::trace!("Async event: {:?}", &request.event());
|
||||||
"{}: dispatch {:?} to runtime",
|
|
||||||
&request.id(),
|
|
||||||
&request.event()
|
|
||||||
);
|
|
||||||
let service_ctx = DispatchContext {
|
let service_ctx = DispatchContext {
|
||||||
request,
|
request,
|
||||||
callback: Some(Box::new(callback)),
|
callback: Some(Box::new(callback)),
|
||||||
@ -77,8 +73,8 @@ impl EventDispatch {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let msg = format!("Dispatch runtime error: {:?}", e);
|
let msg = format!("EVENT_DISPATCH read failed. {:?}", e);
|
||||||
log::trace!("{}", msg);
|
log::error!("{}", msg);
|
||||||
DispatchFuture {
|
DispatchFuture {
|
||||||
fut: Box::pin(async { InternalError::new(msg).as_response() }),
|
fut: Box::pin(async { InternalError::new(msg).as_response() }),
|
||||||
}
|
}
|
||||||
@ -88,11 +84,7 @@ impl EventDispatch {
|
|||||||
|
|
||||||
pub fn sync_send(request: ModuleRequest) -> EventResponse {
|
pub fn sync_send(request: ModuleRequest) -> EventResponse {
|
||||||
futures::executor::block_on(async {
|
futures::executor::block_on(async {
|
||||||
EventDispatch::async_send(request, |response| {
|
EventDispatch::async_send(request, |_| Box::pin(async {})).await
|
||||||
dbg!(&response);
|
|
||||||
Box::pin(async {})
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,20 +146,11 @@ impl Service<DispatchContext> for DispatchService {
|
|||||||
match module_map.get(&request.event()) {
|
match module_map.get(&request.event()) {
|
||||||
Some(module) => {
|
Some(module) => {
|
||||||
let fut = module.new_service(());
|
let fut = module.new_service(());
|
||||||
log::trace!(
|
|
||||||
"{}: handle event: {:?} by {}",
|
|
||||||
request.id(),
|
|
||||||
request.event(),
|
|
||||||
module.name
|
|
||||||
);
|
|
||||||
let service_fut = fut.await?.call(request);
|
let service_fut = fut.await?.call(request);
|
||||||
service_fut.await
|
service_fut.await
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
let msg = format!(
|
let msg = format!("Can not find the event handler. {:?}", request);
|
||||||
"Can not find the module to handle the request:{:?}",
|
|
||||||
request
|
|
||||||
);
|
|
||||||
log::trace!("{}", msg);
|
log::trace!("{}", msg);
|
||||||
Err(InternalError::new(msg).into())
|
Err(InternalError::new(msg).into())
|
||||||
},
|
},
|
@ -4,7 +4,6 @@ mod error;
|
|||||||
mod module;
|
mod module;
|
||||||
mod request;
|
mod request;
|
||||||
mod response;
|
mod response;
|
||||||
mod rt;
|
|
||||||
mod service;
|
mod service;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
@ -13,5 +12,5 @@ mod dispatch;
|
|||||||
mod system;
|
mod system;
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use crate::{data::*, dispatch::*, error::*, module::*, request::*, response::*, rt::*};
|
pub use crate::{data::*, dispatch::*, error::*, module::*, request::*, response::*};
|
||||||
}
|
}
|
@ -1,7 +1,4 @@
|
|||||||
use crate::{
|
use crate::module::{as_module_map, Module, ModuleMap};
|
||||||
module::{as_module_map, Module, ModuleMap},
|
|
||||||
rt::Runtime,
|
|
||||||
};
|
|
||||||
use futures_core::{ready, task::Context};
|
use futures_core::{ready, task::Context};
|
||||||
use std::{cell::RefCell, fmt::Debug, future::Future, io, sync::Arc};
|
use std::{cell::RefCell, fmt::Debug, future::Future, io, sync::Arc};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
@ -127,3 +124,37 @@ impl SystemRunner {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use crate::util::tokio_default_runtime;
|
||||||
|
use tokio::{runtime, task::LocalSet};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Runtime {
|
||||||
|
local: LocalSet,
|
||||||
|
rt: runtime::Runtime,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Runtime {
|
||||||
|
pub fn new() -> io::Result<Runtime> {
|
||||||
|
let rt = tokio_default_runtime()?;
|
||||||
|
Ok(Runtime {
|
||||||
|
rt,
|
||||||
|
local: LocalSet::new(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn spawn<F>(&self, future: F) -> &Self
|
||||||
|
where
|
||||||
|
F: Future<Output = ()> + 'static,
|
||||||
|
{
|
||||||
|
self.local.spawn_local(future);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn block_on<F>(&self, f: F) -> F::Output
|
||||||
|
where
|
||||||
|
F: Future + 'static,
|
||||||
|
{
|
||||||
|
self.local.block_on(&self.rt, f)
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,11 @@
|
|||||||
use flowy_sys::prelude::*;
|
use flowy_dispatch::prelude::*;
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn setup_env() {
|
pub fn setup_env() {
|
||||||
static INIT: Once = Once::new();
|
static INIT: Once = Once::new();
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
std::env::set_var("RUST_LOG", "flowy_sys=debug,debug");
|
std::env::set_var("RUST_LOG", "flowy_dispatch=debug,debug");
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
use crate::helper::*;
|
use crate::helper::*;
|
||||||
use flowy_sys::prelude::*;
|
use flowy_dispatch::prelude::*;
|
||||||
|
|
||||||
pub async fn hello() -> String { "say hello".to_string() }
|
pub async fn hello() -> String { "say hello".to_string() }
|
||||||
|
|
@ -6,7 +6,7 @@ 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]
|
||||||
flowy-sys = { path = "../flowy-sys", features = ["use_tracing"]}
|
flowy-dispatch = { path = "../flowy-dispatch", features = ["use_tracing"]}
|
||||||
flowy-log = { path = "../flowy-log", features = ["use_bunyan"] }
|
flowy-log = { path = "../flowy-log", features = ["use_bunyan"] }
|
||||||
flowy-user = { path = "../flowy-user" }
|
flowy-user = { path = "../flowy-user" }
|
||||||
tracing = { version = "0.1" }
|
tracing = { version = "0.1" }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
pub mod module;
|
pub mod module;
|
||||||
pub use module::*;
|
pub use module::*;
|
||||||
|
|
||||||
use flowy_sys::prelude::*;
|
use flowy_dispatch::prelude::*;
|
||||||
use module::build_modules;
|
use module::build_modules;
|
||||||
pub struct FlowySDK {}
|
pub struct FlowySDK {}
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
use flowy_sys::prelude::Module;
|
use flowy_dispatch::prelude::Module;
|
||||||
|
|
||||||
pub fn build_modules() -> Vec<Module> { vec![flowy_user::module::create()] }
|
pub fn build_modules() -> Vec<Module> { vec![flowy_user::module::create()] }
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
pub use runtime::*;
|
|
||||||
|
|
||||||
pub use crate::system::*;
|
|
||||||
pub mod runtime;
|
|
@ -1,34 +0,0 @@
|
|||||||
use crate::util::tokio_default_runtime;
|
|
||||||
use std::{future::Future, io};
|
|
||||||
use tokio::{runtime, task::LocalSet};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct Runtime {
|
|
||||||
local: LocalSet,
|
|
||||||
rt: runtime::Runtime,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Runtime {
|
|
||||||
pub fn new() -> io::Result<Runtime> {
|
|
||||||
let rt = tokio_default_runtime()?;
|
|
||||||
Ok(Runtime {
|
|
||||||
rt,
|
|
||||||
local: LocalSet::new(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn spawn<F>(&self, future: F) -> &Self
|
|
||||||
where
|
|
||||||
F: Future<Output = ()> + 'static,
|
|
||||||
{
|
|
||||||
self.local.spawn_local(future);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn block_on<F>(&self, f: F) -> F::Output
|
|
||||||
where
|
|
||||||
F: Future + 'static,
|
|
||||||
{
|
|
||||||
self.local.block_on(&self.rt, f)
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,7 +7,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
flowy-sdk = { path = "../flowy-sdk"}
|
flowy-sdk = { path = "../flowy-sdk"}
|
||||||
flowy-sys = { path = "../flowy-sys"}
|
flowy-dispatch = { path = "../flowy-dispatch"}
|
||||||
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
bincode = { version = "1.3"}
|
bincode = { version = "1.3"}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
use flowy_dispatch::prelude::*;
|
||||||
pub use flowy_sdk::*;
|
pub use flowy_sdk::*;
|
||||||
use flowy_sys::prelude::*;
|
|
||||||
use std::{
|
use std::{
|
||||||
convert::TryFrom,
|
convert::TryFrom,
|
||||||
fmt::{Debug, Display},
|
fmt::{Debug, Display},
|
||||||
@ -11,7 +11,7 @@ use std::{
|
|||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use crate::EventTester;
|
pub use crate::EventTester;
|
||||||
pub use flowy_sys::prelude::*;
|
pub use flowy_dispatch::prelude::*;
|
||||||
pub use std::convert::TryFrom;
|
pub use std::convert::TryFrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
derive_more = {version = "0.99", features = ["display"]}
|
derive_more = {version = "0.99", features = ["display"]}
|
||||||
flowy-sys = { path = "../flowy-sys" }
|
flowy-dispatch = { path = "../flowy-dispatch" }
|
||||||
flowy-log = { path = "../flowy-log" }
|
flowy-log = { path = "../flowy-log" }
|
||||||
flowy-derive = { path = "../flowy-derive" }
|
flowy-derive = { path = "../flowy-derive" }
|
||||||
tracing = { version = "0.1", features = ["log"] }
|
tracing = { version = "0.1", features = ["log"] }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::domain::user::*;
|
use crate::domain::user::*;
|
||||||
use flowy_sys::prelude::*;
|
use flowy_dispatch::prelude::*;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html
|
// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{domain::event::UserEvent, handlers::*};
|
use crate::{domain::event::UserEvent, handlers::*};
|
||||||
use flowy_sys::prelude::*;
|
use flowy_dispatch::prelude::*;
|
||||||
|
|
||||||
pub fn create() -> Module {
|
pub fn create() -> Module {
|
||||||
Module::new()
|
Module::new()
|
||||||
|
@ -16,7 +16,6 @@ condition = { env_true = ["RELEASE"] }
|
|||||||
env = { DESKTOP_TARGET = "x86_64-apple-darwin" }
|
env = { DESKTOP_TARGET = "x86_64-apple-darwin" }
|
||||||
private = true
|
private = true
|
||||||
run_task = "desktop-build"
|
run_task = "desktop-build"
|
||||||
|
|
||||||
[tasks.desktop-build]
|
[tasks.desktop-build]
|
||||||
category = "Build"
|
category = "Build"
|
||||||
condition = { platforms = ["mac"], env_true = ["DEV"] }
|
condition = { platforms = ["mac"], env_true = ["DEV"] }
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
[tasks.rust_env_setup]
|
|
||||||
dependencies = ["rustup", "add_targets", "rust_tools"]
|
|
||||||
description = "Setup the rust env"
|
|
||||||
|
|
||||||
[tasks.rustup]
|
|
||||||
script = [
|
|
||||||
"""
|
|
||||||
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
|
|
||||||
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
|
|
||||||
echo 'export PATH="$$HOME/.cargo/bin:$$PATH"' >> ~/.bash_profile
|
|
||||||
source ~/.bash_profile
|
|
||||||
""",
|
|
||||||
]
|
|
||||||
script_runner = "@shell"
|
|
||||||
|
|
||||||
[tasks.add_compile_targets]
|
|
||||||
script = [
|
|
||||||
"""
|
|
||||||
rustup target add aarch64-linux-android
|
|
||||||
rustup target add arm-linux-androideabi
|
|
||||||
rustup target add armv7-linux-androideabi
|
|
||||||
rustup target add i686-linux-android
|
|
||||||
rustup target add aarch64-apple-ios
|
|
||||||
rustup target add x86_64-apple-ios
|
|
||||||
rustup target add x86_64-apple-darwin
|
|
||||||
""",
|
|
||||||
]
|
|
||||||
script_runner = "@shell"
|
|
||||||
|
|
||||||
[tasks.rust_tools]
|
|
||||||
script = [
|
|
||||||
"""
|
|
||||||
# cargo install clog-cli --force
|
|
||||||
# cargo install cargo-cache
|
|
||||||
rustup component add rustfmt
|
|
||||||
cargo install ripgrep
|
|
||||||
cargo install rusty-hook
|
|
||||||
cargo install cargo-expand
|
|
||||||
""",
|
|
||||||
]
|
|
||||||
script_runner = "@shell"
|
|
||||||
|
|
||||||
[tasks.fmt]
|
|
||||||
args = ["fmt", "--", "--emit=files"]
|
|
||||||
command = "cargo"
|
|
||||||
install_crate = "rustfmt"
|
|
||||||
[tasks.rust_commit_hook]
|
|
||||||
script = [
|
|
||||||
"""
|
|
||||||
manifest_path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/tool/rust-tool/Cargo.toml
|
|
||||||
cargo run --manifest-path ${manifest_path} hook --commit --path=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/rust-lib
|
|
||||||
""",
|
|
||||||
]
|
|
||||||
script_runner = "@shell"
|
|
||||||
|
|
||||||
[tasks.reset_db]
|
|
||||||
script = [
|
|
||||||
"""
|
|
||||||
tool=${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/tool/rust-tool/Cargo.toml
|
|
||||||
cargo run --manifest-path ${tool} db --reset
|
|
||||||
""",
|
|
||||||
]
|
|
||||||
script_runner = "@shell"
|
|
||||||
|
|
||||||
[tasks.plantuml]
|
|
||||||
script = ["""
|
|
||||||
brew cask install java
|
|
||||||
brew install graphviz
|
|
||||||
"""]
|
|
||||||
script_runner = "@shell"
|
|
||||||
|
|
||||||
# For the system Java wrappers to find this JDK, symlink it with
|
|
||||||
# sudo ln -sfn /Users/weidongfu/Documents/tools/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
|
|
||||||
# This is a beta version of openjdk for Apple Silicon
|
|
||||||
# (openjdk 16 preview).
|
|
||||||
|
|
||||||
# openjdk is keg-only, which means it was not symlinked into /Users/weidongfu/Documents/tools/homebrew,
|
|
||||||
# because it shadows the macOS `java` wrapper.
|
|
||||||
|
|
||||||
# If you need to have openjdk first in your PATH run:
|
|
||||||
# echo 'export PATH="/Users/weidongfu/Documents/tools/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc
|
|
Loading…
Reference in New Issue
Block a user