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

Conversation

Tunglies
Copy link
Contributor

Added plist bundleName option for macOS, enhancing bundle configuration flexibility. Now, tauri.config.json support macOS > bundle > bundleName

Feature tested on cargo cli cargo tauri bundle

…s#13110)

feat(config): add bundleName field to schema and MacConfig

feat(settings): add optional bundle_name field to MacOsSettings
@Tunglies Tunglies requested a review from a team as a code owner May 31, 2025 07:00
@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap May 31, 2025
Copy link
Member

@FabianLars FabianLars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Just a few smaller things and this is ready to go.

Comment on lines 217 to 221
if let Some(bundle_name) = settings.macos().bundle_name.clone() {
plist.insert("CFBundleName".into(), bundle_name.into());
} else {
plist.insert("CFBundleName".into(), settings.product_name().into());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code can be "simplified" (not really simpler) to how it was done for CFBundleVersion below so like this

Suggested change
if let Some(bundle_name) = settings.macos().bundle_name.clone() {
plist.insert("CFBundleName".into(), bundle_name.into());
} else {
plist.insert("CFBundleName".into(), settings.product_name().into());
}
plist.insert(
"CFBundleName".into(),
settings
.macos()
.bundle_name
.as_deref()
.unwrap_or_else(|| settings.product_name())
.into(),
);

Copy link
Contributor Author

@Tunglies Tunglies Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the tauri test config file

{
"$schema": "../../../../../crates/tauri-schema-generator/schemas/config.schema.json",
"identifier": "studio.tauri.example",
"build": {
"frontendDist": "../dist",
"devUrl": "http://localhost:4000"
},
"app": {
"windows": [
{
"title": "Tauri App"
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost",
"headers": null
}
},
"bundle": {
"active": true
}
}

This could be passed all of the testing due to the product_name is Option

macos().bundle_name and settings.product_name(), they are both Option. Accesing like this gets fail test due to the tauri test config file dose not contain any product name or bundle name

plist.insert(
    "CFBundleName".into(),
    settings
      .macos()
      .bundle_name
      .as_deref()
      .unwrap_or_else(|| settings.product_name())
      .into(),
  );

since when bundle_name is None will fallback to product_name. additional product_name unwrap_or opperation will makes code heavy.

It could be solved to add test file config or using if Some(...) = ... else if Some(...) ...

Comment on lines 620 to 622
/// The name of the builder that built the bundle.
///
/// Translates to the bundle's CFBundleName property.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, annotated the last file in my first comment. This one here should communicate the fallback as well.

@@ -309,7 +309,9 @@ 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 {
if let Some(bundle_name) = &config.bundle.macos.bundle_name {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as the other one, you can use the same logic as below for CFBundleVersion. GitHub doesn't let me add a suggestion here for some reason tho.

tauri-bundler: "minor:feat"
tauri-cli: "minor:feat"
tauri-codegen: "minor:feat"
tauri-schema-generator: "minor:feat"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tauri-schema-generator: "minor:feat"

The generator doesn't get bumped for schema changed (a bit confusing i know)

@github-project-automation github-project-automation bot moved this from 📬Proposal to 🏗 In progress in Roadmap May 31, 2025
@FabianLars FabianLars added this to the 2.6 milestone May 31, 2025
@Tunglies
Copy link
Contributor Author

@FabianLars it should be ready to go now :D

@Tunglies Tunglies requested a review from FabianLars June 1, 2025 14:56
@Tunglies
Copy link
Contributor Author

Tunglies commented Jun 2, 2025

@FabianLars @Legend-Master Could we review it one more time?

@FabianLars
Copy link
Member

Your PR was not forgotten, we're just not as active on weekends. It's on my schedule today :)

FabianLars
FabianLars previously approved these changes Jun 2, 2025
Copy link
Contributor

github-actions bot commented Jun 2, 2025

Package Changes Through a50feea

There are 8 changes which include tauri-bundler with minor, tauri-cli with minor, tauri-codegen with minor, tauri-utils with minor, @tauri-apps/cli with minor, tauri with minor, @tauri-apps/api with minor, tauri-runtime-wry with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.5.0 2.6.0
tauri-utils 2.4.0 2.5.0
tauri-bundler 2.4.0 2.5.0
tauri-runtime 2.6.0 2.6.1
tauri-runtime-wry 2.6.0 2.6.1
tauri-codegen 2.2.0 2.3.0
tauri-macros 2.2.0 2.2.1
tauri-plugin 2.2.0 2.2.1
tauri-build 2.2.0 2.2.1
tauri 2.5.1 2.6.0
@tauri-apps/cli 2.5.0 2.6.0
tauri-cli 2.5.0 2.6.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Tunglies
Copy link
Contributor Author

Tunglies commented Jun 3, 2025

due to the ONLY one test failed here https://github.com/tauri-apps/tauri/actions/runs/15377486499/job/43342306263
I tried to improve bundle name retrieval logic. The test locally is pased. If only one test failed again. Pls help me with it :T

@FabianLars FabianLars merged commit 414619c into tauri-apps:dev Jun 3, 2025
27 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to 🔎 In audit in Roadmap Jun 3, 2025
@Tunglies Tunglies deleted the feat-bundle-name branch June 3, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔎 In audit
Development

Successfully merging this pull request may close these issues.

2 participants