-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of #712 : alexcrichton/cargo/issue-633, r=brson
As pointed in #633, it's currently not possible for a package to reexport the feature of another package due to the limitations of how features are defined. This commit adds support for this ability by allowing features of the form `foo/bar` in the `features` section of the manifest. This form indicates that the dependency `foo` should have its `bar` feature enabled. Additionally, it is not required that `foo` is an optional dependency. This does not allow features of the form `foo/bar` in a `[dependencies]` features section as dependencies shouldn't be enabling features for other dependencies. At the same time, this passes through features to build commands to solve a few more issues. Closes #97 Closes #601 (this is an equivalent solution for that problem) Closes #633 Closes #674
- Loading branch information
Showing
8 changed files
with
282 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -745,6 +745,9 @@ test!(custom_build_env_vars { | |
version = "0.5.0" | ||
authors = ["[email protected]"] | ||
[features] | ||
foo = [] | ||
[[bin]] | ||
name = "foo" | ||
"#) | ||
|
@@ -753,6 +756,7 @@ test!(custom_build_env_vars { | |
use std::io::fs::PathExtensions; | ||
fn main() {{ | ||
let _ncpus = os::getenv("NUM_JOBS").unwrap(); | ||
let _feat = os::getenv("CARGO_FEATURE_FOO").unwrap(); | ||
let debug = os::getenv("DEBUG").unwrap(); | ||
assert_eq!(debug.as_slice(), "true"); | ||
|
@@ -777,7 +781,8 @@ test!(custom_build_env_vars { | |
}} | ||
"#, | ||
p.root().join("target").join("native").display())); | ||
assert_that(build.cargo_process("build"), execs().with_status(0)); | ||
assert_that(build.cargo_process("build").arg("--features").arg("foo"), | ||
execs().with_status(0)); | ||
|
||
|
||
p = p | ||
|
@@ -789,6 +794,9 @@ test!(custom_build_env_vars { | |
authors = ["[email protected]"] | ||
build = '{}' | ||
[features] | ||
foo = [] | ||
[[bin]] | ||
name = "foo" | ||
|
@@ -798,7 +806,8 @@ test!(custom_build_env_vars { | |
.file("src/foo.rs", r#" | ||
fn main() {} | ||
"#); | ||
assert_that(p.cargo_process("build"), execs().with_status(0)); | ||
assert_that(p.cargo_process("build").arg("--features").arg("foo"), | ||
execs().with_status(0)); | ||
}) | ||
|
||
test!(crate_version_env_vars { | ||
|
Oops, something went wrong.