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

Example workspace inheritance port #3719

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 29 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cargo-features = ["workspace-inheritance"]

[workspace]
members = [
"clap_derive",
Expand All @@ -7,9 +9,29 @@ members = [
"clap_mangen",
]

[workspace.package]
version = "3.1.18"
edition = "2018"
Copy link
Member

Choose a reason for hiding this comment

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

FYI While there are cases where people might want different editions in a workspace, I think its a good idea to generally consolidate and share it. Similar for rust- version.

include = [
"build.rs",
"src/**/*",
"Cargo.toml",
"LICENSE*",
"README.md",
"benches/**/*",
"examples/**/*"
]
license = "MIT OR Apache-2.0"

[workspace.dependencies]
os_str_bytes = { version = "6.0", default-features = false, features = ["raw_os_str"] }
Copy link
Member

@epage epage May 10, 2022

Choose a reason for hiding this comment

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

FYI os_str_bytes is needed to be shared because its a public dependency of clap_lex though clap_lex re-exports parts of it, so maybe we could pull this from clap depending on it?

shlex = "1.1.0"
snapbox = "0.2.9"
trycmd = { version = "0.13", default-features = false, features = ["color-auto", "diff", "examples"] }
Comment on lines +28 to +30
Copy link
Member

Choose a reason for hiding this comment

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

FYI these are shared to reduce duplicate dependencies


[package]
name = "clap"
version = "3.1.18"
version.workspace = true
description = "A simple to use, efficient, and full-featured Command Line Argument Parser"
repository = "https://github.com/clap-rs/clap"
documentation = "https://docs.rs/clap/"
Expand All @@ -21,18 +43,10 @@ keywords = [
"parser",
"parse"
]
edition = "2018"
license = "MIT OR Apache-2.0"
edition.workspace = true
license.workspace = true
readme = "README.md"
include = [
"build.rs",
"src/**/*",
"Cargo.toml",
"LICENSE*",
"README.md",
"benches/**/*",
"examples/**/*"
]
include.workspace = true

[package.metadata.docs.rs]
features = ["unstable-doc"]
Expand Down Expand Up @@ -141,10 +155,10 @@ criterion = "0.3.2"
trybuild = "1.0.18"
rustversion = "1"
# Cutting out `filesystem` feature
trycmd = { version = "0.13", default-features = false, features = ["color-auto", "diff", "examples"] }
trycmd.workspace = true
humantime = "2"
snapbox = "0.2.9"
shlex = "1.1.0"
snapbox.workspace = true
shlex.workspace = true

[[example]]
name = "demo"
Expand Down
24 changes: 9 additions & 15 deletions clap_complete/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
cargo-features = ["workspace-inheritance"]

[package]
name = "clap_complete"
version = "3.1.4"
edition = "2018"
include = [
"build.rs",
"src/**/*",
"Cargo.toml",
"LICENSE*",
"README.md",
"benches/**/*",
"examples/**/*"
]
edition.workspace = true
include.workspace = true
description = "Generate shell completion scripts for your clap::Command"
repository = "https://github.com/clap-rs/clap/tree/master/clap_complete"
documentation = "https://docs.rs/clap_complete"
Expand All @@ -21,7 +15,7 @@ keywords = [
"bash",
]
categories = ["command-line-interface"]
license = "MIT OR Apache-2.0"
license.workspace = true
readme = "README.md"

[package.metadata.release]
Expand All @@ -41,16 +35,16 @@ bench = false
clap = { path = "../", version = "3.1.10", default-features = false, features = ["std"] }
clap_lex = { path = "../clap_lex", version = "0.2.0", optional = true }
is_executable = { version = "1.0.1", optional = true }
os_str_bytes = { version = "6.0", default-features = false, features = ["raw_os_str"], optional = true }
os_str_bytes = { workspace = true, optional = true }
pathdiff = { version = "0.2.1", optional = true }
shlex = { version = "1.1.0", optional = true }
shlex = { workspace = true, optional = true }
unicode-xid = { version = "0.2.2", optional = true }

[dev-dependencies]
pretty_assertions = "1.0"
snapbox = { version = "0.2", features = ["diff"] }
snapbox = { workspace = true, features = ["diff"] }
# Cutting out `filesystem` feature
trycmd = { version = "0.13", default-features = false, features = ["color-auto", "diff", "examples"] }
trycmd.workspace = true
clap = { path = "../", version = "3.1.10", default-features = false, features = ["std", "derive"] }

[[example]]
Expand Down
15 changes: 6 additions & 9 deletions clap_complete_fig/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
cargo-features = ["workspace-inheritance"]

[package]
name = "clap_complete_fig"
version = "3.1.5"
edition = "2018"
include = [
"src/**/*",
"Cargo.toml",
"LICENSE-*",
"README.md"
]
edition.workspace = true
include.workspace = true
description = "A generator library used with clap for Fig completion scripts"
repository = "https://github.com/clap-rs/clap/tree/master/clap_complete_fig"
documentation = "https://docs.rs/clap_complete_fig"
Expand All @@ -19,7 +16,7 @@ keywords = [
"fig",
]
categories = ["command-line-interface"]
license = "MIT OR Apache-2.0"
license.workspace = true
readme = "README.md"

[package.metadata.docs.rs]
Expand All @@ -42,4 +39,4 @@ clap = { path = "../", version = "3.1.10", default-features = false, features =
clap_complete = { path = "../clap_complete", version = "3.1.2" }

[dev-dependencies]
snapbox = { version = "0.2", features = ["diff"] }
snapbox = { workspace = true, features = ["diff"] }
15 changes: 6 additions & 9 deletions clap_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
cargo-features = ["workspace-inheritance"]

[package]
name = "clap_derive"
version = "3.1.18"
edition = "2018"
include = [
"src/**/*",
"Cargo.toml",
"LICENSE-*",
"README.md"
]
Comment on lines -5 to -10
Copy link
Member

Choose a reason for hiding this comment

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

FYI Our includes are meant to be the same but have diverged over time. Now we'll be able to keep them the same!

version.workspace = true
Copy link
Member

Choose a reason for hiding this comment

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

FYI Before, we only could enforce clap and clap_derive shared a version via cargo-release but now we can do it here.

edition.workspace = true
include.workspace = true
description = "Parse command line argument by defining a struct, derive crate."
repository = "https://github.com/clap-rs/clap/tree/master/clap_derive"
documentation = "https://docs.rs/clap_derive"
Expand All @@ -19,7 +16,7 @@ keywords = [
"proc_macro"
]
categories = ["command-line-interface", "development-tools::procedural-macro-helpers"]
license = "MIT OR Apache-2.0"
license.workspace = true
readme = "README.md"

[package.metadata.release]
Expand Down
15 changes: 6 additions & 9 deletions clap_lex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
cargo-features = ["workspace-inheritance"]

[package]
name = "clap_lex"
version = "0.2.0"
edition = "2018"
include = [
"src/**/*",
"Cargo.toml",
"LICENSE-*",
"README.md"
]
edition.workspace = true
include.workspace = true
description = "Minimal, flexible command line parser"
repository = "https://github.com/clap-rs/clap/tree/master/clap_lex"
documentation = "https://docs.rs/clap_lex"
Expand All @@ -19,7 +16,7 @@ keywords = [
"parse"
]
categories = ["command-line-interface"]
license = "MIT OR Apache-2.0"
license.workspace = true
readme = "README.md"

[package.metadata.release]
Expand All @@ -36,4 +33,4 @@ pre-release-replacements = [
bench = false

[dependencies]
os_str_bytes = { version = "6.0", default-features = false, features = ["raw_os_str"] }
os_str_bytes.workspace = true
15 changes: 6 additions & 9 deletions clap_mangen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
cargo-features = ["workspace-inheritance"]

[package]
name = "clap_mangen"
version = "0.1.6"
edition = "2018"
include = [
"src/**/*",
"Cargo.toml",
"LICENSE-*",
"README.md"
]
edition.workspace = true
include.workspace = true
description = "A manpage generator for clap"
repository = "https://github.com/clap-rs/clap/tree/master/clap_mangen"
documentation = "https://docs.rs/clap_mangen"
Expand All @@ -18,7 +15,7 @@ keywords = [
"manpage",
]
categories = ["command-line-interface"]
license = "MIT OR Apache-2.0"
license.workspace = true
readme = "README.md"

[package.metadata.release]
Expand All @@ -39,7 +36,7 @@ roff = "0.2.1"
clap = { path = "../", version = "3.1.10", default-features = false, features = ["std", "env"] }

[dev-dependencies]
snapbox = { version = "0.2", features = ["diff"] }
snapbox = { workspace = true, features = ["diff"] }
Copy link
Member

Choose a reason for hiding this comment

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

How come diff isn't in the workspace?

Copy link
Author

Choose a reason for hiding this comment

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

Not every user of snapbox needs diff so I left it only in this spot

Copy link
Member

Choose a reason for hiding this comment

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

Thats a bug. diff improves the output of snapbox and we always want it.

clap = { path = "../", version = "3.1.10", default-features = false, features = ["std"] }

[features]
Expand Down