diff --git a/Cargo.toml b/Cargo.toml index 7b156fa3..8337bdf5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,8 @@ members = [ "coordinator/tributary", "coordinator", + "substrate/tree-cleanup/option-ext", + "substrate/tree-cleanup/directories-next", "substrate/tree-cleanup/bandersnatch_vrfs", "substrate/tree-cleanup/w3f-bls", @@ -100,6 +102,17 @@ lazy_static = { git = "https://github.com/rust-lang-nursery/lazy-static.rs", rev sp-core-hashing = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" } sp-std = { git = "https://github.com/serai-dex/polkadot-sdk", branch = "experimental" } +# directories-next was created because directories was unmaintained +# directories-next is now unmaintained while directories is maintained +# The directories author pulls in ridiculously pointless crates and prefers +# copyleft licenses +# Serai's polkadot-sdk consolidated to directories-next, as directories-next is +# acceptable and because we couldn't consolidate to directories without forking +# wasmtime +# The following two patches resolve everything +option-ext = { path = "substrate/tree-cleanup/option-ext" } +directories-next = { path = "substrate/tree-cleanup/directories-next" } + # cargo believes the following are in-tree despite no features activating them # We provide empty crates to not only prove they're unused, yet also clean up # our Cargo.lock diff --git a/substrate/tree-cleanup/directories-next/Cargo.toml b/substrate/tree-cleanup/directories-next/Cargo.toml new file mode 100644 index 00000000..f7d73383 --- /dev/null +++ b/substrate/tree-cleanup/directories-next/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "directories-next" +version = "2.0.0" +description = "Patch from directories-next back to directories" +license = "MIT" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tree-cleanup/directories-next" +authors = ["Luke Parker "] +keywords = [] +edition = "2021" +rust-version = "1.74" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[dependencies] +directories = "5" diff --git a/substrate/tree-cleanup/directories-next/src/lib.rs b/substrate/tree-cleanup/directories-next/src/lib.rs new file mode 100644 index 00000000..fb4871e6 --- /dev/null +++ b/substrate/tree-cleanup/directories-next/src/lib.rs @@ -0,0 +1 @@ +pub use directories::*; diff --git a/substrate/tree-cleanup/option-ext/Cargo.toml b/substrate/tree-cleanup/option-ext/Cargo.toml new file mode 100644 index 00000000..6940b967 --- /dev/null +++ b/substrate/tree-cleanup/option-ext/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "option-ext" +version = "0.2.0" +description = "Non-MPL option-ext with the exactly needed API for directories" +license = "MIT" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tree-cleanup/option-ext" +authors = ["Luke Parker "] +keywords = [] +edition = "2021" +rust-version = "1.74" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] diff --git a/substrate/tree-cleanup/option-ext/src/lib.rs b/substrate/tree-cleanup/option-ext/src/lib.rs new file mode 100644 index 00000000..b075111c --- /dev/null +++ b/substrate/tree-cleanup/option-ext/src/lib.rs @@ -0,0 +1,8 @@ +pub trait OptionExt { + fn contains(&self, x: &T) -> bool; +} +impl OptionExt for Option { + fn contains(&self, x: &T) -> bool { + self.as_ref() == Some(x) + } +}