From 5926351f86bcfca982d5344c02429a865f5e5e63 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sun, 25 Aug 2024 10:45:32 -0300 Subject: [PATCH] refactor(core): remove deprecated webview_fixed_runtime_path option --- .changes/remove-webview_fixed_runtime_path.md | 8 ++++++++ core/tauri-build/src/lib.rs | 13 ++++--------- core/tauri-config-schema/schema.json | 9 --------- core/tauri-utils/src/config.rs | 18 +----------------- examples/api/src-tauri/Cargo.lock | 14 +++++++------- tooling/bundler/src/bundle/settings.rs | 7 ------- tooling/bundler/src/bundle/windows/msi/wix.rs | 8 +------- tooling/bundler/src/bundle/windows/nsis.rs | 8 +------- tooling/cli/schema.json | 9 --------- tooling/cli/src/interface/rust.rs | 5 +---- 10 files changed, 23 insertions(+), 76 deletions(-) create mode 100644 .changes/remove-webview_fixed_runtime_path.md diff --git a/.changes/remove-webview_fixed_runtime_path.md b/.changes/remove-webview_fixed_runtime_path.md new file mode 100644 index 000000000000..8caad8d74e92 --- /dev/null +++ b/.changes/remove-webview_fixed_runtime_path.md @@ -0,0 +1,8 @@ +--- +"tauri-utils": patch:breaking +"@tauri-apps/cli": patch:breaking +"tauri-cli": patch:breaking +"tauri-bundler": patch:breaking +--- + +Removed the deprecated `webview_fixed_runtime_path` config option, use the `webview_install_mode` instead. diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 4a5cf6631213..d5c92463d006 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -576,15 +576,10 @@ pub fn try_build(attributes: Attributes) -> Result<()> { .clone() .unwrap_or_else(|| BundleResources::List(Vec::new())); if target_triple.contains("windows") { - if let Some(fixed_webview2_runtime_path) = - match &config.bundle.windows.webview_fixed_runtime_path { - Some(path) => Some(path), - None => match &config.bundle.windows.webview_install_mode { - WebviewInstallMode::FixedRuntime { path } => Some(path), - _ => None, - }, - } - { + if let Some(fixed_webview2_runtime_path) = match &config.bundle.windows.webview_install_mode { + WebviewInstallMode::FixedRuntime { path } => Some(path), + _ => None, + } { resources.push(fixed_webview2_runtime_path.display().to_string()); } } diff --git a/core/tauri-config-schema/schema.json b/core/tauri-config-schema/schema.json index 540673714d6f..f9396e298687 100644 --- a/core/tauri-config-schema/schema.json +++ b/core/tauri-config-schema/schema.json @@ -120,7 +120,6 @@ "signCommand": null, "timestampUrl": null, "tsp": false, - "webviewFixedRuntimePath": null, "webviewInstallMode": { "silent": true, "type": "downloadBootstrapper" @@ -1650,7 +1649,6 @@ "signCommand": null, "timestampUrl": null, "tsp": false, - "webviewFixedRuntimePath": null, "webviewInstallMode": { "silent": true, "type": "downloadBootstrapper" @@ -1998,13 +1996,6 @@ } ] }, - "webviewFixedRuntimePath": { - "description": "Path to the webview fixed runtime to use. Overwrites [`Self::webview_install_mode`] if set.\n\n Will be removed in v2, prefer the [`Self::webview_install_mode`] option.\n\n The fixed version can be downloaded [on the official website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section).\n The `.cab` file must be extracted to a folder and this folder path must be defined on this field.", - "type": [ - "string", - "null" - ] - }, "allowDowngrades": { "description": "Validates a second app installation, blocking the user from installing an older version if set to `false`.\n\n For instance, if `1.2.1` is installed, the user won't be able to install app version `1.2.0` or `1.1.5`.\n\n The default value of this flag is `true`.", "default": true, diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index d91bcc810cec..e699d65087d6 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -948,14 +948,6 @@ pub struct WindowsConfig { /// The installation mode for the Webview2 runtime. #[serde(default, alias = "webview-install-mode")] pub webview_install_mode: WebviewInstallMode, - /// Path to the webview fixed runtime to use. Overwrites [`Self::webview_install_mode`] if set. - /// - /// Will be removed in v2, prefer the [`Self::webview_install_mode`] option. - /// - /// The fixed version can be downloaded [on the official website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section). - /// The `.cab` file must be extracted to a folder and this folder path must be defined on this field. - #[serde(alias = "webview-fixed-runtime-path")] - pub webview_fixed_runtime_path: Option, /// Validates a second app installation, blocking the user from installing an older version if set to `false`. /// /// For instance, if `1.2.1` is installed, the user won't be able to install app version `1.2.0` or `1.1.5`. @@ -986,7 +978,6 @@ impl Default for WindowsConfig { timestamp_url: None, tsp: false, webview_install_mode: Default::default(), - webview_fixed_runtime_path: None, allow_downgrades: true, wix: None, nsis: None, @@ -2550,14 +2541,7 @@ mod build { impl ToTokens for WindowsConfig { fn to_tokens(&self, tokens: &mut TokenStream) { - let webview_install_mode = if let Some(fixed_runtime_path) = &self.webview_fixed_runtime_path - { - WebviewInstallMode::FixedRuntime { - path: fixed_runtime_path.clone(), - } - } else { - self.webview_install_mode.clone() - }; + let webview_install_mode = &self.webview_install_mode; tokens.append_all(quote! { ::tauri::utils::config::WindowsConfig { webview_install_mode: #webview_install_mode, ..Default::default() diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 5bc00e99895e..de71cf2738de 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -3221,7 +3221,7 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tauri" -version = "2.0.0-rc.5" +version = "2.0.0-rc.6" dependencies = [ "anyhow", "bytes", @@ -3271,7 +3271,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-rc.5" +version = "2.0.0-rc.6" dependencies = [ "anyhow", "cargo_toml", @@ -3293,7 +3293,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-rc.5" +version = "2.0.0-rc.6" dependencies = [ "base64 0.22.1", "brotli", @@ -3330,7 +3330,7 @@ dependencies = [ [[package]] name = "tauri-plugin" -version = "2.0.0-rc.5" +version = "2.0.0-rc.6" dependencies = [ "anyhow", "glob", @@ -3356,7 +3356,7 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.0.0-rc.5" +version = "2.0.0-rc.6" dependencies = [ "dpi", "gtk", @@ -3373,7 +3373,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.0.0-rc.5" +version = "2.0.0-rc.6" dependencies = [ "cocoa 0.26.0", "gtk", @@ -3395,7 +3395,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-rc.5" +version = "2.0.0-rc.6" dependencies = [ "aes-gcm", "brotli", diff --git a/tooling/bundler/src/bundle/settings.rs b/tooling/bundler/src/bundle/settings.rs index 7c262afb308a..0140e5eafb1b 100644 --- a/tooling/bundler/src/bundle/settings.rs +++ b/tooling/bundler/src/bundle/settings.rs @@ -494,12 +494,6 @@ pub struct WindowsSettings { pub icon_path: PathBuf, /// The installation mode for the Webview2 runtime. pub webview_install_mode: WebviewInstallMode, - /// Path to the webview fixed runtime to use. - /// - /// Overwrites [`Self::webview_install_mode`] if set. - /// - /// Will be removed in v2, use [`Self::webview_install_mode`] instead. - pub webview_fixed_runtime_path: Option, /// Validates a second app installation, blocking the user from installing an older version if set to `false`. /// /// For instance, if `1.2.1` is installed, the user won't be able to install app version `1.2.0` or `1.1.5`. @@ -533,7 +527,6 @@ impl Default for WindowsSettings { nsis: None, icon_path: PathBuf::from("icons/icon.ico"), webview_install_mode: Default::default(), - webview_fixed_runtime_path: None, allow_downgrades: true, sign_command: None, } diff --git a/tooling/bundler/src/bundle/windows/msi/wix.rs b/tooling/bundler/src/bundle/windows/msi/wix.rs index 9a3e195438c1..7e0f6d2b82b2 100644 --- a/tooling/bundler/src/bundle/windows/msi/wix.rs +++ b/tooling/bundler/src/bundle/windows/msi/wix.rs @@ -435,13 +435,7 @@ pub fn build_wix_app_installer( silent: silent_webview_install, } } else { - let mut webview_install_mode = settings.windows().webview_install_mode.clone(); - if let Some(fixed_runtime_path) = settings.windows().webview_fixed_runtime_path.clone() { - webview_install_mode = WebviewInstallMode::FixedRuntime { - path: fixed_runtime_path, - }; - } - webview_install_mode + settings.windows().webview_install_mode.clone() }; data.insert("install_webview", to_json(true)); diff --git a/tooling/bundler/src/bundle/windows/nsis.rs b/tooling/bundler/src/bundle/windows/nsis.rs index 079601bc1890..4d0bab8f6fc5 100644 --- a/tooling/bundler/src/bundle/windows/nsis.rs +++ b/tooling/bundler/src/bundle/windows/nsis.rs @@ -427,13 +427,7 @@ fn build_nsis_app_installer( silent: silent_webview2_install, } } else { - let mut webview_install_mode = settings.windows().webview_install_mode.clone(); - if let Some(fixed_runtime_path) = settings.windows().webview_fixed_runtime_path.clone() { - webview_install_mode = WebviewInstallMode::FixedRuntime { - path: fixed_runtime_path, - }; - } - webview_install_mode + settings.windows().webview_install_mode.clone() }; let webview2_installer_args = to_json(if silent_webview2_install { diff --git a/tooling/cli/schema.json b/tooling/cli/schema.json index 540673714d6f..f9396e298687 100644 --- a/tooling/cli/schema.json +++ b/tooling/cli/schema.json @@ -120,7 +120,6 @@ "signCommand": null, "timestampUrl": null, "tsp": false, - "webviewFixedRuntimePath": null, "webviewInstallMode": { "silent": true, "type": "downloadBootstrapper" @@ -1650,7 +1649,6 @@ "signCommand": null, "timestampUrl": null, "tsp": false, - "webviewFixedRuntimePath": null, "webviewInstallMode": { "silent": true, "type": "downloadBootstrapper" @@ -1998,13 +1996,6 @@ } ] }, - "webviewFixedRuntimePath": { - "description": "Path to the webview fixed runtime to use. Overwrites [`Self::webview_install_mode`] if set.\n\n Will be removed in v2, prefer the [`Self::webview_install_mode`] option.\n\n The fixed version can be downloaded [on the official website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section).\n The `.cab` file must be extracted to a folder and this folder path must be defined on this field.", - "type": [ - "string", - "null" - ] - }, "allowDowngrades": { "description": "Validates a second app installation, blocking the user from installing an older version if set to `false`.\n\n For instance, if `1.2.1` is installed, the user won't be able to install app version `1.2.0` or `1.1.5`.\n\n The default value of this flag is `true`.", "default": true, diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 85ea919650eb..62d1bdeaa209 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -1280,9 +1280,7 @@ fn tauri_config_to_bundle_settings( #[cfg(windows)] { - if let Some(webview_fixed_runtime_path) = &config.windows.webview_fixed_runtime_path { - resources.push(webview_fixed_runtime_path.display().to_string()); - } else if let crate::helpers::config::WebviewInstallMode::FixedRuntime { path } = + if let crate::helpers::config::WebviewInstallMode::FixedRuntime { path } = &config.windows.webview_install_mode { resources.push(path.display().to_string()); @@ -1423,7 +1421,6 @@ fn tauri_config_to_bundle_settings( nsis: config.windows.nsis.map(nsis_settings), icon_path: windows_icon_path, webview_install_mode: config.windows.webview_install_mode, - webview_fixed_runtime_path: config.windows.webview_fixed_runtime_path, allow_downgrades: config.windows.allow_downgrades, sign_command: config.windows.sign_command.map(custom_sign_settings), },