Skip to content

Commit 9cb9aa7

Browse files
authored
fix(cli): add MaybeWorkspace to license field (#8672)
* Add MaybeWorkspace to license field * Fix last changes * Fix formatting * Add change .MD file
1 parent d70470f commit 9cb9aa7

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:bug
3+
"@tauri-apps/cli": patch:bug
4+
---
5+
6+
Allow license field in Cargo.toml to be `{ workspace = true }`

tooling/cli/src/interface/rust.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ struct WorkspacePackageSettings {
612612
description: Option<String>,
613613
homepage: Option<String>,
614614
version: Option<String>,
615+
license: Option<String>,
615616
}
616617

617618
#[derive(Clone, Debug, Deserialize)]
@@ -635,7 +636,7 @@ pub struct CargoPackageSettings {
635636
/// the package's authors.
636637
pub authors: Option<MaybeWorkspace<Vec<String>>>,
637638
/// the package's license.
638-
pub license: Option<String>,
639+
pub license: Option<MaybeWorkspace<String>>,
639640
/// the default binary to run.
640641
pub default_run: Option<String>,
641642
}
@@ -930,7 +931,16 @@ impl RustAppSettings {
930931
})
931932
.unwrap()
932933
}),
933-
license: cargo_package_settings.license.clone(),
934+
license: cargo_package_settings.license.clone().map(|license| {
935+
license
936+
.resolve("license", || {
937+
ws_package_settings
938+
.as_ref()
939+
.and_then(|v| v.license.clone())
940+
.ok_or_else(|| anyhow::anyhow!("Couldn't inherit value for `license` from workspace"))
941+
})
942+
.unwrap()
943+
}),
934944
default_run: cargo_package_settings.default_run.clone(),
935945
};
936946

0 commit comments

Comments
 (0)