mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Auto merge of #12997 - hi-rustin:rustin-patch-cargo-test-support, r=epage
cargo-test-support: Add features to the default Cargo.toml file
This commit is contained in:
commit
65d0eb536d
@ -1523,6 +1523,30 @@ impl Package {
|
||||
manifest.push_str(&format!("rust-version = \"{}\"", version));
|
||||
}
|
||||
|
||||
if !self.features.is_empty() {
|
||||
let features: Vec<String> = self
|
||||
.features
|
||||
.iter()
|
||||
.map(|(feature, features)| {
|
||||
if features.is_empty() {
|
||||
format!("{} = []", feature)
|
||||
} else {
|
||||
format!(
|
||||
"{} = [{}]",
|
||||
feature,
|
||||
features
|
||||
.iter()
|
||||
.map(|s| format!("\"{}\"", s))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
manifest.push_str(&format!("\n[features]\n{}", features.join("\n")));
|
||||
}
|
||||
|
||||
for dep in self.deps.iter() {
|
||||
let target = match dep.target {
|
||||
None => String::new(),
|
||||
@ -1540,6 +1564,9 @@ impl Package {
|
||||
"#,
|
||||
target, kind, dep.name, dep.vers
|
||||
));
|
||||
if dep.optional {
|
||||
manifest.push_str("optional = true\n");
|
||||
}
|
||||
if let Some(artifact) = &dep.artifact {
|
||||
manifest.push_str(&format!("artifact = \"{}\"\n", artifact));
|
||||
}
|
||||
|
@ -43,13 +43,13 @@ checksum = "31162e7d23a085553c42dee375787b451a481275473f7779c4a63bcc267a24fd"
|
||||
name = "semver"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3031434e07edc922bf1b8262f075fac1522694f17b1ee7ad314c4cabd5d2723f"
|
||||
checksum = "106bee742e3199d9e59f4269e458dfc825c1b4648c483b1c2b7a45cd2610a308"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75d9264696ebbf5315a6b068e9910c4df9274365afac2d88abf66525df660218"
|
||||
checksum = "be7d269f612a60e3c2c4a4a120e2d878a3f3298a5285eda6e95453905a107d9a"
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
|
@ -36,13 +36,13 @@ checksum = "84949cb53285a6c481d0133065a7b669871acfd9e20f273f4ce1283c309775d5"
|
||||
name = "semver"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3031434e07edc922bf1b8262f075fac1522694f17b1ee7ad314c4cabd5d2723f"
|
||||
checksum = "106bee742e3199d9e59f4269e458dfc825c1b4648c483b1c2b7a45cd2610a308"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75d9264696ebbf5315a6b068e9910c4df9274365afac2d88abf66525df660218"
|
||||
checksum = "be7d269f612a60e3c2c4a4a120e2d878a3f3298a5285eda6e95453905a107d9a"
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
|
Loading…
x
Reference in New Issue
Block a user