Merge branch 'feature/fallback_targets' of github.com:kandrelczyk/plugins-workspace into feature/fallback_targets

# Conflicts:
#	plugins/updater/tests/app-updater/tests/update.rs
pull/2624/head
Krzysztof Andrelczyk 4 months ago
commit ef952980e1

@ -46,7 +46,7 @@ struct Update {
platforms: HashMap<String, PlatformUpdate>, 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"); let mut command = Command::new("cargo");
command command
.args(["tauri", "build", "--debug", "--verbose"]) .args(["tauri", "build", "--debug", "--verbose"])
@ -56,20 +56,19 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, targets: Vec<Bun
.env("TAURI_SIGNING_PRIVATE_KEY_PASSWORD", "") .env("TAURI_SIGNING_PRIVATE_KEY_PASSWORD", "")
.current_dir(cwd); .current_dir(cwd);
let cmd_args = targets.into_iter().map(|t| t.name()).collect::<Vec<&str>>();
command.args(["--bundles"]);
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
command.args(cmd_args); command.args(["--bundles", target.name()]);
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
command.args(cmd_args); command.args(["--bundles", target.name()]);
if bundle_updater { if bundle_updater {
#[cfg(windows)] #[cfg(windows)]
command.args(["msi", "nsis"]); command.args(["--bundles", "msi", "nsis"]);
} else { } else {
#[cfg(windows)] #[cfg(windows)]
command.args(cmd_args); command.args(["--bundles", target.name()]);
} }
let status = command let status = command
.status() .status()
.expect("failed to run Tauri CLI to bundle app"); .expect("failed to run Tauri CLI to bundle app");
@ -79,6 +78,7 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, targets: Vec<Bun
} }
} }
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
enum BundleTarget { enum BundleTarget {
AppImage, AppImage,
@ -105,13 +105,13 @@ impl BundleTarget {
} }
impl BundleTarget { impl BundleTarget {
fn get_targets() -> Vec<Self> { fn default() -> Self {
#[cfg(any(target_os = "macos", target_os = "ios"))] #[cfg(any(target_os = "macos", target_os = "ios"))]
return vec![Self::App]; return Self::App;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
return vec![Self::AppImage]; return Self::AppImage;
#[cfg(windows)] #[cfg(windows)]
return vec![Self::Nsis]; return Self::Nsis;
} }
} }
@ -201,11 +201,11 @@ fn bundle_path(root_dir: &Path, _version: &str, v1compatible: bool) -> PathBuf {
} }
#[cfg(windows)] #[cfg(windows)]
fn test_cases( fn bundle_paths(
root_dir: &Path, root_dir: &Path,
version: &str, version: &str,
target: String v1compatible: bool,
) -> Vec<(BundleTarget, PathBuf, Option<String>, Vec<i32>)> { ) -> Vec<(BundleTarget, PathBuf)> {
vec![ vec![
( (
BundleTarget::Nsis, BundleTarget::Nsis,
@ -385,7 +385,7 @@ fn update_app() {
config.version = "0.1.0"; config.version = "0.1.0";
// bundle initial app version // 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 { for expected_exit_code in status_checks {
let mut binary_cmd = if cfg!(windows) { let mut binary_cmd = if cfg!(windows) {

Loading…
Cancel
Save