1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
mod appimage_bundle;
mod category;
pub mod common;
mod deb_bundle;
mod dmg_bundle;
mod ios_bundle;
mod macos_bundle;
#[cfg(target_os = "windows")]
mod msi_bundle;
mod path_utils;
mod platform;
mod rpm_bundle;
mod settings;
mod updater_bundle;
#[cfg(target_os = "windows")]
mod wix;
pub use self::{
category::AppCategory,
common::{print_error, print_info},
settings::{
BundleBinary, BundleSettings, DebianSettings, MacOsSettings, PackageSettings, PackageType,
Settings, SettingsBuilder, UpdaterSettings,
},
};
#[cfg(windows)]
pub use settings::{WindowsSettings, WixSettings};
use common::print_finished;
use std::path::PathBuf;
pub struct Bundle {
pub package_type: PackageType,
pub bundle_paths: Vec<PathBuf>,
}
pub fn bundle_project(settings: Settings) -> crate::Result<Vec<Bundle>> {
let mut bundles = Vec::new();
let package_types = settings.package_types()?;
for package_type in &package_types {
let bundle_paths = match package_type {
PackageType::MacOsBundle => macos_bundle::bundle_project(&settings)?,
PackageType::IosBundle => ios_bundle::bundle_project(&settings)?,
#[cfg(target_os = "windows")]
PackageType::WindowsMsi => msi_bundle::bundle_project(&settings)?,
PackageType::Deb => deb_bundle::bundle_project(&settings)?,
PackageType::Rpm => rpm_bundle::bundle_project(&settings)?,
PackageType::AppImage => appimage_bundle::bundle_project(&settings)?,
PackageType::Dmg => dmg_bundle::bundle_project(&settings, &bundles)?,
PackageType::Updater => updater_bundle::bundle_project(&settings, &bundles)?,
};
bundles.push(Bundle {
package_type: package_type.to_owned(),
bundle_paths,
});
}
settings.copy_resources(settings.project_out_directory())?;
settings.copy_binaries(settings.project_out_directory())?;
print_finished(&bundles)?;
Ok(bundles)
}
pub fn check_icons(settings: &Settings) -> crate::Result<bool> {
let mut iter = settings.icon_files().peekable();
if iter.peek().is_none() {
Ok(false)
} else {
Ok(true)
}
}