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

Split crate into a proc-macro and a regular library crate #214

Merged
merged 11 commits into from
Nov 14, 2022
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ To produce a new release of the `derive_more` crate, perform the following steps

1. Complete the existing [CHANGELOG] or fill up a new one for the new version.
2. Update [README] installation instructions with the new version.
3. Run `cargo release patch` (or `minor`/`major`).
3. Run `cargo release patch --workspace` (or `minor`/`major`).
4. Wait for the CI pipeline to complete successfully, and the [GitHub release] being created.


Expand Down
59 changes: 27 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,23 @@ categories = ["development-tools", "development-tools::procedural-macro-helpers"

include = [
"src/**/*.rs",
"doc/**/*.md",
"Cargo.toml",
"LICENSE",
"README.md",
"CHANGELOG.md",
"tests/**/*.rs", # debian packaging wants this
]

[lib]
name = "derive_more"
proc-macro = true

[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
syn = "1.0.81"
convert_case = { version = "0.6", optional = true }
unicode-xid = { version = "0.2.2", optional = true }
derive_more-impl = { version = "=0.99.17", path = "impl" }

[build-dependencies]
rustc_version = { version = "0.4", optional = true }

[workspace]
members = ["impl"]

[dev-dependencies]
rustversion = "1.0"
trybuild = "1.0.56"
Expand All @@ -48,30 +43,30 @@ github = { repository = "JelteF/derive_more", workflow = "CI" }
rustdoc-args = ["--cfg", "docsrs"]

[features]
add_assign = []
add = []
as_mut = []
as_ref = []
constructor = []
deref = []
deref_mut = []
display = ["syn/extra-traits", "unicode-xid"]
error = ["syn/extra-traits"]
from = ["syn/extra-traits"]
from_str = ["convert_case"]
index = []
index_mut = []
into = ["syn/extra-traits"]
into_iterator = []
iterator = []
mul_assign = ["syn/extra-traits"]
mul = ["syn/extra-traits"]
not = ["syn/extra-traits"]
sum = []
try_into = ["syn/extra-traits"]
add_assign = ["derive_more-impl/add_assign"]
add = ["derive_more-impl/add"]
as_mut = ["derive_more-impl/as_mut"]
as_ref = ["derive_more-impl/as_ref"]
constructor = ["derive_more-impl/constructor"]
deref = ["derive_more-impl/deref"]
deref_mut = ["derive_more-impl/deref_mut"]
display = ["derive_more-impl/display"]
error = ["derive_more-impl/error"]
from = ["derive_more-impl/from"]
from_str = ["derive_more-impl/from_str"]
index = ["derive_more-impl/index"]
index_mut = ["derive_more-impl/index_mut"]
into = ["derive_more-impl/into"]
into_iterator = ["derive_more-impl/into_iterator"]
iterator = ["derive_more-impl/iterator"]
mul_assign = ["derive_more-impl/mul_assign"]
mul = ["derive_more-impl/mul"]
not = ["derive_more-impl/not"]
sum = ["derive_more-impl/sum"]
try_into = ["derive_more-impl/try_into"]
testing-helpers = ["rustc_version"]
is_variant = ["convert_case"]
unwrap = ["convert_case", "rustc_version"]
is_variant = ["derive_more-impl/is_variant"]
unwrap = ["derive_more-impl/unwrap"]

default = [
"add_assign",
Expand Down
67 changes: 67 additions & 0 deletions impl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[package]
name = "derive_more-impl"
version = "0.99.17"
edition = "2021"
rust-version = "1.56.0"
description = "Adds #[derive(x)] macros for more traits"
authors = ["Jelte Fennema <github-tech@jeltef.nl>"]
license = "MIT"
repository = "https://github.com/JelteF/derive_more"
documentation = "https://docs.rs/derive_more"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentionally not https://docs.rs/derive_more-impl?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes


# explicitly no keywords or categories so it cannot be found easily

include = [
"src/**/*.rs",
"doc/**/*.md",
"Cargo.toml",
"LICENSE",
]

[lib]
proc-macro = true

[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
syn = "1.0.81"
convert_case = { version = "0.6", optional = true }
unicode-xid = { version = "0.2.2", optional = true }

[build-dependencies]
rustc_version = { version = "0.4", optional = true }

[dev-dependencies]
rustversion = "1.0"
trybuild = "1.0.56"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that we don't need this in the -impl crate, as the test lay in the main crate.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh... we still do need rustc_version due to #[cfg(nightly)] in error.md examples.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected tests and their features in fd90267.


[badges]
github = { repository = "JelteF/derive_more", workflow = "CI" }

[features]
add_assign = []
add = []
as_mut = []
as_ref = []
constructor = []
deref = []
deref_mut = []
display = ["syn/extra-traits", "unicode-xid"]
error = ["syn/extra-traits"]
from = ["syn/extra-traits"]
from_str = ["convert_case"]
index = []
index_mut = []
into = ["syn/extra-traits"]
into_iterator = []
iterator = []
mul_assign = ["syn/extra-traits"]
mul = ["syn/extra-traits"]
not = ["syn/extra-traits"]
sum = []
try_into = ["syn/extra-traits"]
testing-helpers = ["rustc_version"]
is_variant = ["convert_case"]
unwrap = ["convert_case", "rustc_version"]

default = []
1 change: 1 addition & 0 deletions impl/LICENSE
12 changes: 12 additions & 0 deletions impl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `derive_more-impl`

This crate is an implementation detail of the [`derive_more`][crates.io]. If you
found this crate by accident you're probably looking for one of the following
pages of `derive_more`:
1. [crates.io]
2. [docs.rs][docs]
3. [GitHub][github]

[crates.io]: https://crates.io/crates/derive_more
[docs.rs]: https://docs.rs/derive_more/latest/derive_more/
[GitHub]: https://github.com/JelteF/derive_more
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading