Skip to content

Commit

Permalink
refactor: remove wix from default targets on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
amr-crabnebula committed Sep 18, 2023
1 parent 32d390c commit 7f13e32
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,38 @@ impl PackageFormat {
ALL_PACKAGE_TYPES
}

/// Returns the default list of targets this platform
///
/// - **macOS**: App, Dmg
/// - **Windows**: Nsis
/// - **Linux**: Deb, AppImage
pub fn platform_defaults() -> &'static [PackageFormat] {
&[
#[cfg(target_os = "macos")]
PackageFormat::App,
#[cfg(target_os = "macos")]
PackageFormat::Dmg,
#[cfg(target_os = "windows")]
PackageFormat::Nsis,
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
PackageFormat::Deb,
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
PackageFormat::AppImage,
]
}

/// 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
Expand Down
2 changes: 1 addition & 1 deletion crates/packager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn package(config: &Config) -> Result<Vec<Package>> {
let mut formats = config
.formats
.clone()
.unwrap_or_else(|| PackageFormat::all().to_vec());
.unwrap_or_else(|| PackageFormat::platform_defaults().to_vec());
formats.sort_by_key(|f| f.priority());

let formats_comma_separated = formats
Expand Down

0 comments on commit 7f13e32

Please sign in to comment.