Skip to content

Commit 414619c

Browse files
authored
feat: add bundleName field to schema and MacConfig (#13110) (#13536)
1 parent 25757fe commit 414619c

File tree

8 files changed

+54
-3
lines changed

8 files changed

+54
-3
lines changed

.changes/bundler-bundleName.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"tauri-bundler": "minor:feat"
3+
"tauri-cli": "minor:feat"
4+
"tauri-codegen": "minor:feat"
5+
"tauri-utils": "minor:feat"
6+
"@tauri-apps/cli": "minor:feat"
7+
---
8+
9+
Added support for the `bundleName` property in the macOS bundler configuration. This allows specifying the `CFBundleName` value for generated macOS bundles.

crates/tauri-bundler/src/bundle/macos/app.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,15 @@ fn create_info_plist(
214214
settings.bundle_identifier().into(),
215215
);
216216
plist.insert("CFBundleInfoDictionaryVersion".into(), "6.0".into());
217-
plist.insert("CFBundleName".into(), settings.product_name().into());
217+
if let Some(bundle_name) = settings
218+
.macos()
219+
.bundle_name
220+
.as_deref()
221+
.unwrap_or_else(|| settings.product_name())
222+
.into()
223+
{
224+
plist.insert("CFBundleName".into(), bundle_name.into());
225+
}
218226
plist.insert("CFBundlePackageType".into(), "APPL".into());
219227
plist.insert(
220228
"CFBundleShortVersionString".into(),

crates/tauri-bundler/src/bundle/settings.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ pub struct MacOsSettings {
333333
pub files: HashMap<PathBuf, PathBuf>,
334334
/// The version of the build that identifies an iteration of the bundle.
335335
pub bundle_version: Option<String>,
336+
/// The name of the build that identifies a string of the bundle.
337+
///
338+
/// If not set, defaults to the package's product name.
339+
pub bundle_name: Option<String>,
336340
/// A version string indicating the minimum MacOS version that the bundled app supports (e.g. `"10.11"`).
337341
/// If you are using this config field, you may also want have your `build.rs` script emit `cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.11`.
338342
pub minimum_system_version: Option<String>,

crates/tauri-cli/config.schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,6 +3413,13 @@
34133413
"null"
34143414
]
34153415
},
3416+
"bundleName": {
3417+
"description": "The name of the builder that built the bundle.\n\n Translates to the bundle's CFBundleName property.\n\n If not set, defaults to the package's product name.",
3418+
"type": [
3419+
"string",
3420+
"null"
3421+
]
3422+
},
34163423
"minimumSystemVersion": {
34173424
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n An empty string is considered an invalid value so the default value is used.",
34183425
"default": "10.13",

crates/tauri-cli/src/interface/rust.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,7 @@ fn tauri_config_to_bundle_settings(
14381438
frameworks: config.macos.frameworks,
14391439
files: config.macos.files,
14401440
bundle_version: config.macos.bundle_version,
1441+
bundle_name: config.macos.bundle_name,
14411442
minimum_system_version: config.macos.minimum_system_version,
14421443
exception_domain: config.macos.exception_domain,
14431444
signing_identity,

crates/tauri-codegen/src/context.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,16 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult<TokenStream> {
309309
};
310310

311311
if let Some(plist) = info_plist.as_dictionary_mut() {
312-
if let Some(product_name) = &config.product_name {
313-
plist.insert("CFBundleName".into(), product_name.clone().into());
312+
if let Some(bundle_name) = config
313+
.bundle
314+
.macos
315+
.bundle_name
316+
.as_ref()
317+
.or(config.product_name.as_ref())
318+
{
319+
plist.insert("CFBundleName".into(), bundle_name.as_str().into());
314320
}
321+
315322
if let Some(version) = &config.version {
316323
let bundle_version = &config.bundle.macos.bundle_version;
317324
plist.insert("CFBundleShortVersionString".into(), version.clone().into());

crates/tauri-schema-generator/schemas/config.schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,6 +3413,13 @@
34133413
"null"
34143414
]
34153415
},
3416+
"bundleName": {
3417+
"description": "The name of the builder that built the bundle.\n\n Translates to the bundle's CFBundleName property.\n\n If not set, defaults to the package's product name.",
3418+
"type": [
3419+
"string",
3420+
"null"
3421+
]
3422+
},
34163423
"minimumSystemVersion": {
34173424
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n An empty string is considered an invalid value so the default value is used.",
34183425
"default": "10.13",

crates/tauri-utils/src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,13 @@ pub struct MacConfig {
617617
/// Translates to the bundle's CFBundleVersion property.
618618
#[serde(alias = "bundle-version")]
619619
pub bundle_version: Option<String>,
620+
/// The name of the builder that built the bundle.
621+
///
622+
/// Translates to the bundle's CFBundleName property.
623+
///
624+
/// If not set, defaults to the package's product name.
625+
#[serde(alias = "bundle-name")]
626+
pub bundle_name: Option<String>,
620627
/// A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.
621628
///
622629
/// Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`
@@ -655,6 +662,7 @@ impl Default for MacConfig {
655662
frameworks: None,
656663
files: HashMap::new(),
657664
bundle_version: None,
665+
bundle_name: None,
658666
minimum_system_version: macos_minimum_system_version(),
659667
exception_domain: None,
660668
signing_identity: None,

0 commit comments

Comments
 (0)