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.
#[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

View File

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

View File

@ -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",

View File

@ -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(),