mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
refactor(core): remove deprecated webview_fixed_runtime_path option (#10772)
* refactor(core): remove deprecated webview_fixed_runtime_path option * update migration
This commit is contained in:
committed by
GitHub
parent
792340a73b
commit
073bb4f459
8
.changes/remove-webview_fixed_runtime_path.md
Normal file
8
.changes/remove-webview_fixed_runtime_path.md
Normal file
@@ -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.
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<PathBuf>,
|
||||
/// 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()
|
||||
|
||||
14
examples/api/src-tauri/Cargo.lock
generated
14
examples/api/src-tauri/Cargo.lock
generated
@@ -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",
|
||||
|
||||
@@ -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<PathBuf>,
|
||||
/// 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,
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
},
|
||||
|
||||
@@ -252,15 +252,39 @@ fn process_bundle(config: &mut Map<String, Value>, migrated: &MigratedConfig) {
|
||||
license_file = Some(license);
|
||||
}
|
||||
}
|
||||
|
||||
// Windows
|
||||
if let Some(windows) = bundle_config.get_mut("windows") {
|
||||
if let Some(wix) = windows.get_mut("wix").and_then(|v| v.as_object_mut()) {
|
||||
if let Some(license_path) = wix.remove("license") {
|
||||
license_file = Some(license_path);
|
||||
if let Some(windows) = windows.as_object_mut() {
|
||||
if let Some(wix) = windows.get_mut("wix").and_then(|v| v.as_object_mut()) {
|
||||
if let Some(license_path) = wix.remove("license") {
|
||||
license_file = Some(license_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(nsis) = windows.get_mut("nsis").and_then(|v| v.as_object_mut()) {
|
||||
if let Some(license_path) = nsis.remove("license") {
|
||||
license_file = Some(license_path);
|
||||
if let Some(nsis) = windows.get_mut("nsis").and_then(|v| v.as_object_mut()) {
|
||||
if let Some(license_path) = nsis.remove("license") {
|
||||
license_file = Some(license_path);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((fixed_runtime_path, key)) = windows
|
||||
.remove("webviewFixedRuntimePath")
|
||||
.map(|v| (v, "webviewInstallMode"))
|
||||
.or_else(|| {
|
||||
windows
|
||||
.remove("webview-fixed-runtime-path")
|
||||
.map(|v| (v, "webview-install-mode"))
|
||||
})
|
||||
{
|
||||
if !fixed_runtime_path.is_null() {
|
||||
windows.insert(
|
||||
key.into(),
|
||||
serde_json::json!({
|
||||
"type": "fixedRuntime",
|
||||
"path": fixed_runtime_path
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1083,4 +1107,29 @@ mod test {
|
||||
original["build"]["frontendDist"]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn migrate_webview_fixed_runtime_path() {
|
||||
let original = serde_json::json!({
|
||||
"tauri": {
|
||||
"bundle": {
|
||||
"windows": {
|
||||
"webviewFixedRuntimePath": "./path/to/runtime"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let migrated = migrate(&original);
|
||||
|
||||
assert_eq!(
|
||||
migrated["bundle"]["windows"]["webviewInstallMode"]["type"],
|
||||
"fixedRuntime"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
migrated["bundle"]["windows"]["webviewInstallMode"]["path"],
|
||||
original["tauri"]["bundle"]["windows"]["webviewFixedRuntimePath"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user