mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
feat(core): add config for the minimum iOS version (#10495)
* feat(core): add config for the minimum iOS version * revert api exapmle
This commit is contained in:
committed by
GitHub
parent
5be7607b26
commit
02c00abc63
7
.changes/min-ios-version.md
Normal file
7
.changes/min-ios-version.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"tauri-utils": patch:feat
|
||||
"tauri-cli": patch:feat
|
||||
"@tauri-apps/cli": patch:feat
|
||||
---
|
||||
|
||||
Added `bundle > ios > minimumSystemVersion` configuration option.
|
||||
@@ -601,6 +601,13 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
if target_triple.contains("ios") {
|
||||
println!(
|
||||
"cargo:rustc-env=IPHONEOS_DEPLOYMENT_TARGET={}",
|
||||
config.bundle.ios.minimum_system_version
|
||||
);
|
||||
}
|
||||
|
||||
if target_triple.contains("windows") {
|
||||
use semver::Version;
|
||||
use tauri_winres::{VersionInfo, WindowsResource};
|
||||
|
||||
@@ -74,7 +74,9 @@
|
||||
"minSdkVersion": 24
|
||||
},
|
||||
"createUpdaterArtifacts": false,
|
||||
"iOS": {},
|
||||
"iOS": {
|
||||
"minimumSystemVersion": ""
|
||||
},
|
||||
"icon": [],
|
||||
"linux": {
|
||||
"appimage": {
|
||||
@@ -1712,7 +1714,9 @@
|
||||
},
|
||||
"iOS": {
|
||||
"description": "iOS configuration.",
|
||||
"default": {},
|
||||
"default": {
|
||||
"minimumSystemVersion": ""
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/IosConfig"
|
||||
@@ -2912,6 +2916,11 @@
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"minimumSystemVersion": {
|
||||
"description": "A version string indicating the minimum iOS version that the bundled application supports. Defaults to `13.0`.\n\n Maps to the IPHONEOS_DEPLOYMENT_TARGET value.",
|
||||
"default": "13.0",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -536,13 +536,13 @@ fn dmg_application_folder_position() -> Position {
|
||||
Position { x: 480, y: 170 }
|
||||
}
|
||||
|
||||
fn de_minimum_system_version<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
|
||||
fn de_macos_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()),
|
||||
Some(v) if v.is_empty() => Ok(macos_minimum_system_version()),
|
||||
e => Ok(e),
|
||||
}
|
||||
}
|
||||
@@ -569,8 +569,8 @@ pub struct MacConfig {
|
||||
///
|
||||
/// 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",
|
||||
deserialize_with = "de_macos_minimum_system_version",
|
||||
default = "macos_minimum_system_version",
|
||||
alias = "minimum-system-version"
|
||||
)]
|
||||
pub minimum_system_version: Option<String>,
|
||||
@@ -601,7 +601,7 @@ impl Default for MacConfig {
|
||||
Self {
|
||||
frameworks: None,
|
||||
files: HashMap::new(),
|
||||
minimum_system_version: minimum_system_version(),
|
||||
minimum_system_version: macos_minimum_system_version(),
|
||||
exception_domain: None,
|
||||
signing_identity: None,
|
||||
hardened_runtime: true,
|
||||
@@ -612,10 +612,14 @@ impl Default for MacConfig {
|
||||
}
|
||||
}
|
||||
|
||||
fn minimum_system_version() -> Option<String> {
|
||||
fn macos_minimum_system_version() -> Option<String> {
|
||||
Some("10.13".into())
|
||||
}
|
||||
|
||||
fn ios_minimum_system_version() -> String {
|
||||
"13.0".into()
|
||||
}
|
||||
|
||||
/// Configuration for a target language for the WiX build.
|
||||
///
|
||||
/// See more: <https://tauri.app/v1/api/config#wixlanguageconfig>
|
||||
@@ -1897,6 +1901,14 @@ pub struct IosConfig {
|
||||
/// The `APPLE_DEVELOPMENT_TEAM` environment variable can be set to overwrite it.
|
||||
#[serde(alias = "development-team")]
|
||||
pub development_team: Option<String>,
|
||||
/// A version string indicating the minimum iOS version that the bundled application supports. Defaults to `13.0`.
|
||||
///
|
||||
/// Maps to the IPHONEOS_DEPLOYMENT_TARGET value.
|
||||
#[serde(
|
||||
alias = "minimum-system-version",
|
||||
default = "ios_minimum_system_version"
|
||||
)]
|
||||
pub minimum_system_version: String,
|
||||
}
|
||||
|
||||
/// General configuration for the iOS target.
|
||||
|
||||
@@ -74,7 +74,9 @@
|
||||
"minSdkVersion": 24
|
||||
},
|
||||
"createUpdaterArtifacts": false,
|
||||
"iOS": {},
|
||||
"iOS": {
|
||||
"minimumSystemVersion": ""
|
||||
},
|
||||
"icon": [],
|
||||
"linux": {
|
||||
"appimage": {
|
||||
@@ -1712,7 +1714,9 @@
|
||||
},
|
||||
"iOS": {
|
||||
"description": "iOS configuration.",
|
||||
"default": {},
|
||||
"default": {
|
||||
"minimumSystemVersion": ""
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/IosConfig"
|
||||
@@ -2912,6 +2916,11 @@
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"minimumSystemVersion": {
|
||||
"description": "A version string indicating the minimum iOS version that the bundled application supports. Defaults to `13.0`.\n\n Maps to the IPHONEOS_DEPLOYMENT_TARGET value.",
|
||||
"default": "13.0",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -149,6 +149,11 @@ impl Interface for Rust {
|
||||
std::env::set_var("MACOSX_DEPLOYMENT_TARGET", minimum_system_version);
|
||||
}
|
||||
|
||||
std::env::set_var(
|
||||
"IPHONEOS_DEPLOYMENT_TARGET",
|
||||
&config.bundle.ios.minimum_system_version,
|
||||
);
|
||||
|
||||
let app_settings = RustAppSettings::new(config, manifest, target)?;
|
||||
|
||||
Ok(Self {
|
||||
|
||||
@@ -46,7 +46,6 @@ pub(crate) mod project;
|
||||
mod xcode_script;
|
||||
|
||||
pub const APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME: &str = "APPLE_DEVELOPMENT_TEAM";
|
||||
const TARGET_IOS_VERSION: &str = "13.0";
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(
|
||||
@@ -136,7 +135,7 @@ pub fn get_config(
|
||||
ios_features: ios_options.features.clone(),
|
||||
bundle_version: tauri_config.version.clone(),
|
||||
bundle_version_short: tauri_config.version.clone(),
|
||||
ios_version: Some(TARGET_IOS_VERSION.into()),
|
||||
ios_version: Some(tauri_config.bundle.ios.minimum_system_version.clone()),
|
||||
..Default::default()
|
||||
};
|
||||
let config = AppleConfig::from_raw(app.clone(), Some(raw)).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user