fix(cli): add MaybeWorkspace to license field (#8672)

* Add MaybeWorkspace to license field

* Fix last changes

* Fix formatting

* Add change .MD file
This commit is contained in:
Andrew
2024-01-26 23:46:51 +01:00
committed by GitHub
parent d70470f868
commit 9cb9aa7978
2 changed files with 18 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---
Allow license field in Cargo.toml to be `{ workspace = true }`

View File

@@ -612,6 +612,7 @@ struct WorkspacePackageSettings {
description: Option<String>,
homepage: Option<String>,
version: Option<String>,
license: Option<String>,
}
#[derive(Clone, Debug, Deserialize)]
@@ -635,7 +636,7 @@ pub struct CargoPackageSettings {
/// the package's authors.
pub authors: Option<MaybeWorkspace<Vec<String>>>,
/// the package's license.
pub license: Option<String>,
pub license: Option<MaybeWorkspace<String>>,
/// the default binary to run.
pub default_run: Option<String>,
}
@@ -930,7 +931,16 @@ impl RustAppSettings {
})
.unwrap()
}),
license: cargo_package_settings.license.clone(),
license: cargo_package_settings.license.clone().map(|license| {
license
.resolve("license", || {
ws_package_settings
.as_ref()
.and_then(|v| v.license.clone())
.ok_or_else(|| anyhow::anyhow!("Couldn't inherit value for `license` from workspace"))
})
.unwrap()
}),
default_run: cargo_package_settings.default_run.clone(),
};