diff --git a/.changes/bundler-bundle-order.md b/.changes/bundler-bundle-order.md new file mode 100644 index 00000000000..35f5443f0c2 --- /dev/null +++ b/.changes/bundler-bundle-order.md @@ -0,0 +1,5 @@ +--- +'tauri-bundler': 'patch:bug' +--- + +Fix bundler skipping updater artifacts if `updater` target shows before other updater-enabled targets in the list, see [#7349](https://github.com/tauri-apps/tauri/issues/7349). diff --git a/tooling/bundler/src/bundle.rs b/tooling/bundler/src/bundle.rs index 04966bac662..375ad212c66 100644 --- a/tooling/bundler/src/bundle.rs +++ b/tooling/bundler/src/bundle.rs @@ -43,11 +43,13 @@ pub struct Bundle { /// Bundles the project. /// Returns the list of paths where the bundles can be found. pub fn bundle_project(settings: Settings) -> crate::Result> { - let package_types = settings.package_types()?; + let mut package_types = settings.package_types()?; if package_types.is_empty() { return Ok(Vec::new()); } + package_types.sort_by_key(|a| a.priority()); + let mut bundles: Vec = Vec::new(); let target_os = settings diff --git a/tooling/bundler/src/bundle/settings.rs b/tooling/bundler/src/bundle/settings.rs index ed09964c650..613e12931fc 100644 --- a/tooling/bundler/src/bundle/settings.rs +++ b/tooling/bundler/src/bundle/settings.rs @@ -93,6 +93,26 @@ impl PackageType { pub fn all() -> &'static [PackageType] { ALL_PACKAGE_TYPES } + + /// Gets a number representing priority which used to sort package types + /// in an order that guarantees that if a certain package type + /// depends on another (like Dmg depending on MacOsBundle), the dependency + /// will be built first + /// + /// The lower the number, the higher the priority + pub fn priority(&self) -> u32 { + match self { + PackageType::MacOsBundle => 0, + PackageType::IosBundle => 0, + PackageType::WindowsMsi => 0, + PackageType::Nsis => 0, + PackageType::Deb => 0, + PackageType::Rpm => 0, + PackageType::AppImage => 0, + PackageType::Dmg => 1, + PackageType::Updater => 2, + } + } } const ALL_PACKAGE_TYPES: &[PackageType] = &[ diff --git a/tooling/cli/src/build.rs b/tooling/cli/src/build.rs index 6b668b91c46..cd51e802d45 100644 --- a/tooling/cli/src/build.rs +++ b/tooling/cli/src/build.rs @@ -324,7 +324,7 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> { "The updater secret key from `TAURI_PRIVATE_KEY` does not match the public key defined in `tauri.conf.json > tauri > updater > pubkey`." )); } - signed_paths.append(&mut vec![signature_path]); + signed_paths.push(signature_path); } }