Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUTO : Forward from refactoring_2 to alpha #1477

Merged
merged 12 commits into from
Nov 6, 2024
Prev Previous commit
Next Next commit
fixing cyclic dependency problem
  • Loading branch information
Wandalen committed Nov 5, 2024
commit f92c46fdc6dc42ad50811783e8616766604f7e81
12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -536,4 +536,14 @@ version = "0.1.83"
[workspace.dependencies.tokio]
version = "1.41.0"
features = []
default-features = false
default-features = false

[workspace.dependencies.anyhow]
version = "~1.0"
# features = []
# default-features = false

[workspace.dependencies.thiserror]
version = "~1.0"
# features = []
# default-features = false
5 changes: 3 additions & 2 deletions module/core/error_tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -48,8 +48,9 @@ error_untyped = [ "anyhow" ]
# = entry

[dependencies]
anyhow = { version = "~1.0", optional = true }
thiserror = { version = "~1.0", optional = true }
anyhow = { workspace = true, optional = true }
thiserror = { workspace = true, optional = true }

[dev-dependencies]
test_tools = { workspace = true }
# xxx : qqq : review
Original file line number Diff line number Diff line change
@@ -223,11 +223,13 @@ pub mod typed;
/// Untyped exceptions handling mechanism.
pub mod untyped;

#[ cfg( feature = "enabled" ) ]
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use own::*;

/// Own namespace of the module.
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod own
{
@@ -256,16 +258,16 @@ pub mod own
// BasicError,
};

pub use super::
{
assert,
typed,
untyped,
};
pub use super::assert;
#[ cfg( feature = "error_typed" ) ]
pub use super::typed;
#[ cfg( feature = "error_untyped" ) ]
pub use super::untyped;

}

/// Shared with parent namespace of the module
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod orphan
{
@@ -275,6 +277,7 @@ pub mod orphan
}

/// Exposed namespace of the module.
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod exposed
{
@@ -304,6 +307,7 @@ pub mod exposed
}

/// Prelude to use essentials: `use my_module::prelude::*`.
#[ cfg( feature = "enabled" ) ]
#[ allow( unused_imports ) ]
pub mod prelude
{
21 changes: 16 additions & 5 deletions module/core/test_tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -27,8 +27,12 @@ all-features = false
# = features

[features]
default = [ "enabled" ]
full = [ "enabled" ]
default = [
"enabled",
"error_typed",
"error_untyped",
]
full = [ "default" ]
no_std = [
# "error_tools/no_std",
# "meta_tools/no_std",
@@ -62,20 +66,22 @@ enabled = [
]
# nightly = [ "typing_tools/nightly" ]

error_typed = []
error_untyped = []

[dependencies]

## external

paste = "~1.0" # zzz : remove laster
# paste = "~1.0" # zzz : remove later
rustversion = "~1.0"
# anyhow = "~1.0"
num-traits = "~0.2"
trybuild = { version = "1.0.85", features = [ "diff" ] }
rand = "0.8.5"

## internal

error_tools = { workspace = true, features = [ "full" ] }
# error_tools = { workspace = true, features = [ "full" ] }
meta_tools = { workspace = true, features = [ "full" ] }
mem_tools = { workspace = true, features = [ "full" ] }
typing_tools = { workspace = true, features = [ "full" ] }
@@ -86,5 +92,10 @@ collection_tools = { workspace = true, features = [ "full" ] }

# former_stable = { workspace = true, features = [ "full" ] }

## transient

anyhow = { workspace = true }
thiserror = { workspace = true }

[build-dependencies]
rustc_version = "0.4"
10 changes: 5 additions & 5 deletions module/core/test_tools/src/lib.rs
Original file line number Diff line number Diff line change
@@ -11,9 +11,9 @@
pub mod dependency
{

// zzz : exclude later
#[ doc( inline ) ]
pub use ::paste;
// // zzz : exclude later
// #[ doc( inline ) ]
// pub use ::paste;
#[ doc( inline ) ]
pub use ::trybuild;
#[ doc( inline ) ]
@@ -41,8 +41,8 @@ pub mod dependency

}

// #[ path = "../../../core/error_tools/src/lib.rs" ]
// pub mod error_tools;
#[ path = "../../../core/error_tools/src/error/mod.rs" ]
pub mod error_tools;

mod private {}

6 changes: 3 additions & 3 deletions module/move/willbe/src/action/cicd_renew.rs
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ mod private
use error::
{
typed::Error,
err,
// err,
};

#[ derive( Debug, Error ) ]
@@ -375,7 +375,7 @@ mod private
return url::repo_url_extract( &url )
.and_then( | url | url::git_info_extract( &url ).ok() )
.map( UsernameAndRepository )
.ok_or_else( || err!( "Fail to parse repository url from workspace Cargo.toml"))
.ok_or_else( || error::untyped::format_err!( "Fail to parse repository url from workspace Cargo.toml"))
}
else
{
@@ -393,7 +393,7 @@ mod private
.and_then( | url | url::repo_url_extract( &url ) )
.and_then( | url | url::git_info_extract( &url ).ok() )
.map( UsernameAndRepository )
.ok_or_else( || err!( "Fail to extract repository url") )
.ok_or_else( || error::untyped::format_err!( "Fail to extract repository url") )
}
}

6 changes: 3 additions & 3 deletions module/move/willbe/src/action/list.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ mod private
};
use error::
{
ErrWith, err,
ErrWith,
untyped::{ Context, format_err },
};
use tool::{ TreePrinter, ListNodeReport };
@@ -39,7 +39,7 @@ mod private
{
"tree" => ListFormat::Tree,
"toposort" => ListFormat::Topological,
e => return Err( err!( "Unknown format '{}'. Available values : [tree, toposort]", e ))
e => return Err( error::untyped::format_err!( "Unknown format '{}'. Available values : [tree, toposort]", e ))
};

Ok( value )
@@ -105,7 +105,7 @@ mod private
{
"nothing" => ListFilter::Nothing,
"local" => ListFilter::Local,
e => return Err( err!( "Unknown filter '{}'. Available values : [nothing, local]", e ) )
e => return Err( error::untyped::format_err!( "Unknown filter '{}'. Available values : [nothing, local]", e ) )
};

Ok( value )
14 changes: 7 additions & 7 deletions module/move/willbe/src/action/main_header.rs
Original file line number Diff line number Diff line change
@@ -18,8 +18,8 @@ mod private
use entity::{ PathError, WorkspaceInitError };
use error::
{
err,
untyped::Error,
// err,
// untyped::Error,
};
use workspace_md_extension::WorkspaceMdExtension;

@@ -86,7 +86,7 @@ mod private
{
/// Represents a common error.
#[ error( "Common error: {0}" ) ]
Common(#[ from ] Error ),
Common( #[ from ] error::untyped::Error ), // qqq : rid of
/// Represents an I/O error.
#[ error( "I/O error: {0}" ) ]
IO( #[ from ] std::io::Error ),
@@ -116,14 +116,14 @@ mod private
// aaa : done
let repository_url = workspace
.repository_url()
.ok_or_else::< Error, _ >
( || err!( "repo_url not found in workspace Cargo.toml" ) )?;
.ok_or_else::< error::untyped::Error, _ >
( || error::untyped::format_err!( "repo_url not found in workspace Cargo.toml" ) )?;

let master_branch = workspace.master_branch().unwrap_or( "master".into() );
let workspace_name = workspace
.workspace_name()
.ok_or_else::< Error, _ >
( || err!( "workspace_name not found in workspace Cargo.toml" ) )?;
.ok_or_else::< error::untyped::Error, _ >
( || error::untyped::format_err!( "workspace_name not found in workspace Cargo.toml" ) )?;

let discord_url = workspace.discord_url();

12 changes: 6 additions & 6 deletions module/move/willbe/src/action/readme_modules_headers_renew.rs
Original file line number Diff line number Diff line change
@@ -20,11 +20,11 @@ mod private
use package::Package;
use error::
{
err,
// err,
untyped::
{
// Result,
Error as wError,
// Error as wError,
Context,
},
};
@@ -101,7 +101,7 @@ mod private
{
/// Represents a common error.
#[ error( "Common error: {0}" ) ]
Common(#[ from ] wError ),
Common(#[ from ] error::untyped::Error ), // qqq : rid of
/// Represents an I/O error.
#[ error( "I/O error: {0}" ) ]
IO( #[ from ] std::io::Error ),
@@ -140,7 +140,7 @@ mod private
let stability = package.stability()?;
let module_name = package.name()?;
let repository_url = package.repository()?
.ok_or_else::< wError, _ >( || err!( "Fail to find repository_url in module`s Cargo.toml" ) )?;
.ok_or_else::< error::untyped::Error, _ >( || error::untyped::format_err!( "Fail to find repository_url in module`s Cargo.toml" ) )?;

let discord_url = package
.discord_url()?
@@ -172,7 +172,7 @@ mod private

let repo_url = url::repo_url_extract( &self.repository_url )
.and_then( | r | url::git_info_extract( &r ).ok() )
.ok_or_else::< wError, _ >( || err!( "Fail to parse repository url" ) )?;
.ok_or_else::< error::untyped::Error, _ >( || error::untyped::format_err!( "Fail to parse repository url" ) )?;
let example= if let Some( name ) = find_example_file
(
self.module_path.as_path(),
@@ -269,7 +269,7 @@ mod private
.join
(
repository::readme_path( path.parent().unwrap().as_ref() )
// .ok_or_else::< wError, _ >( || err!( "Fail to find README.md at {}", &path ) )
// .ok_or_else::< error::untyped::Error, _ >( || error::untyped::format_err!( "Fail to find README.md at {}", &path ) )
.err_with_report( &report )?
);

4 changes: 2 additions & 2 deletions module/move/willbe/src/command/readme_headers_renew.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ mod private
{
use crate::*;
use action;
use error::{ err };
// use error::{ err };
use std::fmt::{ Display, Formatter };

#[ derive( Debug, Default ) ]
@@ -103,7 +103,7 @@ mod private
if fail
{
eprintln!( "{report}" );
Err( err!( "Something went wrong" ) )
Err( error::untyped::format_err!( "Something went wrong" ) )
}
else
{
2 changes: 1 addition & 1 deletion module/move/willbe/src/entity/channel.rs
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ mod private
.bin_path( program )
.args( options.into_iter().map( OsString::from ).collect::< Vec< _ > >() )
.current_path( path.as_ref().to_path_buf() )
.run().map_err::< Error, _ >( | report | err!( report.to_string() ) )?;
.run().map_err::< Error, _ >( | report | error::untyped::format_err!( report.to_string() ) )?;

let list = report
.out
10 changes: 5 additions & 5 deletions module/move/willbe/src/tool/cargo.rs
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ mod private

use std::ffi::OsString;
use std::path::PathBuf;
use error::err;
use error::untyped::format_err;
// use error::err;
// use error::untyped::format_err;
use former::Former;
use process_tools::process;
// use process_tools::process::*;
@@ -118,7 +118,7 @@ mod private
.bin_path( program )
.args( options.into_iter().map( OsString::from ).collect::< Vec< _ > >() )
.current_path( args.path )
.run().map_err( | report | err!( report.to_string() ) )
.run().map_err( | report | error::untyped::format_err!( report.to_string() ) )
}
}

@@ -197,11 +197,11 @@ mod private
}
if args.retry_count > 0
{
Err( format_err!( "It took {} attempts, but still failed. Here are the errors:\n{}", args.retry_count + 1, results.into_iter().map( | r | format!( "- {r}" ) ).collect::< Vec< _ > >().join( "\n" ) ) )
Err( error::untyped::format_err!( "It took {} attempts, but still failed. Here are the errors:\n{}", args.retry_count + 1, results.into_iter().map( | r | format!( "- {r}" ) ).collect::< Vec< _ > >().join( "\n" ) ) )
}
else
{
Err( results.remove( 0 ) ).map_err( | report | err!( report.to_string() ) )
Err( results.remove( 0 ) ).map_err( | report | error::untyped::format_err!( report.to_string() ) )
}
}
}
Loading
Loading