Skip to content

Commit

Permalink
Auto merge of #5902 - little-arhat:feature-add-required-features-to-m…
Browse files Browse the repository at this point in the history
…etadata-output, r=alexcrichton

Add `required-features` to `SerializedTarget`

This will add it to `cargo metadata` output and will make it
possible to enable features needed to build specific target.
  • Loading branch information
bors committed Aug 21, 2018
2 parents 7ff1bdb + 9c38505 commit c0ec76f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ struct SerializedTarget<'a> {
name: &'a str,
src_path: &'a PathBuf,
edition: &'a str,
#[serde(rename = "required-features", skip_serializing_if = "Option::is_none")]
required_features: Option<Vec<&'a str>>,
}

impl ser::Serialize for Target {
Expand All @@ -238,7 +240,11 @@ impl ser::Serialize for Target {
crate_types: self.rustc_crate_types(),
name: &self.name,
src_path: &self.src_path.path,
edition: &self.edition.to_string()
edition: &self.edition.to_string(),
required_features: self
.required_features
.as_ref()
.map(|rf| rf.iter().map(|s| &**s).collect()),
}.serialize(s)
}
}
Expand Down

0 comments on commit c0ec76f

Please sign in to comment.