From 1d9226b28cc06f670ca248e3fcff9e9ffcc11a2b Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Sun, 28 Aug 2022 15:34:41 -0300 Subject: [PATCH] refactor:move iOS configuration to the bundle object (#5072) --- core/tauri-utils/src/config.rs | 16 +++++------ core/tauri/src/test/mod.rs | 1 - tooling/cli/schema.json | 49 +++++++++++++++++----------------- tooling/cli/src/mobile/ios.rs | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index 36298eb60..6f0c13fd7 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -594,6 +594,9 @@ pub struct BundleConfig { /// Configuration for the Windows bundle. #[serde(default)] pub windows: WindowsConfig, + /// iOS configuration. + #[serde(rename = "iOS", default)] + pub ios: IosConfig, } /// 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`. #[serde(rename = "macOSPrivateApi", alias = "macos-private-api", default)] pub macos_private_api: bool, - /// iOS configuration. - #[serde(rename = "iOS", default)] - pub ios: IosConfig, } impl TauriConfig { @@ -3120,6 +3120,7 @@ mod build { let macos = quote!(Default::default()); let external_bin = opt_vec_str_lit(self.external_bin.as_ref()); let windows = &self.windows; + let ios = quote!(Default::default()); literal_struct!( tokens, @@ -3137,7 +3138,8 @@ mod build { deb, macos, external_bin, - windows + windows, + ios ); } } @@ -3458,7 +3460,6 @@ mod build { let system_tray = opt_lit(self.system_tray.as_ref()); let allowlist = &self.allowlist; let macos_private_api = self.macos_private_api; - let ios = quote!(Default::default()); literal_struct!( tokens, @@ -3471,8 +3472,7 @@ mod build { security, system_tray, allowlist, - macos_private_api, - ios + macos_private_api ); } } @@ -3552,6 +3552,7 @@ mod test { macos: Default::default(), external_bin: None, windows: Default::default(), + ios: Default::default(), }, cli: None, updater: UpdaterConfig { @@ -3570,7 +3571,6 @@ mod test { allowlist: AllowlistConfig::default(), system_tray: None, macos_private_api: false, - ios: Default::default(), }; // create a build config diff --git a/core/tauri/src/test/mod.rs b/core/tauri/src/test/mod.rs index 9f4357b36..bf0bb33e0 100644 --- a/core/tauri/src/test/mod.rs +++ b/core/tauri/src/test/mod.rs @@ -61,7 +61,6 @@ pub fn mock_context(assets: A) -> crate::Context { updater: Default::default(), system_tray: None, macos_private_api: false, - ios: Default::default(), }, build: Default::default(), plugins: Default::default(), diff --git a/tooling/cli/schema.json b/tooling/cli/schema.json index 6322c3c7c..141dba7de 100644 --- a/tooling/cli/schema.json +++ b/tooling/cli/schema.json @@ -124,6 +124,7 @@ "deb": { "files": {} }, + "iOS": {}, "icon": [], "identifier": "", "macOS": { @@ -144,7 +145,6 @@ "wix": null } }, - "iOS": {}, "macOSPrivateApi": false, "pattern": { "use": "brownfield" @@ -260,6 +260,7 @@ "deb": { "files": {} }, + "iOS": {}, "icon": [], "identifier": "", "macOS": { @@ -427,15 +428,6 @@ "description": "MacOS private API configuration. Enables the transparent background API and sets the `fullScreenEnabled` preference to `true`.", "default": false, "type": "boolean" - }, - "iOS": { - "description": "iOS configuration.", - "default": {}, - "allOf": [ - { - "$ref": "#/definitions/IosConfig" - } - ] } }, "additionalProperties": false @@ -1042,6 +1034,15 @@ "$ref": "#/definitions/WindowsConfig" } ] + }, + "iOS": { + "description": "iOS configuration.", + "default": {}, + "allOf": [ + { + "$ref": "#/definitions/IosConfig" + } + ] } }, "additionalProperties": false @@ -1493,6 +1494,20 @@ }, "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": { "description": "Allowlist configuration.", "type": "object", @@ -2428,20 +2443,6 @@ }, "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": { "description": "The Build configuration object.", "type": "object", diff --git a/tooling/cli/src/mobile/ios.rs b/tooling/cli/src/mobile/ios.rs index 907bfaf6b..f9c8d3cc1 100644 --- a/tooling/cli/src/mobile/ios.rs +++ b/tooling/cli/src/mobile/ios.rs @@ -84,7 +84,7 @@ pub fn get_config( let raw = RawAppleConfig { development_team: std::env::var("TAURI_APPLE_DEVELOPMENT_TEAM") .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"), ios_features: ios_options.features.clone(), bundle_version: config.package.version.clone(),