Skip to content

Commit 6a6f1e7

Browse files
authored
fix(bundler): build updater bundle for all .msi files (#3520)
1 parent d06efc7 commit 6a6f1e7

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

.changes/fix-updater-msi.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch
3+
---
4+
5+
Properly create the updater bundle for all generated Microsoft Installer files.

tooling/bundler/src/bundle.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use common::{print_finished, print_info};
2929
use std::path::PathBuf;
3030

3131
/// Generated bundle metadata.
32+
#[derive(Debug)]
3233
pub struct Bundle {
3334
/// The package type.
3435
pub package_type: PackageType,

tooling/bundler/src/bundle/updater_bundle.rs

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -123,35 +123,33 @@ fn bundle_update(settings: &Settings, bundles: &[Bundle]) -> crate::Result<Vec<P
123123
#[cfg(target_os = "windows")]
124124
fn bundle_update(settings: &Settings, bundles: &[Bundle]) -> crate::Result<Vec<PathBuf>> {
125125
// find our .msi or rebuild
126-
let bundle_path = match bundles
126+
let mut bundle_paths = bundles
127127
.iter()
128-
.filter(|bundle| bundle.package_type == crate::PackageType::WindowsMsi)
129-
.find_map(|bundle| {
130-
bundle
131-
.bundle_paths
132-
.iter()
133-
.find(|path| path.extension() == Some(OsStr::new("msi")))
134-
}) {
135-
Some(path) => vec![path.clone()],
136-
None => msi::bundle_project(settings)?,
137-
};
128+
.find(|bundle| bundle.package_type == crate::PackageType::WindowsMsi)
129+
.map(|bundle| bundle.bundle_paths.clone())
130+
.unwrap_or_default();
138131

139-
// we expect our .msi to be on bundle_path[0]
140-
if bundle_path.is_empty() {
141-
return Err(crate::Error::UnableToFindProject);
132+
// we expect our .msi files to be on `bundle_paths`
133+
if bundle_paths.is_empty() {
134+
bundle_paths.extend(msi::bundle_project(settings)?);
142135
}
143136

144-
let source_path = &bundle_path[0];
137+
let mut msi_archived_paths = Vec::new();
145138

146-
// add .tar.gz to our path
147-
let msi_archived = format!("{}.zip", source_path.display());
148-
let msi_archived_path = PathBuf::from(&msi_archived);
139+
for source_path in bundle_paths {
140+
// add .zip to our path
141+
let msi_archived = format!("{}.zip", source_path.display());
142+
let msi_archived_path = PathBuf::from(&msi_archived);
149143

150-
// Create our gzip file
151-
create_zip(source_path, &msi_archived_path).with_context(|| "Failed to zip update MSI")?;
144+
common::print_bundling(format!("{:?}", &msi_archived_path).as_str())?;
145+
146+
// Create our gzip file
147+
create_zip(&source_path, &msi_archived_path).with_context(|| "Failed to zip update MSI")?;
148+
149+
msi_archived_paths.push(msi_archived_path);
150+
}
152151

153-
common::print_bundling(format!("{:?}", &msi_archived_path).as_str())?;
154-
Ok(vec![msi_archived_path])
152+
Ok(msi_archived_paths)
155153
}
156154

157155
#[cfg(target_os = "windows")]

tooling/bundler/src/bundle/windows/msi/wix.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ pub fn build_wix_app_installer(
410410
Ok(())
411411
};
412412

413-
common::print_info("trying to sign app")?;
414413
try_sign(&app_exe_source)?;
415414

416415
// ensure that `target/{release, debug}/wix` folder exists

0 commit comments

Comments
 (0)