feat(bundler): add option to skip webview2 runtime installation, closes #1606 (#1612)

This commit is contained in:
Lucas Fernandes Nogueira 2021-04-24 19:01:50 -03:00 committed by GitHub
parent 73a08abba8
commit d13afec204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---
Adds `skip_webview_install` config under `windows > wix` to disable Webview2 runtime installation after the app install.

View File

@ -184,6 +184,8 @@ pub struct WixSettings {
pub feature_refs: Vec<String>,
#[serde(default)]
pub merge_refs: Vec<String>,
#[serde(default)]
pub skip_webview_install: bool,
}
/// The Windows bundle settings.

View File

@ -175,6 +175,7 @@
{{/each~}}
</Feature>
{{#if install_webview}}
<!-- WebView2 -->
<Property Id="WVRTINSTALLED">
<RegistrySearch Id="WVRTInstalled" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw" Win64="no"/>
@ -185,6 +186,7 @@
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
</Custom>
</InstallExecuteSequence>
{{/if}}
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
</Product>

View File

@ -466,6 +466,7 @@ pub fn build_wix_app_installer(
let mut fragment_paths = Vec::new();
let mut handlebars = Handlebars::new();
let mut has_custom_template = false;
let mut install_webview = true;
if let Some(wix) = &settings.windows().wix {
data.insert("component_group_refs", to_json(&wix.component_group_refs));
@ -474,6 +475,7 @@ pub fn build_wix_app_installer(
data.insert("feature_refs", to_json(&wix.feature_refs));
data.insert("merge_refs", to_json(&wix.merge_refs));
fragment_paths = wix.fragment_paths.clone();
install_webview = !wix.skip_webview_install;
if let Some(temp_path) = &wix.template {
let template = std::fs::read_to_string(temp_path)?;
@ -490,7 +492,11 @@ pub fn build_wix_app_installer(
.register_template_string("main.wxs", include_str!("templates/main.wxs"))
.map_err(|e| e.to_string())
.expect("Failed to setup handlebar template");
};
}
if install_webview {
data.insert("install_webview", to_json(true));
}
if output_path.exists() {
remove_dir_all(&output_path)?;

View File

@ -57,6 +57,8 @@ pub struct WixConfig {
pub feature_refs: Vec<String>,
#[serde(default)]
pub merge_refs: Vec<String>,
#[serde(default)]
pub skip_webview_install: bool,
}
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]

View File

@ -1221,6 +1221,10 @@
"type": "string"
}
},
"skipWebviewInstall": {
"default": false,
"type": "boolean"
},
"template": {
"type": [
"string",

View File

@ -23,6 +23,7 @@ impl From<WixConfig> for tauri_bundler::WixSettings {
feature_group_refs: config.feature_group_refs,
feature_refs: config.feature_refs,
merge_refs: config.merge_refs,
skip_webview_install: config.skip_webview_install,
}
}
}