Skip to content

feat: add bundleName field to schema and MacConfig (#13110) #13536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changes/bundler-bundleName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"tauri-bundler": "minor:feat"
"tauri-cli": "minor:feat"
"tauri-codegen": "minor:feat"
"tauri-utils": "minor:feat"
"@tauri-apps/cli": "minor:feat"
---

Added support for the `bundleName` property in the macOS bundler configuration. This allows specifying the `CFBundleName` value for generated macOS bundles.
9 changes: 8 additions & 1 deletion crates/tauri-bundler/src/bundle/macos/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,14 @@ fn create_info_plist(
settings.bundle_identifier().into(),
);
plist.insert("CFBundleInfoDictionaryVersion".into(), "6.0".into());
plist.insert("CFBundleName".into(), settings.product_name().into());
if let Some(bundle_name) = settings
.macos()
.bundle_name
.as_ref()
.or(settings.product_name())
{
plist.insert("CFBundleName".into(), bundle_name.into());
}
plist.insert("CFBundlePackageType".into(), "APPL".into());
plist.insert(
"CFBundleShortVersionString".into(),
Expand Down
4 changes: 4 additions & 0 deletions crates/tauri-bundler/src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ pub struct MacOsSettings {
pub files: HashMap<PathBuf, PathBuf>,
/// The version of the build that identifies an iteration of the bundle.
pub bundle_version: Option<String>,
/// The name of the build that identifies a string of the bundle.
///
/// If not set, defaults to the package's product name.
pub bundle_name: Option<String>,
/// A version string indicating the minimum MacOS version that the bundled app supports (e.g. `"10.11"`).
/// 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`.
pub minimum_system_version: Option<String>,
Expand Down
7 changes: 7 additions & 0 deletions crates/tauri-cli/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3413,6 +3413,13 @@
"null"
]
},
"bundleName": {
"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.",
"type": [
"string",
"null"
]
},
"minimumSystemVersion": {
"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.",
"default": "10.13",
Expand Down
1 change: 1 addition & 0 deletions crates/tauri-cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,7 @@ fn tauri_config_to_bundle_settings(
frameworks: config.macos.frameworks,
files: config.macos.files,
bundle_version: config.macos.bundle_version,
bundle_name: config.macos.bundle_name,
minimum_system_version: config.macos.minimum_system_version,
exception_domain: config.macos.exception_domain,
signing_identity,
Expand Down
11 changes: 9 additions & 2 deletions crates/tauri-codegen/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,16 @@ pub fn context_codegen(data: ContextData) -> EmbeddedAssetsResult<TokenStream> {
};

if let Some(plist) = info_plist.as_dictionary_mut() {
if let Some(product_name) = &config.product_name {
plist.insert("CFBundleName".into(), product_name.clone().into());
if let Some(bundle_name) = config
.bundle
.macos
.bundle_name
.as_ref()
.or(config.product_name.as_ref())
{
plist.insert("CFBundleName".into(), bundle_name.as_str().into());
}

if let Some(version) = &config.version {
let bundle_version = &config.bundle.macos.bundle_version;
plist.insert("CFBundleShortVersionString".into(), version.clone().into());
Expand Down
7 changes: 7 additions & 0 deletions crates/tauri-schema-generator/schemas/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3413,6 +3413,13 @@
"null"
]
},
"bundleName": {
"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.",
"type": [
"string",
"null"
]
},
"minimumSystemVersion": {
"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.",
"default": "10.13",
Expand Down
8 changes: 8 additions & 0 deletions crates/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,13 @@ pub struct MacConfig {
/// Translates to the bundle's CFBundleVersion property.
#[serde(alias = "bundle-version")]
pub bundle_version: Option<String>,
/// The name of the builder that built the bundle.
///
/// Translates to the bundle's CFBundleName property.
///
/// If not set, defaults to the package's product name.
#[serde(alias = "bundle-name")]
pub bundle_name: Option<String>,
/// A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.
///
/// Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`
Expand Down Expand Up @@ -655,6 +662,7 @@ impl Default for MacConfig {
frameworks: None,
files: HashMap::new(),
bundle_version: None,
bundle_name: None,
minimum_system_version: macos_minimum_system_version(),
exception_domain: None,
signing_identity: None,
Expand Down
Loading