Unify dependencies

This commit is contained in:
Adrian Woźniak 2021-08-13 12:56:11 +02:00
parent 477a888a12
commit dc5164f779
No known key found for this signature in database
GPG Key ID: DE43476F72AD3F6C
18 changed files with 47 additions and 84 deletions

21
Cargo.lock generated
View File

@ -892,6 +892,9 @@ dependencies = [
"actix-web", "actix-web",
"actix-web-actors", "actix-web-actors",
"actix_derive 0.6.0", "actix_derive 0.6.0",
"env_logger",
"log",
"pretty_env_logger",
"reexport-proc-macro", "reexport-proc-macro",
"serde", "serde",
"serde_derive", "serde_derive",
@ -1034,20 +1037,17 @@ dependencies = [
"derive_db_execute", "derive_db_execute",
"diesel", "diesel",
"dotenv", "dotenv",
"env_logger",
"futures", "futures",
"ipnetwork 0.16.0", "ipnetwork 0.16.0",
"jirs-config", "jirs-config",
"jirs-data", "jirs-data",
"libc", "libc",
"log",
"num-bigint", "num-bigint",
"num-integer", "num-integer",
"num-traits", "num-traits",
"openssl-sys", "openssl-sys",
"percent-encoding", "percent-encoding",
"pq-sys", "pq-sys",
"pretty_env_logger",
"r2d2", "r2d2",
"serde", "serde",
"time 0.1.44", "time 0.1.44",
@ -1362,11 +1362,8 @@ dependencies = [
"actix-files", "actix-files",
"bytes 0.5.6", "bytes 0.5.6",
"common", "common",
"env_logger",
"futures", "futures",
"jirs-config", "jirs-config",
"log",
"pretty_env_logger",
"tokio", "tokio",
] ]
@ -1689,13 +1686,10 @@ dependencies = [
"actix 0.10.0", "actix 0.10.0",
"bincode", "bincode",
"common", "common",
"env_logger",
"flate2", "flate2",
"jirs-config", "jirs-config",
"jirs-data", "jirs-data",
"lazy_static", "lazy_static",
"log",
"pretty_env_logger",
"serde", "serde",
"simsearch", "simsearch",
"syntect", "syntect",
@ -2133,15 +2127,12 @@ dependencies = [
"actix 0.10.0", "actix 0.10.0",
"common", "common",
"dotenv", "dotenv",
"env_logger",
"futures", "futures",
"jirs-config", "jirs-config",
"lettre", "lettre",
"lettre_email", "lettre_email",
"libc", "libc",
"log",
"openssl-sys", "openssl-sys",
"pretty_env_logger",
"serde", "serde",
"toml", "toml",
"uuid 0.8.2", "uuid 0.8.2",
@ -4226,16 +4217,13 @@ dependencies = [
"bytes 0.5.6", "bytes 0.5.6",
"common", "common",
"database-actor", "database-actor",
"env_logger",
"filesystem-actor", "filesystem-actor",
"futures", "futures",
"jirs-config", "jirs-config",
"jirs-data", "jirs-data",
"libc", "libc",
"log",
"mail-actor", "mail-actor",
"openssl-sys", "openssl-sys",
"pretty_env_logger",
"serde", "serde",
"tokio", "tokio",
"toml", "toml",
@ -4262,7 +4250,6 @@ dependencies = [
"common", "common",
"comrak", "comrak",
"database-actor", "database-actor",
"env_logger",
"flate2", "flate2",
"futures", "futures",
"highlight-actor", "highlight-actor",
@ -4270,10 +4257,8 @@ dependencies = [
"jirs-data", "jirs-data",
"lazy_static", "lazy_static",
"libc", "libc",
"log",
"mail-actor", "mail-actor",
"openssl-sys", "openssl-sys",
"pretty_env_logger",
"pulldown-cmark", "pulldown-cmark",
"serde", "serde",
"syntect", "syntect",

View File

@ -42,10 +42,6 @@ num-integer = { version = "0.1.32" }
bigdecimal = { version = ">= 0.0.10, <= 0.1.0" } bigdecimal = { version = ">= 0.0.10, <= 0.1.0" }
bitflags = { version = "1.0" } bitflags = { version = "1.0" }
log = "0.4"
pretty_env_logger = "0.4"
env_logger = "0.7"
[dependencies.jirs-config] [dependencies.jirs-config]
path = "../../shared/jirs-config" path = "../../shared/jirs-config"
features = ["database"] features = ["database"]

View File

@ -88,7 +88,7 @@ impl UpdateIssue {
)) ))
.get_result(conn) .get_result(conn)
.map_err(|e| { .map_err(|e| {
log::debug!("{:?}", e); common::log::debug!("{:?}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Create, crate::OperationError::Create,
crate::ResourceKind::Issue, crate::ResourceKind::Issue,
@ -186,7 +186,7 @@ impl CreateIssue {
.select(sql("COALESCE(max(list_position), 0) + 1")) .select(sql("COALESCE(max(list_position), 0) + 1"))
.get_result::<i32>(conn) .get_result::<i32>(conn)
.map_err(|e| { .map_err(|e| {
log::error!("resolve new issue position failed {}", e); common::log::error!("resolve new issue position failed {}", e);
crate::DatabaseError::Issue(crate::IssueError::BadListPosition) crate::DatabaseError::Issue(crate::IssueError::BadListPosition)
})?; })?;
let i_s_id: IssueStatusId = if msg.issue_status_id == 0 { let i_s_id: IssueStatusId = if msg.issue_status_id == 0 {
@ -230,7 +230,7 @@ impl CreateIssue {
} }
.execute(conn)?; .execute(conn)?;
issues.find(issue.id).get_result(conn).map_err(|e| { issues.find(issue.id).get_result(conn).map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Create, crate::OperationError::Create,
crate::ResourceKind::Issue, crate::ResourceKind::Issue,

View File

@ -75,7 +75,7 @@ impl<'l> Guard<'l> {
use diesel::prelude::*; use diesel::prelude::*;
let tm = conn.transaction_manager(); let tm = conn.transaction_manager();
tm.begin_transaction(conn).map_err(|e| { tm.begin_transaction(conn).map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
crate::DatabaseError::DatabaseConnectionLost crate::DatabaseError::DatabaseConnectionLost
})?; })?;
Ok(Self { conn, tm }) Ok(Self { conn, tm })
@ -91,15 +91,15 @@ impl<'l> Guard<'l> {
match r { match r {
Ok(r) => { Ok(r) => {
self.tm.commit_transaction(self.conn).map_err(|e| { self.tm.commit_transaction(self.conn).map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
crate::DatabaseError::DatabaseConnectionLost crate::DatabaseError::DatabaseConnectionLost
})?; })?;
Ok(r) Ok(r)
} }
Err(e) => { Err(e) => {
log::error!("{:?}", e); common::log::error!("{:?}", e);
self.tm.rollback_transaction(self.conn).map_err(|e| { self.tm.rollback_transaction(self.conn).map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
crate::DatabaseError::DatabaseConnectionLost crate::DatabaseError::DatabaseConnectionLost
})?; })?;
Err(e) Err(e)

View File

@ -2,13 +2,13 @@
macro_rules! db_pool { macro_rules! db_pool {
($self: expr) => { ($self: expr) => {
&$self.pool.get().map_err(|e| { &$self.pool.get().map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$crate::DatabaseError::DatabaseConnectionLost $crate::DatabaseError::DatabaseConnectionLost
})? })?
}; };
($self: expr, $pool: expr) => { ($self: expr, $pool: expr) => {
&$pool.get().map_err(|e| { &$pool.get().map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$crate::DatabaseError::DatabaseConnectionLost $crate::DatabaseError::DatabaseConnectionLost
})? })?
}; };
@ -18,7 +18,7 @@ macro_rules! db_pool {
macro_rules! q { macro_rules! q {
($q: expr) => {{ ($q: expr) => {{
let q = $q; let q = $q;
log::debug!( common::log::debug!(
"{}", "{}",
diesel::debug_query::<diesel::pg::Pg, _>(&q).to_string() diesel::debug_query::<diesel::pg::Pg, _>(&q).to_string()
); );
@ -40,7 +40,7 @@ macro_rules! db_find {
$crate::q!($q) $crate::q!($q)
.first($conn) .first($conn)
.map_err(|e| { .map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::LoadCollection, $crate::OperationError::LoadCollection,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -81,7 +81,7 @@ macro_rules! db_load {
$crate::q!($q) $crate::q!($q)
.load(conn) .load(conn)
.map_err(|e| { .map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::LoadCollection, $crate::OperationError::LoadCollection,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -120,7 +120,7 @@ macro_rules! db_load_field {
$crate::q!($q) $crate::q!($q)
.load(conn) .load(conn)
.map_err(|e| { .map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::LoadCollection, $crate::OperationError::LoadCollection,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -162,7 +162,7 @@ macro_rules! db_create {
$crate::q!($q) $crate::q!($q)
.get_result::<$resource>($conn) .get_result::<$resource>($conn)
.map_err(|e| { .map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::Create, $crate::OperationError::Create,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -205,7 +205,7 @@ macro_rules! db_update {
$crate::q!($q) $crate::q!($q)
.get_result::<$resource>($conn) .get_result::<$resource>($conn)
.map_err(|e| { .map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::Update, $crate::OperationError::Update,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -247,7 +247,7 @@ macro_rules! db_delete {
$crate::q!($q) $crate::q!($q)
.execute($conn) .execute($conn)
.map_err(|e| { .map_err(|e| {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::Delete, $crate::OperationError::Delete,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,

View File

@ -18,10 +18,6 @@ actix = { version = "0.10.0" }
futures = { version = "0.3.8" } futures = { version = "0.3.8" }
log = "0.4"
pretty_env_logger = "0.4"
env_logger = "0.7"
bytes = { version = "0.5.6" } bytes = { version = "0.5.6" }
# Local storage # Local storage

View File

@ -26,10 +26,6 @@ flate2 = { version = "*" }
syntect = { version = "*" } syntect = { version = "*" }
lazy_static = { version = "*" } lazy_static = { version = "*" }
log = "0.4"
pretty_env_logger = "0.4"
env_logger = "0.7"
[dependencies.jirs-config] [dependencies.jirs-config]
path = "../../shared/jirs-config" path = "../../shared/jirs-config"
features = ["hi"] features = ["hi"]

View File

@ -19,10 +19,6 @@ actix = { version = "0.10.0" }
serde = "*" serde = "*"
toml = { version = "*" } toml = { version = "*" }
log = "0.4"
pretty_env_logger = "0.4"
env_logger = "0.7"
dotenv = { version = "*" } dotenv = { version = "*" }
uuid = { version = "0.8.1", features = ["serde", "v4", "v5"] } uuid = { version = "0.8.1", features = ["serde", "v4", "v5"] }

View File

@ -33,10 +33,6 @@ futures = { version = "0.3.8" }
openssl-sys = { version = "*", features = ["vendored"] } openssl-sys = { version = "*", features = ["vendored"] }
libc = { version = "0.2.0", default-features = false } libc = { version = "0.2.0", default-features = false }
log = "0.4"
pretty_env_logger = "0.4"
env_logger = "0.7"
uuid = { version = "0.8.1", features = ["serde", "v4", "v5"] } uuid = { version = "0.8.1", features = ["serde", "v4", "v5"] }
[dependencies.jirs-config] [dependencies.jirs-config]

View File

@ -160,13 +160,13 @@ async fn update_user_avatar(
Ok(Ok(user)) => Ok(user), Ok(Ok(user)) => Ok(user),
Ok(Err(e)) => { Ok(Err(e)) => {
error!("{:?}", e); common::log::error!("{:?}", e);
Err(actix_web::Error::from( Err(actix_web::Error::from(
HttpResponse::Unauthorized().finish(), HttpResponse::Unauthorized().finish(),
)) ))
} }
Err(e) => { Err(e) => {
error!("{:?}", e); common::log::error!("{:?}", e);
Err(actix_web::Error::from( Err(actix_web::Error::from(
HttpResponse::Unauthorized().finish(), HttpResponse::Unauthorized().finish(),
)) ))
@ -191,11 +191,11 @@ async fn handle_token(
Ok(Ok(user)) => Ok(user.id), Ok(Ok(user)) => Ok(user.id),
Ok(Err(e)) => { Ok(Err(e)) => {
error!("{:?}", e); common::log::error!("{:?}", e);
Err(HttpResponse::Unauthorized().finish().into()) Err(HttpResponse::Unauthorized().finish().into())
} }
Err(e) => { Err(e) => {
error!("{:?}", e); common::log::error!("{:?}", e);
Err(HttpResponse::Unauthorized().finish().into()) Err(HttpResponse::Unauthorized().finish().into())
} }
} }

View File

@ -1,6 +1,3 @@
#[macro_use]
extern crate log;
use actix::Addr; use actix::Addr;
use actix_web::web::Data; use actix_web::web::Data;
use actix_web::{HttpRequest, HttpResponse}; use actix_web::{HttpRequest, HttpResponse};

View File

@ -28,10 +28,6 @@ flate2 = { version = "*" }
syntect = { version = "*" } syntect = { version = "*" }
lazy_static = { version = "*" } lazy_static = { version = "*" }
log = { version = "0.4" }
pretty_env_logger = { version = "0.4" }
env_logger = { version = "0.7" }
uuid = { version = "0.8.1", features = ["serde", "v4", "v5"] } uuid = { version = "0.8.1", features = ["serde", "v4", "v5"] }
[dependencies.comrak] [dependencies.comrak]

View File

@ -1,17 +1,14 @@
#[macro_use]
extern crate log;
use actix::{Actor, ActorContext, Addr, AsyncContext, Handler, Recipient, StreamHandler}; use actix::{Actor, ActorContext, Addr, AsyncContext, Handler, Recipient, StreamHandler};
use actix_web::web::{self, Data}; use actix_web::web::{self, Data};
use actix_web::{get, Error, HttpRequest, HttpResponse}; use actix_web::{get, Error, HttpRequest, HttpResponse};
use actix_web_actors::ws; use actix_web_actors::ws;
use common::log::*;
use common::{actix_web, actix_web_actors}; use common::{actix_web, actix_web_actors};
use database_actor::projects::LoadCurrentProject; use database_actor::projects::LoadCurrentProject;
use database_actor::user_projects::CurrentUserProject; use database_actor::user_projects::CurrentUserProject;
use database_actor::DbExecutor; use database_actor::DbExecutor;
use futures::executor::block_on; use futures::executor::block_on;
use jirs_data::{Project, User, UserProject, WsMsg}; use jirs_data::{Project, User, UserProject, WsMsg};
use log::*;
use mail_actor::MailExecutor; use mail_actor::MailExecutor;
use crate::handlers::*; use crate::handlers::*;
@ -47,7 +44,7 @@ impl WsMessageSender for ws::WebsocketContext<WebSocketActor> {
fn send_msg(&mut self, msg: &WsMsg) { fn send_msg(&mut self, msg: &WsMsg) {
match bincode::serialize(msg) { match bincode::serialize(msg) {
Err(err) => { Err(err) => {
log::error!("{}", err); common::log::error!("{}", err);
} }
Ok(v) => self.binary(v), Ok(v) => self.binary(v),
} }

View File

@ -34,11 +34,11 @@ macro_rules! actor_or_debug_and_return {
match block_on($s.$actor.send($msg)) { match block_on($s.$actor.send($msg)) {
Ok(Ok(r)) => r, Ok(Ok(r)) => r,
Ok(Err(e)) => { Ok(Err(e)) => {
log::error!("{:?}", e); common::log::error!("{:?}", e);
return $actor_err; return $actor_err;
} }
Err(e) => { Err(e) => {
log::error!("{:?}", e); common::log::error!("{:?}", e);
return $mailbox_err; return $mailbox_err;
} }
} }
@ -56,10 +56,10 @@ macro_rules! actor_or_debug_and_ignore {
$on_success(r); $on_success(r);
} }
Ok(Err(e)) => { Ok(Err(e)) => {
log::error!("{:?}", e); common::log::error!("{:?}", e);
} }
Err(e) => { Err(e) => {
log::error!("{:?}", e); common::log::error!("{:?}", e);
} }
} }
}; };
@ -71,11 +71,11 @@ macro_rules! actor_or_debug_and_fallback {
match block_on($s.$actor.send($msg)) { match block_on($s.$actor.send($msg)) {
Ok(Ok(r)) => r, Ok(Ok(r)) => r,
Ok(Err(e)) => { Ok(Err(e)) => {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$actor_err $actor_err
} }
Err(e) => { Err(e) => {
log::error!("{:?}", e); common::log::error!("{:?}", e);
$mailbox_err $mailbox_err
} }
} }

View File

@ -1,6 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use actix::{Actor, Context, Recipient}; use actix::{Actor, Context, Recipient};
use common::log::*;
use jirs_data::{ProjectId, UserId, WsMsg}; use jirs_data::{ProjectId, UserId, WsMsg};
#[derive(actix::Message, Debug)] #[derive(actix::Message, Debug)]
@ -110,8 +111,8 @@ impl WsServer {
fn send_to_recipients(&self, recipients: &[Recipient<InnerMsg>], msg: &WsMsg) { fn send_to_recipients(&self, recipients: &[Recipient<InnerMsg>], msg: &WsMsg) {
for recipient in recipients.iter() { for recipient in recipients.iter() {
match recipient.do_send(InnerMsg::Transfer(msg.clone())) { match recipient.do_send(InnerMsg::Transfer(msg.clone())) {
Ok(_) => debug!("msg sent"), Ok(_) => common::log::debug!("msg sent"),
Err(e) => error!("{}", e), Err(e) => common::log::error!("{}", e),
}; };
} }
} }

View File

@ -157,7 +157,7 @@ fn build_create_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).get_result(conn).map_err(|e| {{ crate::q!({query}).get_result(conn).map_err(|e| {{
log::error!("{{:?}}", e); common::log::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Create, crate::OperationError::Create,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},
@ -192,7 +192,7 @@ fn build_find_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).first(conn).map_err(|e| {{ crate::q!({query}).first(conn).map_err(|e| {{
log::error!("{{:?}}", e); common::log::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::LoadSingle, crate::OperationError::LoadSingle,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},
@ -226,7 +226,7 @@ fn build_load_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).load(conn).map_err(|e| {{ crate::q!({query}).load(conn).map_err(|e| {{
log::error!("{{:?}}", e); common::log::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::LoadCollection, crate::OperationError::LoadCollection,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},
@ -260,7 +260,7 @@ fn build_update_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).get_result(conn).map_err(|e| {{ crate::q!({query}).get_result(conn).map_err(|e| {{
log::error!("{{:?}}", e); common::log::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Update, crate::OperationError::Update,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},
@ -294,7 +294,7 @@ fn build_destroy_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).execute(conn).map_err(|e| {{ crate::q!({query}).execute(conn).map_err(|e| {{
log::error!("{{:?}}", e); common::log::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Delete, crate::OperationError::Delete,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},

View File

@ -20,4 +20,8 @@ actix_derive = { version = "*" }
serde = { version = "*" } serde = { version = "*" }
serde_derive = { version = "*" } serde_derive = { version = "*" }
log = "0.4"
pretty_env_logger = "0.4"
env_logger = "0.7"
reexport-proc-macro = { version = "*" } reexport-proc-macro = { version = "*" }

View File

@ -1,7 +1,10 @@
#[macro_use] #[macro_use]
extern crate reexport_proc_macro; extern crate reexport_proc_macro;
pub use {actix_cors, actix_rt, actix_service, actix_web, actix_web_actors, serde}; pub use {
actix_cors, actix_rt, actix_service, actix_web, actix_web_actors, env_logger, log,
pretty_env_logger, serde,
};
reexport_proc_macro!(actix_derive); reexport_proc_macro!(actix_derive);
reexport_proc_macro!(serde_derive); reexport_proc_macro!(serde_derive);