fix(bundler): build updater bundle for all .msi files (#3520)

This commit is contained in:
Lucas Fernandes Nogueira 2022-02-24 10:05:58 -03:00 committed by GitHub
parent d06efc7704
commit 6a6f1e7bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 23 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---
Properly create the updater bundle for all generated Microsoft Installer files.

View File

@ -29,6 +29,7 @@ use common::{print_finished, print_info};
use std::path::PathBuf;
/// Generated bundle metadata.
#[derive(Debug)]
pub struct Bundle {
/// The package type.
pub package_type: PackageType,

View File

@ -123,35 +123,33 @@ fn bundle_update(settings: &Settings, bundles: &[Bundle]) -> crate::Result<Vec<P
#[cfg(target_os = "windows")]
fn bundle_update(settings: &Settings, bundles: &[Bundle]) -> crate::Result<Vec<PathBuf>> {
// find our .msi or rebuild
let bundle_path = match bundles
let mut bundle_paths = bundles
.iter()
.filter(|bundle| bundle.package_type == crate::PackageType::WindowsMsi)
.find_map(|bundle| {
bundle
.bundle_paths
.iter()
.find(|path| path.extension() == Some(OsStr::new("msi")))
}) {
Some(path) => vec![path.clone()],
None => msi::bundle_project(settings)?,
};
.find(|bundle| bundle.package_type == crate::PackageType::WindowsMsi)
.map(|bundle| bundle.bundle_paths.clone())
.unwrap_or_default();
// we expect our .msi to be on bundle_path[0]
if bundle_path.is_empty() {
return Err(crate::Error::UnableToFindProject);
// we expect our .msi files to be on `bundle_paths`
if bundle_paths.is_empty() {
bundle_paths.extend(msi::bundle_project(settings)?);
}
let source_path = &bundle_path[0];
let mut msi_archived_paths = Vec::new();
// add .tar.gz to our path
let msi_archived = format!("{}.zip", source_path.display());
let msi_archived_path = PathBuf::from(&msi_archived);
for source_path in bundle_paths {
// add .zip to our path
let msi_archived = format!("{}.zip", source_path.display());
let msi_archived_path = PathBuf::from(&msi_archived);
// Create our gzip file
create_zip(source_path, &msi_archived_path).with_context(|| "Failed to zip update MSI")?;
common::print_bundling(format!("{:?}", &msi_archived_path).as_str())?;
common::print_bundling(format!("{:?}", &msi_archived_path).as_str())?;
Ok(vec![msi_archived_path])
// Create our gzip file
create_zip(&source_path, &msi_archived_path).with_context(|| "Failed to zip update MSI")?;
msi_archived_paths.push(msi_archived_path);
}
Ok(msi_archived_paths)
}
#[cfg(target_os = "windows")]

View File

@ -410,7 +410,6 @@ pub fn build_wix_app_installer(
Ok(())
};
common::print_info("trying to sign app")?;
try_sign(&app_exe_source)?;
// ensure that `target/{release, debug}/wix` folder exists