feat: use tauri next branch, fix tests, MSRV 1.65 (#354)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-12 17:16:50 -03:00
committed by GitHub
parent e0e7b4fc71
commit 937e6a5be6
64 changed files with 867 additions and 463 deletions
+7 -12
View File
@@ -1,20 +1,15 @@
[package]
name = "tauri-plugin-updater"
version = "0.0.0"
edition = "2021"
#edition.workspace = true
#authors.workspace = true
#license.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
[dependencies]
#tauri = { workspace = true, features = ["updater"] }
#serde.workspace = true
#serde_json.workspace = true
#thiserror.workspace = true
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["updater", "fs-extract-api"] }
serde = "1"
serde_json = "1"
thiserror = "1"
tauri = { workspace = true, features = ["updater", "fs-extract-api"] }
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio = "1"
reqwest = { version = "0.11", default-features = false, features = [ "json", "stream" ] }
+1 -1
View File
@@ -4,7 +4,7 @@ In-app updates for Tauri applications.
## Install
_This plugin requires a Rust version of at least **1.64**_
_This plugin requires a Rust version of at least **1.65**_
There are three general methods of installation that we can recommend.
+5 -6
View File
@@ -1,18 +1,17 @@
[package]
name = "app-updater"
version = "0.1.0"
edition = "2021"
#edition.workspace = true
edition.workspace = true
[build-dependencies]
tauri-build = { path = "../../../../../tauri/core/tauri-build", features = [] }
tauri-build.workspace = true
[dependencies]
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next" }
tauri.workspace = true
serde.workspace = true
serde_json.workspace = true
tauri-plugin-updater = { path = "../.." }
tiny_http = "0.11"
serde = "1"
serde_json = "1"
time = { version = "0.3", features = ["formatting"] }
[features]
+1 -1
View File
@@ -3,5 +3,5 @@
// SPDX-License-Identifier: MIT
fn main() {
tauri_build::build()
tauri_build::build()
}
+39 -39
View File
@@ -7,43 +7,43 @@
use tauri_plugin_updater::UpdaterExt;
fn main() {
let mut context = tauri::generate_context!();
if std::env::var("TARGET").unwrap_or_default() == "nsis" {
// /D sets the default installation directory ($INSTDIR),
// overriding InstallDir and InstallDirRegKey.
// It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.
// Only absolute paths are supported.
// NOTE: we only need this because this is an integration test and we don't want to install the app in the programs folder
context.config_mut().tauri.updater.windows.installer_args = vec![format!(
"/D={}",
tauri::utils::platform::current_exe()
.unwrap()
.parent()
.unwrap()
.display()
)];
}
tauri::Builder::default()
.plugin(tauri_plugin_updater::Builder::new().build())
.setup(|app| {
let handle = app.handle();
tauri::async_runtime::spawn(async move {
match handle.updater().check().await {
Ok(update) => {
if let Err(e) = update.download_and_install().await {
println!("{e}");
std::process::exit(1);
}
std::process::exit(0);
}
Err(e) => {
println!("{e}");
std::process::exit(1);
}
}
});
Ok(())
})
.run(context)
.expect("error while running tauri application");
let mut context = tauri::generate_context!();
if std::env::var("TARGET").unwrap_or_default() == "nsis" {
// /D sets the default installation directory ($INSTDIR),
// overriding InstallDir and InstallDirRegKey.
// It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.
// Only absolute paths are supported.
// NOTE: we only need this because this is an integration test and we don't want to install the app in the programs folder
context.config_mut().tauri.updater.windows.installer_args = vec![format!(
"/D={}",
tauri::utils::platform::current_exe()
.unwrap()
.parent()
.unwrap()
.display()
)];
}
tauri::Builder::default()
.plugin(tauri_plugin_updater::Builder::new().build())
.setup(|app| {
let handle = app.handle();
tauri::async_runtime::spawn(async move {
match handle.updater().check().await {
Ok(update) => {
if let Err(e) = update.download_and_install(|_event| {}).await {
println!("{e}");
std::process::exit(1);
}
std::process::exit(0);
}
Err(e) => {
println!("{e}");
std::process::exit(1);
}
}
});
Ok(())
})
.run(context)
.expect("error while running tauri application");
}
@@ -176,7 +176,7 @@ fn update_app() {
let target =
tauri_plugin_updater::target().expect("running updater test in an unsupported platform");
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let root_dir = manifest_dir.clone();
let root_dir = manifest_dir.join("../../../..");
let mut config = Config {
package: PackageConfig { version: "1.0.0" },