Skip to content

Commit

Permalink
Add required-features to SerializedTarget
Browse files Browse the repository at this point in the history
This will add it to `cargo metadata` output and will make it
possible to enable features needed to build specific target.
  • Loading branch information
little-arhat committed Aug 17, 2018
1 parent 8b6f710 commit 349d264
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(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 349d264

Please sign in to comment.