mirror of
https://github.com/rust-lang/cargo
synced 2024-08-28 03:39:31 +00:00
refactor(toml): Rely on resolved include/exclude
This commit is contained in:
parent
00ba5780e4
commit
20302b34b7
|
@ -211,6 +211,14 @@ impl TomlPackage {
|
||||||
self.authors.as_ref().map(|v| v.resolved()).transpose()
|
self.authors.as_ref().map(|v| v.resolved()).transpose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn resolved_exclude(&self) -> Result<Option<&Vec<String>>, UnresolvedError> {
|
||||||
|
self.exclude.as_ref().map(|v| v.resolved()).transpose()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn resolved_include(&self) -> Result<Option<&Vec<String>>, UnresolvedError> {
|
||||||
|
self.include.as_ref().map(|v| v.resolved()).transpose()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn resolved_description(&self) -> Result<Option<&String>, UnresolvedError> {
|
pub fn resolved_description(&self) -> Result<Option<&String>, UnresolvedError> {
|
||||||
self.description.as_ref().map(|v| v.resolved()).transpose()
|
self.description.as_ref().map(|v| v.resolved()).transpose()
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,6 +568,18 @@ pub fn to_real_manifest(
|
||||||
.map(|value| field_inherit_with(value, "authors", || inherit()?.authors()))
|
.map(|value| field_inherit_with(value, "authors", || inherit()?.authors()))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.map(manifest::InheritableField::Value);
|
.map(manifest::InheritableField::Value);
|
||||||
|
package.exclude = package
|
||||||
|
.exclude
|
||||||
|
.clone()
|
||||||
|
.map(|value| field_inherit_with(value, "exclude", || inherit()?.exclude()))
|
||||||
|
.transpose()?
|
||||||
|
.map(manifest::InheritableField::Value);
|
||||||
|
package.include = package
|
||||||
|
.include
|
||||||
|
.clone()
|
||||||
|
.map(|value| field_inherit_with(value, "include", || inherit()?.include()))
|
||||||
|
.transpose()?
|
||||||
|
.map(manifest::InheritableField::Value);
|
||||||
package.description = package
|
package.description = package
|
||||||
.description
|
.description
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -915,19 +927,6 @@ pub fn to_real_manifest(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let exclude = package
|
|
||||||
.exclude
|
|
||||||
.clone()
|
|
||||||
.map(|mw| field_inherit_with(mw, "exclude", || inherit()?.exclude()))
|
|
||||||
.transpose()?
|
|
||||||
.unwrap_or_default();
|
|
||||||
let include = package
|
|
||||||
.include
|
|
||||||
.clone()
|
|
||||||
.map(|mw| field_inherit_with(mw, "include", || inherit()?.include()))
|
|
||||||
.transpose()?
|
|
||||||
.unwrap_or_default();
|
|
||||||
|
|
||||||
let metadata = ManifestMetadata {
|
let metadata = ManifestMetadata {
|
||||||
description: package
|
description: package
|
||||||
.resolved_description()
|
.resolved_description()
|
||||||
|
@ -981,14 +980,6 @@ pub fn to_real_manifest(
|
||||||
links: package.links.clone(),
|
links: package.links.clone(),
|
||||||
rust_version: rust_version.clone(),
|
rust_version: rust_version.clone(),
|
||||||
};
|
};
|
||||||
package.exclude = package
|
|
||||||
.exclude
|
|
||||||
.as_ref()
|
|
||||||
.map(|_| manifest::InheritableField::Value(exclude.clone()));
|
|
||||||
package.include = package
|
|
||||||
.include
|
|
||||||
.as_ref()
|
|
||||||
.map(|_| manifest::InheritableField::Value(include.clone()));
|
|
||||||
|
|
||||||
if let Some(profiles) = &original_toml.profile {
|
if let Some(profiles) = &original_toml.profile {
|
||||||
let cli_unstable = gctx.cli_unstable();
|
let cli_unstable = gctx.cli_unstable();
|
||||||
|
@ -1073,6 +1064,16 @@ pub fn to_real_manifest(
|
||||||
.map(|t| CompileTarget::new(&*t))
|
.map(|t| CompileTarget::new(&*t))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.map(CompileKind::Target);
|
.map(CompileKind::Target);
|
||||||
|
let include = package
|
||||||
|
.resolved_include()
|
||||||
|
.expect("previously resolved")
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_default();
|
||||||
|
let exclude = package
|
||||||
|
.resolved_exclude()
|
||||||
|
.expect("previously resolved")
|
||||||
|
.cloned()
|
||||||
|
.unwrap_or_default();
|
||||||
let custom_metadata = package.metadata.clone();
|
let custom_metadata = package.metadata.clone();
|
||||||
let resolved_toml = manifest::TomlManifest {
|
let resolved_toml = manifest::TomlManifest {
|
||||||
cargo_features: original_toml.cargo_features.clone(),
|
cargo_features: original_toml.cargo_features.clone(),
|
||||||
|
|
Loading…
Reference in a new issue