Skip to content

Commit c81534e

Browse files
authored
feat(cli): use default macOS minimum system version when it is empty (#3658)
1 parent 9258aed commit c81534e

File tree

20 files changed

+30
-18
lines changed

20 files changed

+30
-18
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
Remove `minimumSystemVersion: null` from the application template configuration.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-utils": patch
3+
---
4+
5+
Use the default value for `MacConfig.minimumSystemVersion` if the value is set to an empty string.

core/tauri-utils/src/config.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ pub struct DebConfig {
9999
pub files: HashMap<PathBuf, PathBuf>,
100100
}
101101

102+
fn de_minimum_system_version<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
103+
where
104+
D: Deserializer<'de>,
105+
{
106+
let version = Option::<String>::deserialize(deserializer)?;
107+
match version {
108+
Some(v) if v.is_empty() => Ok(minimum_system_version()),
109+
e => Ok(e),
110+
}
111+
}
112+
102113
/// Configuration for the macOS bundles.
103114
#[skip_serializing_none]
104115
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@@ -110,9 +121,15 @@ pub struct MacConfig {
110121
/// If a name is used, ".framework" must be omitted and it will look for standard install locations. You may also use a path to a specific framework.
111122
pub frameworks: Option<Vec<String>>,
112123
/// A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.
124+
///
113125
/// Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`
114126
/// and the `MACOSX_DEPLOYMENT_TARGET` environment variable.
115-
#[serde(default = "minimum_system_version")]
127+
///
128+
/// An empty string is considered an invalid value so the default value is used.
129+
#[serde(
130+
deserialize_with = "de_minimum_system_version",
131+
default = "minimum_system_version"
132+
)]
116133
pub minimum_system_version: Option<String>,
117134
/// Allows your application to communicate with the outside world.
118135
/// It should be a lowercase, without port and protocol domain name.

examples/commands/src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
},
3131
"macOS": {
3232
"frameworks": [],
33-
"minimumSystemVersion": "",
3433
"useBootstrapper": false,
3534
"exceptionDomain": ""
3635
}

examples/helloworld/src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
},
3030
"macOS": {
3131
"frameworks": [],
32-
"minimumSystemVersion": "",
3332
"useBootstrapper": false,
3433
"exceptionDomain": ""
3534
}

examples/isolation/src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
},
4141
"macOS": {
4242
"frameworks": [],
43-
"minimumSystemVersion": "",
4443
"useBootstrapper": false,
4544
"exceptionDomain": "",
4645
"signingIdentity": null,

examples/navigation/src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
},
3131
"macOS": {
3232
"frameworks": [],
33-
"minimumSystemVersion": "",
3433
"useBootstrapper": false,
3534
"exceptionDomain": ""
3635
}

examples/resources/src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
},
3131
"macOS": {
3232
"frameworks": [],
33-
"minimumSystemVersion": "",
3433
"useBootstrapper": false,
3534
"exceptionDomain": ""
3635
}

examples/sidecar/src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
},
3131
"macOS": {
3232
"frameworks": [],
33-
"minimumSystemVersion": "",
3433
"useBootstrapper": false,
3534
"exceptionDomain": ""
3635
}

examples/state/src-tauri/tauri.conf.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
},
3131
"macOS": {
3232
"frameworks": [],
33-
"minimumSystemVersion": "",
3433
"useBootstrapper": false,
3534
"exceptionDomain": ""
3635
}

0 commit comments

Comments
 (0)