feat(codegen): fill app metadata in development Info.plist

This commit is contained in:
Lucas Nogueira 2022-06-21 20:36:26 -03:00
parent 2616ede410
commit 38f5db6e6a
No known key found for this signature in database
GPG Key ID: C54D79C4018F1D19
17 changed files with 67 additions and 10 deletions

View File

@ -0,0 +1,7 @@
---
"tauri-codegen": patch
"tauri-macros": patch
"tauri": patch
---
Set the bundle name and app metadata in the Info.plist file in development mode.

View File

@ -1,7 +0,0 @@
---
"tauri-codegen": patch
"tauri-macros": patch
"tauri": patch
---
Set the bundle name in the Info.plist file in development mode.

View File

@ -31,6 +31,7 @@ png = "0.17"
[target."cfg(target_os = \"macos\")".dependencies]
plist = "1"
time = { version = "0.3", features = [ "parsing", "formatting" ] }
[features]
default = [ "compression" ]

View File

@ -293,9 +293,17 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
plist::Value::Dictionary(Default::default())
};
if let Some(dict) = info_plist.as_dictionary_mut() {
if let Some(plist) = info_plist.as_dictionary_mut() {
if let Some(product_name) = &config.package.product_name {
dict.insert("CFBundleName".into(), product_name.clone().into());
plist.insert("CFBundleName".into(), product_name.clone().into());
}
if let Some(version) = &config.package.version {
plist.insert("CFBundleShortVersionString".into(), version.clone().into());
}
let format =
time::format_description::parse("[year][month][day].[hour][minute][second]").unwrap();
if let Ok(build_number) = time::OffsetDateTime::now_utc().format(&format) {
plist.insert("CFBundleVersion".into(), build_number.into());
}
}

View File

@ -7,6 +7,10 @@
"beforeBuildCommand": "",
"withGlobalTauri": true
},
"package": {
"productName": "Commands",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -6,6 +6,10 @@
"beforeDevCommand": "",
"beforeBuildCommand": ""
},
"package": {
"productName": "Hello World",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -1,7 +1,7 @@
{
"$schema": "../../tooling/cli/schema.json",
"package": {
"productName": "isolation",
"productName": "Isolation",
"version": "0.1.0"
},
"build": {

View File

@ -5,6 +5,10 @@
"devPath": ["index.html"],
"withGlobalTauri": true
},
"package": {
"productName": "Multi Window",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -7,6 +7,10 @@
"beforeBuildCommand": "",
"withGlobalTauri": true
},
"package": {
"productName": "Navigation",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -5,6 +5,10 @@
"devPath": ["index.html"],
"withGlobalTauri": true
},
"package": {
"productName": "Parent Window",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -7,6 +7,10 @@
"beforeBuildCommand": "",
"withGlobalTauri": true
},
"package": {
"productName": "Resources",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -7,6 +7,10 @@
"beforeBuildCommand": "yarn package",
"withGlobalTauri": true
},
"package": {
"productName": "Sidecar",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -5,6 +5,10 @@
"devPath": "dist",
"withGlobalTauri": true
},
"package": {
"productName": "Splashscreen",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -7,6 +7,10 @@
"beforeBuildCommand": "",
"withGlobalTauri": true
},
"package": {
"productName": "State",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -7,6 +7,10 @@
"beforeBuildCommand": "",
"withGlobalTauri": true
},
"package": {
"productName": "Streaming",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -6,6 +6,10 @@
"beforeDevCommand": "",
"beforeBuildCommand": ""
},
"package": {
"productName": "Dynamic Lib",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,

View File

@ -6,6 +6,10 @@
"beforeDevCommand": "",
"beforeBuildCommand": ""
},
"package": {
"productName": "Updater",
"version": "0.1.0"
},
"tauri": {
"bundle": {
"active": true,