Skip to content

Commit

Permalink
refactor(core): remove deprecated webview_fixed_runtime_path option
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Aug 25, 2024
1 parent 09e9dc1 commit 5926351
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 76 deletions.
8 changes: 8 additions & 0 deletions .changes/remove-webview_fixed_runtime_path.md
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 4 additions & 9 deletions core/tauri-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
9 changes: 0 additions & 9 deletions core/tauri-config-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"signCommand": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
"webviewInstallMode": {
"silent": true,
"type": "downloadBootstrapper"
Expand Down Expand Up @@ -1650,7 +1649,6 @@
"signCommand": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
"webviewInstallMode": {
"silent": true,
"type": "downloadBootstrapper"
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 1 addition & 17 deletions core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down
14 changes: 7 additions & 7 deletions examples/api/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions tooling/bundler/src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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,
}
Expand Down
8 changes: 1 addition & 7 deletions tooling/bundler/src/bundle/windows/msi/wix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
8 changes: 1 addition & 7 deletions tooling/bundler/src/bundle/windows/nsis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 0 additions & 9 deletions tooling/cli/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"signCommand": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
"webviewInstallMode": {
"silent": true,
"type": "downloadBootstrapper"
Expand Down Expand Up @@ -1650,7 +1649,6 @@
"signCommand": null,
"timestampUrl": null,
"tsp": false,
"webviewFixedRuntimePath": null,
"webviewInstallMode": {
"silent": true,
"type": "downloadBootstrapper"
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions tooling/cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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),
},
Expand Down

0 comments on commit 5926351

Please sign in to comment.