Skip to content

Commit 628285c

Browse files
feat(bundler): add publisher field, closes #5273 (#5283)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent 54c337e commit 628285c

File tree

6 files changed

+33
-1
lines changed

6 files changed

+33
-1
lines changed

.changes/publisher-field.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"tauri-utils": "minor"
3+
"tauri-bundler": "minor"
4+
"cli.rs": "minor"
5+
---
6+
7+
Add `tauri.conf.json > bundle > publisher` field to specify the app publisher.
8+

core/tauri-utils/src/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ pub struct BundleConfig {
549549
/// This string must contain only alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-),
550550
/// and periods (.).
551551
pub identifier: String,
552+
/// The application's publisher. Defaults to the second element in the identifier string.
553+
/// Currently maps to the Manufacturer property of the Windows Installer.
554+
pub publisher: Option<String>,
552555
/// The app's icons
553556
#[serde(default)]
554557
pub icon: Vec<String>,
@@ -3128,6 +3131,7 @@ mod build {
31283131
impl ToTokens for BundleConfig {
31293132
fn to_tokens(&self, tokens: &mut TokenStream) {
31303133
let identifier = str_lit(&self.identifier);
3134+
let publisher = quote!(None);
31313135
let icon = vec_lit(&self.icon, str_lit);
31323136
let active = self.active;
31333137
let targets = quote!(Default::default());
@@ -3147,6 +3151,7 @@ mod build {
31473151
BundleConfig,
31483152
active,
31493153
identifier,
3154+
publisher,
31503155
icon,
31513156
targets,
31523157
resources,
@@ -3560,6 +3565,7 @@ mod test {
35603565
active: false,
35613566
targets: Default::default(),
35623567
identifier: String::from(""),
3568+
publisher: None,
35633569
icon: Vec::new(),
35643570
resources: None,
35653571
copyright: None,

tooling/bundler/src/bundle/settings.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ impl Default for WindowsSettings {
295295
pub struct BundleSettings {
296296
/// the app's identifier.
297297
pub identifier: Option<String>,
298+
/// The app's publisher. Defaults to the second element in the identifier string.
299+
/// Currently maps to the Manufacturer property of the Windows Installer.
300+
pub publisher: Option<String>,
298301
/// the app's icon list.
299302
pub icon: Option<Vec<String>>,
300303
/// the app's resources to bundle.
@@ -610,6 +613,11 @@ impl Settings {
610613
self.bundle_settings.identifier.as_deref().unwrap_or("")
611614
}
612615

616+
/// Returns the bundle's identifier
617+
pub fn publisher(&self) -> Option<&str> {
618+
self.bundle_settings.publisher.as_deref()
619+
}
620+
613621
/// Returns an iterator over the icon files to be used for this bundle.
614622
pub fn icon_files(&self) -> ResourcePaths<'_> {
615623
match self.bundle_settings.icon {

tooling/bundler/src/bundle/windows/msi/wix.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ pub fn build_wix_app_installer(
594594
data.insert("product_name", to_json(settings.product_name()));
595595
data.insert("version", to_json(settings.version_string()));
596596
let bundle_id = settings.bundle_identifier();
597-
let manufacturer = bundle_id.split('.').nth(1).unwrap_or(bundle_id);
597+
let manufacturer = settings
598+
.publisher()
599+
.unwrap_or_else(|| bundle_id.split('.').nth(1).unwrap_or(bundle_id));
598600
data.insert("bundle_id", to_json(bundle_id));
599601
data.insert("manufacturer", to_json(manufacturer));
600602
let upgrade_code = Uuid::new_v5(

tooling/cli/schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,13 @@
934934
"description": "The application identifier in reverse domain name notation (e.g. `com.tauri.example`). This string must be unique across applications since it is used in system configurations like the bundle ID and path to the webview data directory. This string must contain only alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-), and periods (.).",
935935
"type": "string"
936936
},
937+
"publisher": {
938+
"description": "The application's publisher. Defaults to the second element in the identifier string. Currently maps to the Manufacturer property of the Windows Installer.",
939+
"type": [
940+
"string",
941+
"null"
942+
]
943+
},
937944
"icon": {
938945
"description": "The app's icons",
939946
"default": [],

tooling/cli/src/interface/rust.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ fn tauri_config_to_bundle_settings(
765765

766766
Ok(BundleSettings {
767767
identifier: Some(config.identifier),
768+
publisher: config.publisher,
768769
icon: Some(config.icon),
769770
resources: if resources.is_empty() {
770771
None

0 commit comments

Comments
 (0)