diff --git a/crates/cargo-util-schemas/src/manifest/mod.rs b/crates/cargo-util-schemas/src/manifest/mod.rs index 13bab7b93..4c497bfa7 100644 --- a/crates/cargo-util-schemas/src/manifest/mod.rs +++ b/crates/cargo-util-schemas/src/manifest/mod.rs @@ -245,6 +245,10 @@ impl TomlPackage { pub fn resolved_license(&self) -> Result, UnresolvedError> { self.license.as_ref().map(|v| v.resolved()).transpose() } + + pub fn resolved_license_file(&self) -> Result, UnresolvedError> { + self.license_file.as_ref().map(|v| v.resolved()).transpose() + } } /// An enum that allows for inheriting keys from a workspace in a Cargo.toml. diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index cd4204fc7..ff3c80042 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -608,6 +608,16 @@ pub fn to_real_manifest( .map(|value| field_inherit_with(value, "license", || inherit()?.license())) .transpose()? .map(manifest::InheritableField::Value); + package.license_file = package + .license_file + .clone() + .map(|value| { + field_inherit_with(value, "license-file", || { + inherit()?.license_file(package_root) + }) + }) + .transpose()? + .map(manifest::InheritableField::Value); let rust_version = package .resolved_rust_version() @@ -934,10 +944,9 @@ pub fn to_real_manifest( .expect("previously resolved") .cloned(), license_file: package - .license_file - .clone() - .map(|mw| field_inherit_with(mw, "license", || inherit()?.license_file(package_root))) - .transpose()?, + .resolved_license_file() + .expect("previously resolved") + .cloned(), repository: package .repository .clone() @@ -966,10 +975,6 @@ pub fn to_real_manifest( .authors .as_ref() .map(|_| manifest::InheritableField::Value(metadata.authors.clone())); - package.license_file = metadata - .license_file - .clone() - .map(|license_file| manifest::InheritableField::Value(license_file)); package.repository = metadata .repository .clone()