Skip to content

Commit

Permalink
feat(cli): use default macOS minimum system version when it is empty (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Mar 13, 2022
1 parent 9258aed commit c81534e
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .changes/cli-template-minimum-mac-system-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"cli.rs": patch
"cli.js": patch
---

Remove `minimumSystemVersion: null` from the application template configuration.
5 changes: 5 additions & 0 deletions .changes/enhance-minimum-system-version-deserialization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-utils": patch
---

Use the default value for `MacConfig.minimumSystemVersion` if the value is set to an empty string.
19 changes: 18 additions & 1 deletion core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ pub struct DebConfig {
pub files: HashMap<PathBuf, PathBuf>,
}

fn de_minimum_system_version<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
where
D: Deserializer<'de>,
{
let version = Option::<String>::deserialize(deserializer)?;
match version {
Some(v) if v.is_empty() => Ok(minimum_system_version()),
e => Ok(e),
}
}

/// Configuration for the macOS bundles.
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
Expand All @@ -110,9 +121,15 @@ pub struct MacConfig {
/// 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.
pub frameworks: Option<Vec<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`
/// and the `MACOSX_DEPLOYMENT_TARGET` environment variable.
#[serde(default = "minimum_system_version")]
///
/// An empty string is considered an invalid value so the default value is used.
#[serde(
deserialize_with = "de_minimum_system_version",
default = "minimum_system_version"
)]
pub minimum_system_version: Option<String>,
/// Allows your application to communicate with the outside world.
/// It should be a lowercase, without port and protocol domain name.
Expand Down
1 change: 0 additions & 1 deletion examples/commands/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion examples/helloworld/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion examples/isolation/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
Expand Down
1 change: 0 additions & 1 deletion examples/navigation/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion examples/resources/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion examples/sidecar/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion examples/state/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion examples/streaming/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion examples/tauri-dynamic-lib/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion examples/updater/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"signingIdentity": null,
"entitlements": "../entitlements.plist",
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
1 change: 0 additions & 1 deletion tooling/bench/tests/helloworld/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@
]
},
"minimumSystemVersion": {
"description": "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` and the `MACOSX_DEPLOYMENT_TARGET` environment variable.",
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\nSetting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist` and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\nAn empty string is considered an invalid value so the default value is used.",
"default": "10.13",
"type": [
"string",
Expand Down
1 change: 0 additions & 1 deletion tooling/cli/templates/app/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": ""
}
Expand Down

0 comments on commit c81534e

Please sign in to comment.