Skip to content

Commit

Permalink
fix(cli): add MaybeWorkspace to license field (#8672)
Browse files Browse the repository at this point in the history
* Add MaybeWorkspace to license field

* Fix last changes

* Fix formatting

* Add change .MD file
  • Loading branch information
Andreybest authored Jan 26, 2024
1 parent d70470f commit 9cb9aa7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changes/cli-license-field-workspace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---

Allow license field in Cargo.toml to be `{ workspace = true }`
14 changes: 12 additions & 2 deletions tooling/cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ struct WorkspacePackageSettings {
description: Option<String>,
homepage: Option<String>,
version: Option<String>,
license: Option<String>,
}

#[derive(Clone, Debug, Deserialize)]
Expand All @@ -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>,
}
Expand Down Expand Up @@ -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(),
};

Expand Down

0 comments on commit 9cb9aa7

Please sign in to comment.