feat(updater): option to not restart after install (#3299)

* feat(updater): option to not restart after install

* More platform cfg

* Add the same function for `UpdaterBuilder`

* Fix missing `#[cfg(windows)]`

* Mark `current_exe_args` cfg(windows)

* Mark `on_before_exit` cfg(windows)

* Mark `installer_args` cfg(windows)

* Note about `installer_arg` apply to both

* Remove current args and restart together

* Only build needed bundle on windows as well

* Remove `/NS` since it breaks the msi updater

* Add launch updater debug log

* Add a folder to test updates

* Remove unused `#[allow(unused)]`

* Format

* messed up git stage

* Add change file

* Clean up

* Disable NSIS compression for API example

* Bump wry for v1 test to pull in https://github.com/tauri-apps/wry/pull/1703

* format

* Make typescript happy

* Close new update on destroy
This commit is contained in:
Tony
2026-07-21 18:25:16 +08:00
committed by GitHub
parent 3fb27bf13a
commit ab7489c964
16 changed files with 328 additions and 188 deletions
@@ -6,8 +6,7 @@
"endpoints": ["http://localhost:3007"],
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUwNDRGMjkwRjg2MDhCRDAKUldUUWkyRDRrUEpFNEQ4SmdwcU5PaXl6R2ZRUUNvUnhIaVkwVUltV0NMaEx6VTkrWVhpT0ZqeEEK",
"windows": {
"installMode": "quiet",
"installerArgs": ["/NS"]
"installMode": "quiet"
}
}
},
@@ -46,7 +46,7 @@ struct Update {
platforms: HashMap<String, PlatformUpdate>,
}
fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTarget) {
fn build_app(cwd: &Path, config: &Config, target: Option<BundleTarget>) {
let mut command = Command::new("cargo");
command
.args(["tauri", "build", "--verbose"])
@@ -56,17 +56,10 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTa
.env("TAURI_SIGNING_PRIVATE_KEY_PASSWORD", "")
.current_dir(cwd);
#[cfg(target_os = "linux")]
command.args(["--bundles", target.name()]);
#[cfg(target_os = "macos")]
command.args(["--bundles", target.name()]);
if bundle_updater {
#[cfg(windows)]
command.args(["--bundles", "msi", "nsis"]);
if let Some(target) = target {
command.arg("--bundles").arg(target.name());
} else {
#[cfg(windows)]
command.args(["--bundles", target.name()]);
command.arg("--no-bundle");
}
let status = command
@@ -318,7 +311,7 @@ fn update_app() {
{
// bundle app update
config.version = "1.0.0";
build_app(&manifest_dir, &config, true, BundleTarget::default());
build_app(&manifest_dir, &config, Some(bundle_target));
let bundle_updater_ext = if v1_compatible {
out_bundle_path
@@ -401,7 +394,7 @@ fn update_app() {
config.version = "0.1.0";
// bundle initial app version
build_app(&manifest_dir, &config, false, bundle_target);
build_app(&manifest_dir, &config, None);
for expected_exit_code in status_checks {
let mut binary_cmd = if cfg!(windows) {
+3 -3
View File
@@ -3794,7 +3794,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.48.0",
]
[[package]]
@@ -4137,9 +4137,9 @@ dependencies = [
[[package]]
name = "wry"
version = "0.24.10"
version = "0.24.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00711278ed357350d44c749c286786ecac644e044e4da410d466212152383b45"
checksum = "4a2a144c3ab5e83e04724bc8e67cea552ffae413185fda459fafdae173fd985d"
dependencies = [
"base64 0.13.1",
"block",