fix windows build

pull/2624/head
Krzysztof Andrelczyk 4 months ago
parent 199a52b344
commit ede0c68622

@ -46,7 +46,7 @@ struct Update {
platforms: HashMap<String, PlatformUpdate>,
}
fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, targets: Vec<BundleTarget>) {
fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTarget) {
let mut command = Command::new("cargo");
command
.args(["tauri", "build", "--debug", "--verbose"])
@ -56,21 +56,19 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, targets: Vec<Bun
.env("TAURI_SIGNING_PRIVATE_KEY_PASSWORD", "")
.current_dir(cwd);
command.args(["--bundles"]);
#[cfg(target_os = "linux")]
command.args(targets.into_iter().map(|t| t.name()).collect::<Vec<&str>>());
command.args(["--bundles", target.name()]);
#[cfg(target_os = "macos")]
command.args([target.name()]);
command.args(["--bundles", target.name()]);
if bundle_updater {
#[cfg(windows)]
command.args(["msi", "nsis"]);
command.args(["updater"]);
command.args(["--bundles", "msi", "nsis"]);
} else {
#[cfg(windows)]
command.args([target.name()]);
command.args(["--bundles", target.name()]);
}
let status = command
.status()
.expect("failed to run Tauri CLI to bundle app");
@ -80,6 +78,7 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, targets: Vec<Bun
}
}
#[derive(Copy, Clone)]
enum BundleTarget {
AppImage,
@ -106,13 +105,13 @@ impl BundleTarget {
}
impl BundleTarget {
fn get_targets() -> Vec<Self> {
fn default() -> Self {
#[cfg(any(target_os = "macos", target_os = "ios"))]
return vec![Self::App];
return Self::App;
#[cfg(target_os = "linux")]
return vec![Self::AppImage];
return Self::AppImage;
#[cfg(windows)]
return vec![Self::Nsis];
return Self::Nsis;
}
}
@ -267,7 +266,7 @@ fn update_app() {
{
// bundle app update
config.version = "1.0.0";
build_app(&manifest_dir, &config, true, BundleTarget::get_targets());
build_app(&manifest_dir, &config, true, BundleTarget::default());
let bundle_updater_ext = if v1_compatible {
out_bundle_path
@ -350,7 +349,7 @@ fn update_app() {
config.version = "0.1.0";
// bundle initial app version
build_app(&manifest_dir, &config, false, vec![bundle_target]);
build_app(&manifest_dir, &config, false, bundle_target);
for expected_exit_code in status_checks {
let mut binary_cmd = if cfg!(windows) {

Loading…
Cancel
Save