refactor:move iOS configuration to the bundle object (#5072)

This commit is contained in:
Lucas Fernandes Nogueira 2022-08-28 15:34:41 -03:00 committed by GitHub
parent 8cf9af93eb
commit 1d9226b28c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 34 deletions

View File

@ -594,6 +594,9 @@ pub struct BundleConfig {
/// Configuration for the Windows bundle. /// Configuration for the Windows bundle.
#[serde(default)] #[serde(default)]
pub windows: WindowsConfig, pub windows: WindowsConfig,
/// iOS configuration.
#[serde(rename = "iOS", default)]
pub ios: IosConfig,
} }
/// A CLI argument definition. /// A CLI argument definition.
@ -2085,9 +2088,6 @@ pub struct TauriConfig {
/// MacOS private API configuration. Enables the transparent background API and sets the `fullScreenEnabled` preference to `true`. /// MacOS private API configuration. Enables the transparent background API and sets the `fullScreenEnabled` preference to `true`.
#[serde(rename = "macOSPrivateApi", alias = "macos-private-api", default)] #[serde(rename = "macOSPrivateApi", alias = "macos-private-api", default)]
pub macos_private_api: bool, pub macos_private_api: bool,
/// iOS configuration.
#[serde(rename = "iOS", default)]
pub ios: IosConfig,
} }
impl TauriConfig { impl TauriConfig {
@ -3120,6 +3120,7 @@ mod build {
let macos = quote!(Default::default()); let macos = quote!(Default::default());
let external_bin = opt_vec_str_lit(self.external_bin.as_ref()); let external_bin = opt_vec_str_lit(self.external_bin.as_ref());
let windows = &self.windows; let windows = &self.windows;
let ios = quote!(Default::default());
literal_struct!( literal_struct!(
tokens, tokens,
@ -3137,7 +3138,8 @@ mod build {
deb, deb,
macos, macos,
external_bin, external_bin,
windows windows,
ios
); );
} }
} }
@ -3458,7 +3460,6 @@ mod build {
let system_tray = opt_lit(self.system_tray.as_ref()); let system_tray = opt_lit(self.system_tray.as_ref());
let allowlist = &self.allowlist; let allowlist = &self.allowlist;
let macos_private_api = self.macos_private_api; let macos_private_api = self.macos_private_api;
let ios = quote!(Default::default());
literal_struct!( literal_struct!(
tokens, tokens,
@ -3471,8 +3472,7 @@ mod build {
security, security,
system_tray, system_tray,
allowlist, allowlist,
macos_private_api, macos_private_api
ios
); );
} }
} }
@ -3552,6 +3552,7 @@ mod test {
macos: Default::default(), macos: Default::default(),
external_bin: None, external_bin: None,
windows: Default::default(), windows: Default::default(),
ios: Default::default(),
}, },
cli: None, cli: None,
updater: UpdaterConfig { updater: UpdaterConfig {
@ -3570,7 +3571,6 @@ mod test {
allowlist: AllowlistConfig::default(), allowlist: AllowlistConfig::default(),
system_tray: None, system_tray: None,
macos_private_api: false, macos_private_api: false,
ios: Default::default(),
}; };
// create a build config // create a build config

View File

@ -61,7 +61,6 @@ pub fn mock_context<A: Assets>(assets: A) -> crate::Context<A> {
updater: Default::default(), updater: Default::default(),
system_tray: None, system_tray: None,
macos_private_api: false, macos_private_api: false,
ios: Default::default(),
}, },
build: Default::default(), build: Default::default(),
plugins: Default::default(), plugins: Default::default(),

View File

@ -124,6 +124,7 @@
"deb": { "deb": {
"files": {} "files": {}
}, },
"iOS": {},
"icon": [], "icon": [],
"identifier": "", "identifier": "",
"macOS": { "macOS": {
@ -144,7 +145,6 @@
"wix": null "wix": null
} }
}, },
"iOS": {},
"macOSPrivateApi": false, "macOSPrivateApi": false,
"pattern": { "pattern": {
"use": "brownfield" "use": "brownfield"
@ -260,6 +260,7 @@
"deb": { "deb": {
"files": {} "files": {}
}, },
"iOS": {},
"icon": [], "icon": [],
"identifier": "", "identifier": "",
"macOS": { "macOS": {
@ -427,15 +428,6 @@
"description": "MacOS private API configuration. Enables the transparent background API and sets the `fullScreenEnabled` preference to `true`.", "description": "MacOS private API configuration. Enables the transparent background API and sets the `fullScreenEnabled` preference to `true`.",
"default": false, "default": false,
"type": "boolean" "type": "boolean"
},
"iOS": {
"description": "iOS configuration.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/IosConfig"
}
]
} }
}, },
"additionalProperties": false "additionalProperties": false
@ -1042,6 +1034,15 @@
"$ref": "#/definitions/WindowsConfig" "$ref": "#/definitions/WindowsConfig"
} }
] ]
},
"iOS": {
"description": "iOS configuration.",
"default": {},
"allOf": [
{
"$ref": "#/definitions/IosConfig"
}
]
} }
}, },
"additionalProperties": false "additionalProperties": false
@ -1493,6 +1494,20 @@
}, },
"additionalProperties": false "additionalProperties": false
}, },
"IosConfig": {
"description": "General configuration for the iOS target.",
"type": "object",
"properties": {
"developmentTeam": {
"description": "The development team. This value is required for iOS development because code signing is enforced. The `TAURI_APPLE_DEVELOPMENT_TEAM` environment variable can be set to overwrite it.",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"AllowlistConfig": { "AllowlistConfig": {
"description": "Allowlist configuration.", "description": "Allowlist configuration.",
"type": "object", "type": "object",
@ -2428,20 +2443,6 @@
}, },
"additionalProperties": false "additionalProperties": false
}, },
"IosConfig": {
"description": "General configuration for the iOS target.",
"type": "object",
"properties": {
"developmentTeam": {
"description": "The development team. This value is required for iOS development because code signing is enforced. The `TAURI_APPLE_DEVELOPMENT_TEAM` environment variable can be set to overwrite it.",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"BuildConfig": { "BuildConfig": {
"description": "The Build configuration object.", "description": "The Build configuration object.",
"type": "object", "type": "object",

View File

@ -84,7 +84,7 @@ pub fn get_config(
let raw = RawAppleConfig { let raw = RawAppleConfig {
development_team: std::env::var("TAURI_APPLE_DEVELOPMENT_TEAM") development_team: std::env::var("TAURI_APPLE_DEVELOPMENT_TEAM")
.ok() .ok()
.or_else(|| config.tauri.ios.development_team.clone()) .or_else(|| config.tauri.bundle.ios.development_team.clone())
.expect("you must set `tauri > iOS > developmentTeam` config value or the `TAURI_APPLE_DEVELOPMENT_TEAM` environment variable"), .expect("you must set `tauri > iOS > developmentTeam` config value or the `TAURI_APPLE_DEVELOPMENT_TEAM` environment variable"),
ios_features: ios_options.features.clone(), ios_features: ios_options.features.clone(),
bundle_version: config.package.version.clone(), bundle_version: config.package.version.clone(),