Skip to content

Commit

Permalink
Merge pull request #4791 from epage/builder
Browse files Browse the repository at this point in the history
refactor: Split out clap_builder for faster derive builds
  • Loading branch information
epage authored Mar 27, 2023
2 parents 615c1dc + 4e1a565 commit 9712987
Show file tree
Hide file tree
Showing 64 changed files with 890 additions and 304 deletions.
34 changes: 25 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 19 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"clap_bench",
"clap_builder",
"clap_derive",
"clap_lex",
"clap_complete",
Expand Down Expand Up @@ -70,45 +71,37 @@ default = [
"error-context",
"suggestions",
]
debug = ["clap_derive?/debug", "dep:backtrace"] # Enables debug messages
unstable-doc = ["derive", "cargo", "wrap_help", "env", "unicode", "string", "unstable-replace"] # for docs.rs
debug = ["clap_builder/debug", "clap_derive?/debug"] # Enables debug messages
unstable-doc = ["clap_builder/unstable-doc", "derive"] # for docs.rs

# Used in default
std = [] # support for no_std in a backwards-compatible way
color = ["dep:is-terminal", "dep:termcolor"]
help = []
usage = []
error-context = []
suggestions = ["dep:strsim", "error-context"]
std = ["clap_builder/std"] # support for no_std in a backwards-compatible way
color = ["clap_builder/color"]
help = ["clap_builder/help"]
usage = ["clap_builder/usage"]
error-context = ["clap_builder/error-context"]
suggestions = ["clap_builder/suggestions"]

# Optional
deprecated = ["clap_derive?/deprecated"] # Guided experience to prepare for next breaking release (at different stages of development, this may become default)
deprecated = ["clap_builder/deprecated", "clap_derive?/deprecated"] # Guided experience to prepare for next breaking release (at different stages of development, this may become default)
derive = ["dep:clap_derive", "dep:once_cell"]
cargo = ["dep:once_cell"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros
wrap_help = ["help", "dep:terminal_size"]
env = [] # Use environment variables during arg parsing
unicode = ["dep:unicode-width", "dep:unicase"] # Support for unicode characters in arguments and help messages
string = [] # Allow runtime generated strings
cargo = ["clap_builder/cargo"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros
wrap_help = ["clap_builder/wrap_help"]
env = ["clap_builder/env"] # Use environment variables during arg parsing
unicode = ["clap_builder/unicode"] # Support for unicode characters in arguments and help messages
string = ["clap_builder/string"] # Allow runtime generated strings

# In-work features
unstable-replace = []
unstable-grouped = []
unstable-v5 = ["clap_derive?/unstable-v5", "deprecated"]
unstable-replace = ["clap_builder/unstable-replace"]
unstable-grouped = ["clap_builder/unstable-grouped"]
unstable-v5 = ["clap_builder/unstable-v5", "clap_derive?/unstable-v5", "deprecated"]

[lib]
bench = false

[dependencies]
clap_builder = { path = "./clap_builder", version = "=4.1.13", default-features = false }
clap_derive = { path = "./clap_derive", version = "=4.1.12", optional = true }
clap_lex = { path = "./clap_lex", version = "0.3.0" }
bitflags = "1.2.0"
unicase = { version = "2.6.0", optional = true }
strsim = { version = "0.10.0", optional = true }
is-terminal = { version = "0.4.1", optional = true }
termcolor = { version = "1.1.1", optional = true }
terminal_size = { version = "0.2.1", optional = true }
backtrace = { version = "0.3.67", optional = true }
unicode-width = { version = "0.1.9", optional = true }
once_cell = { version = "1.12.0", optional = true }

[dev-dependencies]
Expand Down
3 changes: 3 additions & 0 deletions clap_builder/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# How to Contribute

See the [clap-wide CONTRIBUTING.md](../CONTRIBUTING.md). This will contain `clap_builder` specific notes.
89 changes: 89 additions & 0 deletions clap_builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[package]
name = "clap_builder"
version = "4.1.13"
description = "A simple to use, efficient, and full-featured Command Line Argument Parser"
repository = "https://github.com/clap-rs/clap"
categories = ["command-line-interface"]
keywords = [
"argument",
"cli",
"arg",
"parser",
"parse"
]
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true

[package.metadata.docs.rs]
features = ["unstable-doc"]
rustdoc-args = ["--cfg", "docsrs"]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]

[package.metadata.playground]
features = ["unstable-doc"]

[package.metadata.release]
shared-version = true
dependent-version = "upgrade"
tag-name = "v{{version}}"

[features]
default = [
"std",
"color",
"help",
"usage",
"error-context",
"suggestions",
]
debug = ["dep:backtrace"] # Enables debug messages
unstable-doc = ["cargo", "wrap_help", "env", "unicode", "string", "unstable-replace"] # for docs.rs

# Used in default
std = [] # support for no_std in a backwards-compatible way
color = ["dep:is-terminal", "dep:termcolor"]
help = []
usage = []
error-context = []
suggestions = ["dep:strsim", "error-context"]

# Optional
deprecated = [] # Guided experience to prepare for next breaking release (at different stages of development, this may become default)
cargo = ["dep:once_cell"] # Disable if you're not using Cargo, enables Cargo-env-var-dependent macros
wrap_help = ["help", "dep:terminal_size"]
env = [] # Use environment variables during arg parsing
unicode = ["dep:unicode-width", "dep:unicase"] # Support for unicode characters in arguments and help messages
string = [] # Allow runtime generated strings

# In-work features
unstable-replace = []
unstable-grouped = []
unstable-v5 = ["deprecated"]

[lib]
bench = false

[dependencies]
clap_lex = { path = "../clap_lex", version = "0.3.0" }
bitflags = "1.2.0"
unicase = { version = "2.6.0", optional = true }
strsim = { version = "0.10.0", optional = true }
is-terminal = { version = "0.4.1", optional = true }
termcolor = { version = "1.1.1", optional = true }
terminal_size = { version = "0.2.1", optional = true }
backtrace = { version = "0.3.67", optional = true }
unicode-width = { version = "0.1.9", optional = true }
once_cell = { version = "1.12.0", optional = true }

[dev-dependencies]
trybuild = "1.0.77"
rustversion = "1.0.12"
# Cutting out `filesystem` feature
trycmd = { version = "0.14.15", default-features = false, features = ["color-auto", "diff", "examples"] }
humantime = "2.1.0"
snapbox = "0.4.10"
shlex = "1.1.0"
static_assertions = "1.1.0"
unic-emoji-char = "0.9.0"
Loading

0 comments on commit 9712987

Please sign in to comment.