mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
config sdk log
This commit is contained in:
parent
7a38114ba0
commit
317cbb37b6
12
app_flowy/.vscode/tasks.json
vendored
12
app_flowy/.vscode/tasks.json
vendored
@ -22,17 +22,5 @@
|
||||
// ],
|
||||
"label": "build_flowy_sdk"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"command": "sh ./scripts/code_gen.sh",
|
||||
"group": "build",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$rustc"
|
||||
],
|
||||
"label": "generate events"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import 'package:app_flowy/workspace/domain/i_app.dart';
|
||||
import 'package:flowy_infra/flowy_logger.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
@ -30,7 +31,10 @@ class AppBloc extends Bloc<AppEvent, AppState> {
|
||||
final viewsOrFailed = await iAppImpl.getViews();
|
||||
yield viewsOrFailed.fold(
|
||||
(apps) => state.copyWith(views: apps),
|
||||
(error) => state.copyWith(successOrFailure: right(error)),
|
||||
(error) {
|
||||
Log.error(error);
|
||||
return state.copyWith(successOrFailure: right(error));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'package:app_flowy/workspace/domain/i_workspace.dart';
|
||||
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flowy_infra/flowy_logger.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -11,8 +12,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
part 'menu_bloc.freezed.dart';
|
||||
|
||||
class MenuBloc extends Bloc<MenuEvent, MenuState> {
|
||||
final IWorkspace iWorkspaceImpl;
|
||||
MenuBloc(this.iWorkspaceImpl) : super(MenuState.initial());
|
||||
final IWorkspace workspace;
|
||||
MenuBloc(this.workspace) : super(MenuState.initial());
|
||||
|
||||
@override
|
||||
Stream<MenuState> mapEventToState(
|
||||
@ -40,21 +41,25 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> {
|
||||
}
|
||||
|
||||
Stream<MenuState> _performActionOnCreateApp(CreateApp event) async* {
|
||||
iWorkspaceImpl.createApp(name: event.name, desc: event.desc).then((result) {
|
||||
result.fold(
|
||||
(app) => {},
|
||||
(error) async* {
|
||||
yield state.copyWith(successOrFailure: right(error));
|
||||
},
|
||||
);
|
||||
});
|
||||
final result =
|
||||
await workspace.createApp(name: event.name, desc: event.desc);
|
||||
yield result.fold(
|
||||
(app) => state.copyWith(apps: some([app])),
|
||||
(error) {
|
||||
Log.error(error);
|
||||
return state.copyWith(successOrFailure: right(error));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Stream<MenuState> _fetchApps() async* {
|
||||
final appsOrFail = await iWorkspaceImpl.getApps();
|
||||
final appsOrFail = await workspace.getApps();
|
||||
yield appsOrFail.fold(
|
||||
(apps) => state.copyWith(apps: some(apps)),
|
||||
(error) => state.copyWith(successOrFailure: right(error)),
|
||||
(error) {
|
||||
Log.error(error);
|
||||
return state.copyWith(successOrFailure: right(error));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:app_flowy/workspace/domain/i_workspace.dart';
|
||||
import 'package:flowy_infra/flowy_logger.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -38,7 +39,10 @@ class MenuWatchBloc extends Bloc<MenuWatchEvent, MenuWatchState> {
|
||||
void _handleAppsOrFail(Either<List<App>, WorkspaceError> appsOrFail) {
|
||||
appsOrFail.fold(
|
||||
(apps) => add(MenuWatchEvent.appsReceived(left(apps))),
|
||||
(error) => add(MenuWatchEvent.appsReceived(right(error))),
|
||||
(error) {
|
||||
Log.error(error);
|
||||
add(MenuWatchEvent.appsReceived(right(error)));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
||||
import 'package:flowy_infra/flowy_logger.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/workspace_create.pb.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
@ -31,7 +32,10 @@ class WorkspaceListBloc extends Bloc<WorkspaceListEvent, WorkspaceListState> {
|
||||
yield workspacesOrFailed.fold(
|
||||
(workspaces) =>
|
||||
state.copyWith(workspaces: workspaces, successOrFailure: left(unit)),
|
||||
(error) => state.copyWith(successOrFailure: right(error)),
|
||||
(error) {
|
||||
Log.error(error);
|
||||
return state.copyWith(successOrFailure: right(error));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -39,7 +43,10 @@ class WorkspaceListBloc extends Bloc<WorkspaceListEvent, WorkspaceListState> {
|
||||
final result = await repo.openWorkspace(workspace.id);
|
||||
yield result.fold(
|
||||
(workspaces) => state.copyWith(successOrFailure: left(unit)),
|
||||
(error) => state.copyWith(successOrFailure: right(error)),
|
||||
(error) {
|
||||
Log.error(error);
|
||||
return state.copyWith(successOrFailure: right(error));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -50,7 +57,10 @@ class WorkspaceListBloc extends Bloc<WorkspaceListEvent, WorkspaceListState> {
|
||||
add(const WorkspaceListEvent.fetchWorkspaces());
|
||||
return state.copyWith(successOrFailure: left(unit));
|
||||
},
|
||||
(error) => state.copyWith(successOrFailure: right(error)),
|
||||
(error) {
|
||||
Log.error(error);
|
||||
return state.copyWith(successOrFailure: right(error));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,6 @@
|
||||
7D41C30A3910C3A40B6085E3 /* Pods-Runner.release.xcconfig */,
|
||||
1823EB6E74189944EAA69652 /* Pods-Runner.profile.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@ -427,6 +426,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
STRIP_STYLE = "non-global";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Profile;
|
||||
@ -553,6 +553,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
STRIP_STYLE = "non-global";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@ -573,6 +574,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
STRIP_STYLE = "non-global";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2,6 +2,11 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
@ -35,5 +35,6 @@ flowy-observable = {path = "../flowy-observable"}
|
||||
|
||||
[features]
|
||||
observable = ["flowy-observable/dart"]
|
||||
http_server = ["flowy-sdk/http_server", "flowy-sdk/use_bunyan"]
|
||||
#use_serde = ["bincode"]
|
||||
#use_protobuf= ["protobuf"]
|
@ -23,8 +23,9 @@ fn dispatch() -> Arc<EventDispatch> { FLOWY_SDK.read().as_ref().unwrap().dispatc
|
||||
pub extern "C" fn init_sdk(path: *mut c_char) -> i64 {
|
||||
let c_str: &CStr = unsafe { CStr::from_ptr(path) };
|
||||
let path: &str = c_str.to_str().unwrap();
|
||||
log::info!("🔥 FlowySDK start running");
|
||||
*FLOWY_SDK.write() = Some(Arc::new(FlowySDK::new(path)));
|
||||
|
||||
let config = FlowySDKConfig::new(path).log_filter("info");
|
||||
*FLOWY_SDK.write() = Some(Arc::new(FlowySDK::new(config)));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ impl EventResponse {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn is_success(&self) -> bool { self.status_code == StatusCode::Ok }
|
||||
}
|
||||
|
||||
impl std::fmt::Display for EventResponse {
|
||||
|
@ -8,7 +8,6 @@ edition = "2018"
|
||||
[dependencies]
|
||||
flowy-dispatch = { path = "../flowy-dispatch", features = ["use_tracing"]}
|
||||
flowy-log = { path = "../flowy-log" }
|
||||
#flowy-log = { path = "../flowy-log", features = ["use_bunyan"] }
|
||||
flowy-user = { path = "../flowy-user" }
|
||||
flowy-infra = { path = "../flowy-infra" }
|
||||
flowy-workspace = { path = "../flowy-workspace" }
|
||||
@ -25,4 +24,8 @@ bincode = { version = "1.3"}
|
||||
protobuf = {version = "2.24.1"}
|
||||
claim = "0.5.0"
|
||||
tokio = { version = "1", features = ["full"]}
|
||||
futures-util = "0.3.15"
|
||||
futures-util = "0.3.15"
|
||||
|
||||
[features]
|
||||
http_server = ["flowy-user/http_server", "flowy-workspace/http_server"]
|
||||
use_bunyan = ["flowy-log/use_bunyan"]
|
@ -13,7 +13,7 @@ pub struct EditorDatabaseImpl {
|
||||
impl DocumentDatabase for EditorDatabaseImpl {
|
||||
fn db_connection(&self) -> Result<DBConnection, DocError> {
|
||||
self.user_session
|
||||
.db()
|
||||
.db_conn()
|
||||
.map_err(|e| ErrorBuilder::new(DocErrorCode::EditorDBConnFailed).error(e).build())
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ pub struct WorkspaceDatabaseImpl {
|
||||
impl WorkspaceDatabase for WorkspaceDatabaseImpl {
|
||||
fn db_connection(&self) -> Result<DBConnection, WorkspaceError> {
|
||||
self.user_session
|
||||
.db()
|
||||
.db_conn()
|
||||
.map_err(|e| ErrorBuilder::new(ErrorCode::DatabaseConnectionFail).error(e).build())
|
||||
}
|
||||
}
|
||||
|
@ -11,21 +11,42 @@ use std::sync::{
|
||||
};
|
||||
|
||||
static INIT_LOG: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FlowySDKConfig {
|
||||
root: String,
|
||||
log_filter: String,
|
||||
}
|
||||
|
||||
impl FlowySDKConfig {
|
||||
pub fn new(root: &str) -> Self {
|
||||
FlowySDKConfig {
|
||||
root: root.to_owned(),
|
||||
log_filter: std::env::var("RUST_LOG").unwrap_or("info".to_owned()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_filter(mut self, filter: &str) -> Self {
|
||||
self.log_filter = filter.to_owned();
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FlowySDK {
|
||||
root: String,
|
||||
config: FlowySDKConfig,
|
||||
dispatch: Arc<EventDispatch>,
|
||||
}
|
||||
|
||||
impl FlowySDK {
|
||||
pub fn new(root: &str) -> Self {
|
||||
init_log(root);
|
||||
init_kv(root);
|
||||
pub fn new(config: FlowySDKConfig) -> Self {
|
||||
init_log(&config);
|
||||
init_kv(&config.root);
|
||||
|
||||
tracing::info!("🔥 user folder: {}", root);
|
||||
let dispatch = Arc::new(init_dispatch(root));
|
||||
let root = root.to_owned();
|
||||
Self { root, dispatch }
|
||||
tracing::debug!("🔥 {:?}", config);
|
||||
let dispatch = Arc::new(init_dispatch(&config.root));
|
||||
|
||||
Self { config, dispatch }
|
||||
}
|
||||
|
||||
pub fn dispatch(&self) -> Arc<EventDispatch> { self.dispatch.clone() }
|
||||
@ -38,11 +59,14 @@ fn init_kv(root: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
fn init_log(directory: &str) {
|
||||
fn init_log(config: &FlowySDKConfig) {
|
||||
if !INIT_LOG.load(Ordering::SeqCst) {
|
||||
INIT_LOG.store(true, Ordering::SeqCst);
|
||||
|
||||
let _ = flowy_log::Builder::new("flowy").local(directory).env_filter("info").build();
|
||||
let _ = flowy_log::Builder::new("flowy")
|
||||
.local(&config.root)
|
||||
.env_filter(&config.log_filter)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ pub mod builder;
|
||||
mod helper;
|
||||
|
||||
use crate::helper::*;
|
||||
use flowy_sdk::FlowySDK;
|
||||
use flowy_sdk::{FlowySDK, FlowySDKConfig};
|
||||
use flowy_user::entities::UserProfile;
|
||||
|
||||
pub mod prelude {
|
||||
@ -35,6 +35,6 @@ impl FlowyEnv {
|
||||
}
|
||||
|
||||
pub fn init_test_sdk() -> FlowyTestSDK {
|
||||
let root_dir = root_dir();
|
||||
FlowySDK::new(&root_dir)
|
||||
let config = FlowySDKConfig::new(&root_dir()).log_filter("debug");
|
||||
FlowySDK::new(config)
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
use std::future::Future;
|
||||
|
||||
pub fn spawn<F>(f: F)
|
||||
pub async fn spawn<F>(f: F)
|
||||
where
|
||||
F: Future + Send + 'static,
|
||||
F::Output: Send + 'static,
|
||||
{
|
||||
tokio::spawn(f);
|
||||
match tokio::spawn(f).await {
|
||||
Ok(_) => {},
|
||||
Err(e) => log::error!("{:?}", e),
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ impl UserSession {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn db(&self) -> Result<DBConnection, UserError> {
|
||||
pub fn db_conn(&self) -> Result<DBConnection, UserError> {
|
||||
let user_id = self.get_session()?.user_id;
|
||||
self.database.get_connection(&user_id)
|
||||
}
|
||||
@ -98,7 +98,7 @@ impl UserSession {
|
||||
|
||||
pub async fn sign_out(&self) -> Result<(), UserError> {
|
||||
let session = self.get_session()?;
|
||||
let _ = diesel::delete(dsl::user_table.filter(dsl::id.eq(&session.user_id))).execute(&*(self.db()?))?;
|
||||
let _ = diesel::delete(dsl::user_table.filter(dsl::id.eq(&session.user_id))).execute(&*(self.db_conn()?))?;
|
||||
let _ = self.database.close_user_db(&session.user_id)?;
|
||||
let _ = self.set_session(None)?;
|
||||
let _ = self.sign_out_on_server(&session.token).await?;
|
||||
@ -109,7 +109,7 @@ impl UserSession {
|
||||
pub async fn update_user(&self, params: UpdateUserParams) -> Result<(), UserError> {
|
||||
let session = self.get_session()?;
|
||||
let changeset = UserTableChangeset::new(params.clone());
|
||||
diesel_update_table!(user_table, changeset, self.db()?);
|
||||
diesel_update_table!(user_table, changeset, self.db_conn()?);
|
||||
|
||||
let _ = self.update_user_on_server(&session.token, params).await?;
|
||||
Ok(())
|
||||
@ -120,7 +120,7 @@ impl UserSession {
|
||||
let token = session.token;
|
||||
let user = dsl::user_table
|
||||
.filter(user_table::id.eq(&session.user_id))
|
||||
.first::<UserTable>(&*(self.db()?))?;
|
||||
.first::<UserTable>(&*(self.db_conn()?))?;
|
||||
|
||||
let _ = self.read_user_profile_on_server(&token).await?;
|
||||
Ok(UserProfile::from(user))
|
||||
@ -140,7 +140,7 @@ impl UserSession {
|
||||
async fn read_user_profile_on_server(&self, token: &str) -> Result<(), UserError> {
|
||||
let server = self.server.clone();
|
||||
let token = token.to_owned();
|
||||
spawn(async move {
|
||||
let _ = spawn(async move {
|
||||
match server.get_user(&token).await {
|
||||
Ok(profile) => {
|
||||
//
|
||||
@ -158,7 +158,7 @@ impl UserSession {
|
||||
async fn update_user_on_server(&self, token: &str, params: UpdateUserParams) -> Result<(), UserError> {
|
||||
let server = self.server.clone();
|
||||
let token = token.to_owned();
|
||||
spawn(async move {
|
||||
let _ = spawn(async move {
|
||||
match server.update_user(&token, params).await {
|
||||
Ok(_) => {},
|
||||
Err(e) => {
|
||||
@ -166,26 +166,27 @@ impl UserSession {
|
||||
log::error!("update user profile failed: {:?}", e);
|
||||
},
|
||||
}
|
||||
});
|
||||
})
|
||||
.await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn sign_out_on_server(&self, token: &str) -> Result<(), UserError> {
|
||||
let server = self.server.clone();
|
||||
let token = token.to_owned();
|
||||
spawn(async move {
|
||||
let _ = spawn(async move {
|
||||
match server.sign_out(&token).await {
|
||||
Ok(_) => {},
|
||||
Err(e) => log::error!("Sign out failed: {:?}", e),
|
||||
}
|
||||
});
|
||||
})
|
||||
.await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn save_user(&self, user: UserTable) -> Result<UserTable, UserError> {
|
||||
let conn = self.db()?;
|
||||
let conn = self.db_conn()?;
|
||||
let _ = diesel::insert_into(user_table::table).values(user.clone()).execute(&*conn)?;
|
||||
|
||||
Ok(user)
|
||||
}
|
||||
|
||||
@ -233,7 +234,7 @@ pub async fn update_user(_server: Server, pool: Arc<ConnectionPool>, params: Upd
|
||||
}
|
||||
|
||||
impl UserDatabaseConnection for UserSession {
|
||||
fn get_connection(&self) -> Result<DBConnection, String> { self.db().map_err(|e| format!("{:?}", e)) }
|
||||
fn get_connection(&self) -> Result<DBConnection, String> { self.db_conn().map_err(|e| format!("{:?}", e)) }
|
||||
}
|
||||
|
||||
const SESSION_CACHE_KEY: &str = "session_cache_key";
|
||||
|
@ -32,7 +32,7 @@ pub struct ColorStyle {
|
||||
pub theme_color: String,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default)]
|
||||
#[derive(ProtoBuf, Default, Debug)]
|
||||
pub struct CreateAppParams {
|
||||
#[pb(index = 1)]
|
||||
pub workspace_id: String,
|
||||
|
@ -34,7 +34,7 @@ impl QueryAppRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone)]
|
||||
#[derive(ProtoBuf, Default, Clone, Debug)]
|
||||
pub struct QueryAppParams {
|
||||
#[pb(index = 1)]
|
||||
pub app_id: String,
|
||||
|
@ -26,7 +26,7 @@ pub struct UpdateAppRequest {
|
||||
pub is_trash: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone)]
|
||||
#[derive(ProtoBuf, Default, Clone, Debug)]
|
||||
pub struct UpdateAppParams {
|
||||
#[pb(index = 1)]
|
||||
pub app_id: String,
|
||||
|
@ -47,7 +47,7 @@ pub struct CreateViewRequest {
|
||||
pub view_type: ViewType,
|
||||
}
|
||||
|
||||
#[derive(Default, ProtoBuf)]
|
||||
#[derive(Default, ProtoBuf, Debug)]
|
||||
pub struct CreateViewParams {
|
||||
#[pb(index = 1)]
|
||||
pub belong_to_id: String,
|
||||
|
@ -32,7 +32,7 @@ impl QueryViewRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, ProtoBuf, Clone)]
|
||||
#[derive(Default, ProtoBuf, Clone, Debug)]
|
||||
pub struct QueryViewParams {
|
||||
#[pb(index = 1)]
|
||||
pub view_id: String,
|
||||
|
@ -23,7 +23,7 @@ pub struct UpdateViewRequest {
|
||||
pub is_trash: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Default, ProtoBuf, Clone)]
|
||||
#[derive(Default, ProtoBuf, Clone, Debug)]
|
||||
pub struct UpdateViewParams {
|
||||
#[pb(index = 1)]
|
||||
pub view_id: String,
|
||||
|
@ -15,7 +15,7 @@ pub struct CreateWorkspaceRequest {
|
||||
pub desc: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, ProtoBuf, Default)]
|
||||
#[derive(Clone, ProtoBuf, Default, Debug)]
|
||||
pub struct CreateWorkspaceParams {
|
||||
#[pb(index = 1)]
|
||||
pub name: String,
|
||||
|
@ -19,7 +19,7 @@ impl QueryWorkspaceRequest {
|
||||
}
|
||||
|
||||
// Read all workspaces if the workspace_id is None
|
||||
#[derive(Clone, ProtoBuf, Default)]
|
||||
#[derive(Clone, ProtoBuf, Default, Debug)]
|
||||
pub struct QueryWorkspaceParams {
|
||||
#[pb(index = 1, one_of)]
|
||||
pub workspace_id: Option<String>,
|
||||
|
@ -16,7 +16,7 @@ pub struct UpdateWorkspaceRequest {
|
||||
desc: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, ProtoBuf, Default)]
|
||||
#[derive(Clone, ProtoBuf, Default, Debug)]
|
||||
pub struct UpdateWorkspaceParams {
|
||||
#[pb(index = 1)]
|
||||
pub id: String,
|
||||
|
@ -3,7 +3,7 @@ use derive_more::Display;
|
||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||
use flowy_dispatch::prelude::{EventResponse, ResponseBuilder};
|
||||
use flowy_net::errors::ErrorCode as NetworkErrorCode;
|
||||
use std::convert::TryInto;
|
||||
use std::{convert::TryInto, fmt};
|
||||
|
||||
#[derive(Debug, Default, Clone, ProtoBuf)]
|
||||
pub struct WorkspaceError {
|
||||
@ -15,12 +15,7 @@ pub struct WorkspaceError {
|
||||
}
|
||||
|
||||
impl WorkspaceError {
|
||||
pub fn new(code: ErrorCode, msg: &str) -> Self {
|
||||
Self {
|
||||
code,
|
||||
msg: msg.to_owned(),
|
||||
}
|
||||
}
|
||||
pub fn new(code: ErrorCode, msg: &str) -> Self { Self { code, msg: msg.to_owned() } }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, ProtoBuf_Enum, Display, PartialEq, Eq)]
|
||||
@ -89,23 +84,15 @@ impl std::default::Default for ErrorCode {
|
||||
impl std::convert::From<flowy_net::errors::ServerError> for WorkspaceError {
|
||||
fn from(error: flowy_net::errors::ServerError) -> Self {
|
||||
match error.code {
|
||||
NetworkErrorCode::RecordNotFound => ErrorBuilder::new(ErrorCode::RecordNotFound)
|
||||
.error(error.msg)
|
||||
.build(),
|
||||
NetworkErrorCode::RecordNotFound => ErrorBuilder::new(ErrorCode::RecordNotFound).error(error.msg).build(),
|
||||
|
||||
_ => ErrorBuilder::new(ErrorCode::ServerError)
|
||||
.error(error.msg)
|
||||
.build(),
|
||||
_ => ErrorBuilder::new(ErrorCode::ServerError).error(error.msg).build(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<flowy_database::result::Error> for WorkspaceError {
|
||||
fn from(error: flowy_database::result::Error) -> Self {
|
||||
ErrorBuilder::new(ErrorCode::WorkspaceDatabaseError)
|
||||
.error(error)
|
||||
.build()
|
||||
}
|
||||
fn from(error: flowy_database::result::Error) -> Self { ErrorBuilder::new(ErrorCode::WorkspaceDatabaseError).error(error).build() }
|
||||
}
|
||||
|
||||
impl flowy_dispatch::Error for WorkspaceError {
|
||||
@ -115,6 +102,10 @@ impl flowy_dispatch::Error for WorkspaceError {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for WorkspaceError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}: {}", &self.code, &self.msg) }
|
||||
}
|
||||
|
||||
pub type ErrorBuilder = flowy_infra::errors::Builder<ErrorCode, WorkspaceError>;
|
||||
|
||||
impl flowy_infra::errors::Build<ErrorCode> for WorkspaceError {
|
||||
|
@ -19,29 +19,33 @@ use crate::{
|
||||
use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
|
||||
use std::{convert::TryInto, sync::Arc};
|
||||
|
||||
#[tracing::instrument(name = "create_app", skip(data, controller))]
|
||||
pub(crate) async fn create_app(data: Data<CreateAppRequest>, controller: Unit<Arc<AppController>>) -> DataResult<App, WorkspaceError> {
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
pub(crate) async fn create_app_handler(
|
||||
data: Data<CreateAppRequest>,
|
||||
controller: Unit<Arc<AppController>>,
|
||||
) -> DataResult<App, WorkspaceError> {
|
||||
let params: CreateAppParams = data.into_inner().try_into()?;
|
||||
let detail = controller.create_app(params).await?;
|
||||
|
||||
data_result(detail)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "delete_app", skip(data, controller))]
|
||||
pub(crate) async fn delete_app(data: Data<DeleteAppRequest>, controller: Unit<Arc<AppController>>) -> Result<(), WorkspaceError> {
|
||||
#[tracing::instrument(skip(data, controller))]
|
||||
pub(crate) async fn delete_app_handler(data: Data<DeleteAppRequest>, controller: Unit<Arc<AppController>>) -> Result<(), WorkspaceError> {
|
||||
let params: DeleteAppParams = data.into_inner().try_into()?;
|
||||
let _ = controller.delete_app(¶ms.app_id).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "update_app", skip(data, controller))]
|
||||
pub(crate) async fn update_app(data: Data<UpdateAppRequest>, controller: Unit<Arc<AppController>>) -> Result<(), WorkspaceError> {
|
||||
#[tracing::instrument(skip(data, controller))]
|
||||
pub(crate) async fn update_app_handler(data: Data<UpdateAppRequest>, controller: Unit<Arc<AppController>>) -> Result<(), WorkspaceError> {
|
||||
let params: UpdateAppParams = data.into_inner().try_into()?;
|
||||
let _ = controller.update_app(params).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "read_app", skip(data, app_controller, view_controller))]
|
||||
pub(crate) async fn read_app(
|
||||
#[tracing::instrument(skip(data, app_controller, view_controller))]
|
||||
pub(crate) async fn read_app_handler(
|
||||
data: Data<QueryAppRequest>,
|
||||
app_controller: Unit<Arc<AppController>>,
|
||||
view_controller: Unit<Arc<ViewController>>,
|
||||
|
@ -17,15 +17,21 @@ use crate::{
|
||||
use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
|
||||
use std::{convert::TryInto, sync::Arc};
|
||||
|
||||
#[tracing::instrument(name = "create_view", skip(data, controller))]
|
||||
pub(crate) async fn create_view(data: Data<CreateViewRequest>, controller: Unit<Arc<ViewController>>) -> DataResult<View, WorkspaceError> {
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
pub(crate) async fn create_view_handler(
|
||||
data: Data<CreateViewRequest>,
|
||||
controller: Unit<Arc<ViewController>>,
|
||||
) -> DataResult<View, WorkspaceError> {
|
||||
let params: CreateViewParams = data.into_inner().try_into()?;
|
||||
let view = controller.create_view(params).await?;
|
||||
data_result(view)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "read_view", skip(data, controller))]
|
||||
pub(crate) async fn read_view(data: Data<QueryViewRequest>, controller: Unit<Arc<ViewController>>) -> DataResult<View, WorkspaceError> {
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
pub(crate) async fn read_view_handler(
|
||||
data: Data<QueryViewRequest>,
|
||||
controller: Unit<Arc<ViewController>>,
|
||||
) -> DataResult<View, WorkspaceError> {
|
||||
let params: QueryViewParams = data.into_inner().try_into()?;
|
||||
let mut view = controller.read_view(params.clone()).await?;
|
||||
|
||||
@ -37,16 +43,22 @@ pub(crate) async fn read_view(data: Data<QueryViewRequest>, controller: Unit<Arc
|
||||
data_result(view)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "update_view", skip(data, controller))]
|
||||
pub(crate) async fn update_view(data: Data<UpdateViewRequest>, controller: Unit<Arc<ViewController>>) -> Result<(), WorkspaceError> {
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
pub(crate) async fn update_view_handler(
|
||||
data: Data<UpdateViewRequest>,
|
||||
controller: Unit<Arc<ViewController>>,
|
||||
) -> Result<(), WorkspaceError> {
|
||||
let params: UpdateViewParams = data.into_inner().try_into()?;
|
||||
let _ = controller.update_view(params).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "delete_view", skip(data, controller))]
|
||||
pub(crate) async fn delete_view(data: Data<DeleteViewRequest>, controller: Unit<Arc<ViewController>>) -> Result<(), WorkspaceError> {
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
pub(crate) async fn delete_view_handler(
|
||||
data: Data<DeleteViewRequest>,
|
||||
controller: Unit<Arc<ViewController>>,
|
||||
) -> Result<(), WorkspaceError> {
|
||||
let params: DeleteViewParams = data.into_inner().try_into()?;
|
||||
let _ = controller.delete_view(¶ms.view_id).await?;
|
||||
Ok(())
|
||||
|
@ -2,8 +2,8 @@ use crate::{entities::workspace::*, errors::WorkspaceError, services::WorkspaceC
|
||||
use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
|
||||
use std::{convert::TryInto, sync::Arc};
|
||||
|
||||
#[tracing::instrument(name = "create_workspace", skip(data, controller))]
|
||||
pub(crate) async fn create_workspace(
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
pub(crate) async fn create_workspace_handler(
|
||||
data: Data<CreateWorkspaceRequest>,
|
||||
controller: Unit<Arc<WorkspaceController>>,
|
||||
) -> DataResult<Workspace, WorkspaceError> {
|
||||
@ -13,14 +13,14 @@ pub(crate) async fn create_workspace(
|
||||
data_result(detail)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "read_cur_workspace", skip(controller))]
|
||||
pub(crate) async fn read_cur_workspace(controller: Unit<Arc<WorkspaceController>>) -> DataResult<Workspace, WorkspaceError> {
|
||||
#[tracing::instrument(skip(controller), err)]
|
||||
pub(crate) async fn read_cur_workspace_handler(controller: Unit<Arc<WorkspaceController>>) -> DataResult<Workspace, WorkspaceError> {
|
||||
let workspace = controller.read_cur_workspace().await?;
|
||||
data_result(workspace)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "read_workspace", skip(data, controller))]
|
||||
pub(crate) async fn read_workspaces(
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
pub(crate) async fn read_workspaces_handler(
|
||||
data: Data<QueryWorkspaceRequest>,
|
||||
controller: Unit<Arc<WorkspaceController>>,
|
||||
) -> DataResult<RepeatedWorkspace, WorkspaceError> {
|
||||
@ -29,8 +29,8 @@ pub(crate) async fn read_workspaces(
|
||||
data_result(workspaces)
|
||||
}
|
||||
|
||||
#[tracing::instrument(name = "open_workspace", skip(data, controller))]
|
||||
pub(crate) async fn open_workspace(
|
||||
#[tracing::instrument(skip(data, controller), err)]
|
||||
pub(crate) async fn open_workspace_handler(
|
||||
data: Data<QueryWorkspaceRequest>,
|
||||
controller: Unit<Arc<WorkspaceController>>,
|
||||
) -> DataResult<Workspace, WorkspaceError> {
|
||||
|
@ -49,22 +49,22 @@ pub fn create(user: Arc<dyn WorkspaceUser>, database: Arc<dyn WorkspaceDatabase>
|
||||
.data(view_controller);
|
||||
|
||||
module = module
|
||||
.event(WorkspaceEvent::CreateWorkspace, create_workspace)
|
||||
.event(WorkspaceEvent::ReadCurWorkspace, read_cur_workspace)
|
||||
.event(WorkspaceEvent::ReadWorkspaces, read_workspaces)
|
||||
.event(WorkspaceEvent::OpenWorkspace, open_workspace);
|
||||
.event(WorkspaceEvent::CreateWorkspace, create_workspace_handler)
|
||||
.event(WorkspaceEvent::ReadCurWorkspace, read_cur_workspace_handler)
|
||||
.event(WorkspaceEvent::ReadWorkspaces, read_workspaces_handler)
|
||||
.event(WorkspaceEvent::OpenWorkspace, open_workspace_handler);
|
||||
|
||||
module = module
|
||||
.event(WorkspaceEvent::CreateApp, create_app)
|
||||
.event(WorkspaceEvent::ReadApp, read_app)
|
||||
.event(WorkspaceEvent::UpdateApp, update_app)
|
||||
.event(WorkspaceEvent::DeleteApp, delete_app);
|
||||
.event(WorkspaceEvent::CreateApp, create_app_handler)
|
||||
.event(WorkspaceEvent::ReadApp, read_app_handler)
|
||||
.event(WorkspaceEvent::UpdateApp, update_app_handler)
|
||||
.event(WorkspaceEvent::DeleteApp, delete_app_handler);
|
||||
|
||||
module = module
|
||||
.event(WorkspaceEvent::CreateView, create_view)
|
||||
.event(WorkspaceEvent::ReadView, read_view)
|
||||
.event(WorkspaceEvent::UpdateView, update_view)
|
||||
.event(WorkspaceEvent::DeleteView, delete_view);
|
||||
.event(WorkspaceEvent::CreateView, create_view_handler)
|
||||
.event(WorkspaceEvent::ReadView, read_view_handler)
|
||||
.event(WorkspaceEvent::UpdateView, update_view_handler)
|
||||
.event(WorkspaceEvent::DeleteView, delete_view_handler);
|
||||
|
||||
module
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ impl AppController {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
pub(crate) async fn create_app(&self, params: CreateAppParams) -> Result<App, WorkspaceError> {
|
||||
let app = self.create_app_on_server(params).await?;
|
||||
let app_table = AppTable::new(app.clone());
|
||||
@ -65,12 +66,15 @@ impl AppController {
|
||||
}
|
||||
|
||||
impl AppController {
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
async fn create_app_on_server(&self, params: CreateAppParams) -> Result<App, WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let app = self.server.create_app(&token, params).await?;
|
||||
log::info!("😁 {:?}", app);
|
||||
Ok(app)
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
async fn update_app_on_server(&self, params: UpdateAppParams) -> Result<(), WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let server = self.server.clone();
|
||||
@ -86,6 +90,7 @@ impl AppController {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
async fn delete_app_on_server(&self, app_id: &str) -> Result<(), WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let server = self.server.clone();
|
||||
@ -104,6 +109,7 @@ impl AppController {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
async fn read_app_on_server(&self, params: QueryAppParams) -> Result<(), WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let server = self.server.clone();
|
||||
|
@ -1,9 +1,10 @@
|
||||
use std::future::Future;
|
||||
|
||||
pub fn spawn<F>(f: F)
|
||||
pub async fn spawn<F>(f: F)
|
||||
where
|
||||
F: Future + Send + 'static,
|
||||
F: std::future::Future + Send + 'static,
|
||||
F::Output: Send + 'static,
|
||||
{
|
||||
tokio::spawn(f);
|
||||
match tokio::spawn(f).await {
|
||||
Ok(_) => {},
|
||||
Err(e) => log::error!("{:?}", e),
|
||||
}
|
||||
}
|
||||
|
@ -45,8 +45,11 @@ pub trait WorkspaceServerAPI {
|
||||
|
||||
// App
|
||||
fn create_app(&self, token: &str, params: CreateAppParams) -> ResultFuture<App, WorkspaceError>;
|
||||
|
||||
fn read_app(&self, token: &str, params: QueryAppParams) -> ResultFuture<Option<App>, WorkspaceError>;
|
||||
|
||||
fn update_app(&self, token: &str, params: UpdateAppParams) -> ResultFuture<(), WorkspaceError>;
|
||||
|
||||
fn delete_app(&self, token: &str, params: DeleteAppParams) -> ResultFuture<(), WorkspaceError>;
|
||||
}
|
||||
|
||||
|
@ -72,12 +72,14 @@ impl ViewController {
|
||||
}
|
||||
|
||||
impl ViewController {
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
async fn create_view_on_server(&self, params: CreateViewParams) -> Result<View, WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let view = self.server.create_view(&token, params).await?;
|
||||
Ok(view)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
async fn update_view_on_server(&self, params: UpdateViewParams) -> Result<(), WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let server = self.server.clone();
|
||||
@ -93,6 +95,7 @@ impl ViewController {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
async fn delete_view_on_server(&self, view_id: &str) -> Result<(), WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let server = self.server.clone();
|
||||
@ -111,6 +114,7 @@ impl ViewController {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
async fn read_view_on_server(&self, params: QueryViewParams) -> Result<(), WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let server = self.server.clone();
|
||||
|
@ -142,12 +142,14 @@ impl WorkspaceController {
|
||||
Ok((token, server))
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
async fn create_workspace_on_server(&self, params: CreateWorkspaceParams) -> Result<Workspace, WorkspaceError> {
|
||||
let token = self.user.token()?;
|
||||
let workspace = self.server.create_workspace(&token, params).await?;
|
||||
Ok(workspace)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
async fn update_workspace_on_server(&self, params: UpdateWorkspaceParams) -> Result<(), WorkspaceError> {
|
||||
let (token, server) = self.token_with_server()?;
|
||||
spawn(async move {
|
||||
@ -162,6 +164,7 @@ impl WorkspaceController {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
async fn delete_workspace_on_server(&self, workspace_id: &str) -> Result<(), WorkspaceError> {
|
||||
let params = DeleteWorkspaceParams {
|
||||
workspace_id: workspace_id.to_string(),
|
||||
@ -179,6 +182,7 @@ impl WorkspaceController {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), err)]
|
||||
async fn read_workspaces_on_server(&self, params: QueryWorkspaceParams) -> Result<(), WorkspaceError> {
|
||||
let (token, server) = self.token_with_server()?;
|
||||
spawn(async move {
|
||||
|
@ -12,4 +12,5 @@ rustup show
|
||||
# 2. ~/.bashrc
|
||||
# 3. ~/.profile
|
||||
# 4. ~/.zshrc
|
||||
cargo make desktop
|
||||
cargo make desktop
|
||||
#cargo make gen_dart_event
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env fish
|
||||
cargo make gen_dart_event
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
brew install sqlite3
|
||||
cargo install diesel_cli --no-default-features --features sqlite
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo 'install rust'
|
||||
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
|
@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#targets
|
||||
rustup target add x86_64-apple-darwin
|
||||
|
||||
#tools
|
||||
echo 'install tools'
|
||||
rustup component add rustfmt
|
||||
cargo install cargo-expand
|
||||
cargo install cargo-watch
|
||||
cargo install cargo-cache
|
||||
cargo install bunyan
|
||||
|
||||
#protobuf code gen env
|
||||
brew install protobuf@3.13
|
||||
brew tap dart-lang/dart
|
||||
brew install dart
|
||||
pub global activate protoc_plugin
|
||||
|
||||
cargo install --version 2.20.0 protobuf-codegen
|
@ -25,7 +25,7 @@ description = "Build desktop targets."
|
||||
script = [
|
||||
"""
|
||||
cd rust-lib/
|
||||
cargo build --package=dart-ffi --target ${DESKTOP_TARGET} --features="observable"
|
||||
cargo build --package=dart-ffi --target ${DESKTOP_TARGET} --features="observable","http_server"
|
||||
cd ../
|
||||
""",
|
||||
]
|
||||
|
43
scripts/makefile/env.toml
Normal file
43
scripts/makefile/env.toml
Normal file
@ -0,0 +1,43 @@
|
||||
[tasks.env_setup]
|
||||
script = """
|
||||
brew install sqlite3
|
||||
cargo install diesel_cli --no-default-features --features sqlite
|
||||
"""
|
||||
|
||||
[tasks.install_sqlite3]
|
||||
script = """
|
||||
brew install sqlite3
|
||||
cargo install diesel_cli --no-default-features --features sqlite
|
||||
"""
|
||||
|
||||
[tasks.install_rust]
|
||||
script = """
|
||||
echo 'install rust'
|
||||
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
|
||||
"""
|
||||
|
||||
[tasks.install_tools]
|
||||
script = """
|
||||
#targets
|
||||
rustup target add x86_64-apple-darwin
|
||||
|
||||
#tools
|
||||
echo 'install tools'
|
||||
rustup component add rustfmt
|
||||
cargo install cargo-expand
|
||||
cargo install cargo-watch
|
||||
cargo install cargo-cache
|
||||
cargo install bunyan
|
||||
|
||||
#protobuf code gen env
|
||||
brew install protobuf@3.13
|
||||
brew tap dart-lang/dart
|
||||
brew install dart
|
||||
pub global activate protoc_plugin
|
||||
|
||||
cargo install --version 2.20.0 protobuf-codegen
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user