-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Conversation
…s#13110) feat(config): add bundleName field to schema and MacConfig feat(settings): add optional bundle_name field to MacOsSettings
There was a problem hiding this 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.
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()); | ||
} |
There was a problem hiding this comment.
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
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(), | |
); |
There was a problem hiding this comment.
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
tauri/crates/tauri/test/fixture/src-tauri/tauri.conf.json
Lines 1 to 22 in 6a39f49
{ | |
"$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(...) ...
crates/tauri-utils/src/config.rs
Outdated
/// The name of the builder that built the bundle. | ||
/// | ||
/// Translates to the bundle's CFBundleName property. |
There was a problem hiding this comment.
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.
crates/tauri-codegen/src/context.rs
Outdated
@@ -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 { |
There was a problem hiding this comment.
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.
.changes/bundler-bundleName.md
Outdated
tauri-bundler: "minor:feat" | ||
tauri-cli: "minor:feat" | ||
tauri-codegen: "minor:feat" | ||
tauri-schema-generator: "minor:feat" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tauri-schema-generator: "minor:feat" |
The generator doesn't get bumped for schema changed (a bit confusing i know)
@FabianLars it should be ready to go now :D |
@FabianLars @Legend-Master Could we review it one more time? |
Your PR was not forgotten, we're just not as active on weekends. It's on my schedule today :) |
Package Changes Through a50feeaThere 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 VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
due to the ONLY one test failed here https://github.com/tauri-apps/tauri/actions/runs/15377486499/job/43342306263 |
Added plist bundleName option for macOS, enhancing bundle configuration flexibility. Now,
tauri.config.json
supportmacOS > bundle > bundleName
Feature tested on cargo cli
cargo tauri bundle