-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add no_cargo feature to disable Cargo-env-var-dependent macros #786
Conversation
a.p.meta.author = Some(crate_authors!()); | ||
a.p.meta.version = Some(crate_version!()); | ||
a.p.meta.author = Some("Kevin K. <[email protected]>"); | ||
a.p.meta.version = Some("2.19.2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set these values to what they'd evaluate to anyway, BTW.
?r @kbknapp Paging @acmcarther, too, because he requested the feature |
Excellent! I hadn't thought of doing the reverse (the feature removes something), that's a mistake on my part. For the 3.x changes I'd still like to make this feature additive, but for now this works great. |
This is great! Yes, actually what I'd had in mind was something like this, but I figured I could wait for whatever form would be most appropriate for this project. Thanks @nabijaczleweli! |
@homu r+ |
📌 Commit 907bba5 has been approved by |
Add no_cargo feature to disable Cargo-env-var-dependent macros For example, given: ```toml clap = { path = "t:/clap-rs" } ``` The macros `crate_version!()` and `crate_authors!()` exist, so the crate compiles without errors: ``` Compiling https v0.2.0 (file:///P:/Rust/http) Finished debug [unoptimized + debuginfo] target(s) in 6.93 secs Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs [Finished in 7.5s] ``` But, adding the `no_cargo` feature: ```toml clap = { path = "t:/clap-rs", features = ["no_cargo"] } ``` The macros are removed, so the crate fails to compile: ``` Compiling clap v2.19.2 (file:///T:/clap-rs) Compiling https v0.2.0 (file:///P:/Rust/http) error: macro undefined: 'crate_version!' --> src\options.rs:40:22 | 40 | .version(crate_version!()) | ^^^^^^^^^^^^^ error: macro undefined: 'crate_authors!' --> src\options.rs:41:21 | 41 | .author(crate_authors!()) | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors error: Could not compile `https`. ``` Closes #783
Add no_cargo feature to disable Cargo-env-var-dependent macros For example, given: ```toml clap = { path = "t:/clap-rs" } ``` The macros `crate_version!()` and `crate_authors!()` exist, so the crate compiles without errors: ``` Compiling https v0.2.0 (file:///P:/Rust/http) Finished debug [unoptimized + debuginfo] target(s) in 6.93 secs Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs [Finished in 7.5s] ``` But, adding the `no_cargo` feature: ```toml clap = { path = "t:/clap-rs", features = ["no_cargo"] } ``` The macros are removed, so the crate fails to compile: ``` Compiling clap v2.19.2 (file:///T:/clap-rs) Compiling https v0.2.0 (file:///P:/Rust/http) error: macro undefined: 'crate_version!' --> src\options.rs:40:22 | 40 | .version(crate_version!()) | ^^^^^^^^^^^^^ error: macro undefined: 'crate_authors!' --> src\options.rs:41:21 | 41 | .author(crate_authors!()) | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors error: Could not compile `https`. ``` Closes #783
☀️ Test successful - status |
👀 Test was successful, but fast-forwarding failed: 422 Required status check "coverage/coveralls" is pending. |
For example, given:
The macros
crate_version!()
andcrate_authors!()
exist, so the crate compiles without errors:But, adding the
no_cargo
feature:The macros are removed, so the crate fails to compile:
Closes #783