fix bundler

pull/2624/head
Krzysztof Andrelczyk 3 months ago
parent 0630002c65
commit 3a433976f3
No known key found for this signature in database
GPG Key ID: 1381C9E2A2973DBF

30
Cargo.lock generated

@ -6457,7 +6457,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "2.3.1" version = "2.4.1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -6490,11 +6490,11 @@ dependencies = [
"serialize-to-javascript", "serialize-to-javascript",
"specta", "specta",
"swift-rs", "swift-rs",
"tauri-build 2.0.6", "tauri-build 2.1.1",
"tauri-macros", "tauri-macros",
"tauri-runtime", "tauri-runtime",
"tauri-runtime-wry", "tauri-runtime-wry",
"tauri-utils 2.2.0", "tauri-utils 2.3.1",
"thiserror 2.0.9", "thiserror 2.0.9",
"tokio", "tokio",
"tray-icon", "tray-icon",
@ -6533,7 +6533,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-build" name = "tauri-build"
version = "2.0.6" version = "2.1.1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml 0.22.1", "cargo_toml 0.22.1",
@ -6545,7 +6545,7 @@ dependencies = [
"semver", "semver",
"serde", "serde",
"serde_json", "serde_json",
"tauri-utils 2.2.0", "tauri-utils 2.3.1",
"tauri-winres 0.3.0", "tauri-winres 0.3.0",
"toml 0.8.19", "toml 0.8.19",
"walkdir", "walkdir",
@ -6579,7 +6579,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-codegen" name = "tauri-codegen"
version = "2.0.5" version = "2.1.1"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"brotli", "brotli",
@ -6594,7 +6594,7 @@ dependencies = [
"serde_json", "serde_json",
"sha2", "sha2",
"syn 2.0.90", "syn 2.0.90",
"tauri-utils 2.2.0", "tauri-utils 2.3.1",
"thiserror 2.0.9", "thiserror 2.0.9",
"time", "time",
"url", "url",
@ -6604,14 +6604,14 @@ dependencies = [
[[package]] [[package]]
name = "tauri-macros" name = "tauri-macros"
version = "2.0.5" version = "2.1.1"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.90", "syn 2.0.90",
"tauri-codegen 2.0.5", "tauri-codegen 2.1.1",
"tauri-utils 2.2.0", "tauri-utils 2.3.1",
] ]
[[package]] [[package]]
@ -7115,7 +7115,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime" name = "tauri-runtime"
version = "2.4.0" version = "2.5.1"
dependencies = [ dependencies = [
"cookie", "cookie",
"dpi", "dpi",
@ -7125,7 +7125,7 @@ dependencies = [
"raw-window-handle", "raw-window-handle",
"serde", "serde",
"serde_json", "serde_json",
"tauri-utils 2.2.0", "tauri-utils 2.3.1",
"thiserror 2.0.9", "thiserror 2.0.9",
"url", "url",
"windows 0.60.0", "windows 0.60.0",
@ -7133,7 +7133,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime-wry" name = "tauri-runtime-wry"
version = "2.4.1" version = "2.5.1"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
@ -7148,7 +7148,7 @@ dependencies = [
"softbuffer", "softbuffer",
"tao", "tao",
"tauri-runtime", "tauri-runtime",
"tauri-utils 2.2.0", "tauri-utils 2.3.1",
"url", "url",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
@ -7197,7 +7197,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-utils" name = "tauri-utils"
version = "2.2.0" version = "2.3.1"
dependencies = [ dependencies = [
"aes-gcm", "aes-gcm",
"anyhow", "anyhow",

@ -29,6 +29,12 @@ pub use config::Config;
pub use error::{Error, Result}; pub use error::{Error, Result};
pub use updater::*; pub use updater::*;
/// Variable holding the type of bundle the executable is stored in. This is modified by binary
/// patching during build
#[unsafe(no_mangle)]
#[link_section = ".data.ta"]
pub static __TAURI_BUNDLE_TYPE: &str = "UNK_BUNDLE";
/// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the updater APIs. /// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the updater APIs.
pub trait UpdaterExt<R: Runtime> { pub trait UpdaterExt<R: Runtime> {
/// Gets the updater builder to build and updater /// Gets the updater builder to build and updater

@ -29,7 +29,7 @@ use url::Url;
use crate::{ use crate::{
error::{Error, Result}, error::{Error, Result},
Config, Config, __TAURI_BUNDLE_TYPE,
}; };
const UPDATER_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),); const UPDATER_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);
@ -363,7 +363,7 @@ pub struct Updater {
impl Updater { impl Updater {
fn get_updater_installer(&self) -> Result<Option<Installer>> { fn get_updater_installer(&self) -> Result<Option<Installer>> {
match tauri::__TAURI_BUNDLE_TYPE { match __TAURI_BUNDLE_TYPE {
"DEB_BUNDLE" => Ok(Some(Installer::Deb)), "DEB_BUNDLE" => Ok(Some(Installer::Deb)),
"RPM_BUNDLE" => Ok(Some(Installer::Rpm)), "RPM_BUNDLE" => Ok(Some(Installer::Rpm)),
"APP_BUNDLE" => Ok(Some(Installer::AppImage)), "APP_BUNDLE" => Ok(Some(Installer::AppImage)),

@ -9,7 +9,6 @@ use tauri_plugin_updater::UpdaterExt;
fn main() { fn main() {
#[allow(unused_mut)] #[allow(unused_mut)]
let mut context = tauri::generate_context!(); let mut context = tauri::generate_context!();
println!("{}", tauri::__TAURI_BUNDLE_TYPE);
tauri::Builder::default() tauri::Builder::default()
.plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_updater::Builder::new().build())
.setup(|app| { .setup(|app| {

@ -2,6 +2,7 @@
"identifier": "com.tauri.updater", "identifier": "com.tauri.updater",
"plugins": { "plugins": {
"updater": { "updater": {
"dangerousInsecureTransportProtocol": true,
"endpoints": ["http://localhost:3007"], "endpoints": ["http://localhost:3007"],
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUwNDRGMjkwRjg2MDhCRDAKUldUUWkyRDRrUEpFNEQ4SmdwcU5PaXl6R2ZRUUNvUnhIaVkwVUltV0NMaEx6VTkrWVhpT0ZqeEEK", "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUwNDRGMjkwRjg2MDhCRDAKUldUUWkyRDRrUEpFNEQ4SmdwcU5PaXl6R2ZRUUNvUnhIaVkwVUltV0NMaEx6VTkrWVhpT0ZqeEEK",
"windows": { "windows": {

@ -78,7 +78,6 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTa
} }
} }
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
enum BundleTarget { enum BundleTarget {
AppImage, AppImage,
@ -119,7 +118,6 @@ fn target_to_platforms(
update_platform: Option<String>, update_platform: Option<String>,
signature: String, signature: String,
) -> HashMap<String, PlatformUpdate> { ) -> HashMap<String, PlatformUpdate> {
let mut platforms = HashMap::new(); let mut platforms = HashMap::new();
if let Some(platform) = update_platform { if let Some(platform) = update_platform {
println!("TARGET: {}", platform.clone()); println!("TARGET: {}", platform.clone());
@ -207,7 +205,7 @@ fn bundle_path(root_dir: &Path, _version: &str, v1compatible: bool) -> PathBuf {
fn test_cases( fn test_cases(
root_dir: &Path, root_dir: &Path,
version: &str, version: &str,
target: String target: String,
) -> Vec<(BundleTarget, PathBuf, Option<String>, Vec<i32>)> { ) -> Vec<(BundleTarget, PathBuf, Option<String>, Vec<i32>)> {
vec![ vec![
( (
@ -216,7 +214,7 @@ fn test_cases(
"target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe" "target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe"
)), )),
Some(target.clone()), Some(target.clone()),
vec![UPDATED_EXIT_CODE] vec![UPDATED_EXIT_CODE],
), ),
( (
BundleTarget::Nsis, BundleTarget::Nsis,
@ -224,7 +222,7 @@ fn test_cases(
"target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe" "target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe"
)), )),
Some(format!("{target}-{}", BundleTarget::Nsis.name())), Some(format!("{target}-{}", BundleTarget::Nsis.name())),
vec![UPDATED_EXIT_CODE] vec![UPDATED_EXIT_CODE],
), ),
( (
BundleTarget::Nsis, BundleTarget::Nsis,
@ -232,7 +230,7 @@ fn test_cases(
"target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe" "target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe"
)), )),
None, None,
vec![ERROR_EXIT_CODE] vec![ERROR_EXIT_CODE],
), ),
( (
BundleTarget::Msi, BundleTarget::Msi,
@ -240,7 +238,7 @@ fn test_cases(
"target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi" "target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi"
)), )),
Some(target.clone()), Some(target.clone()),
vec![UPDATED_EXIT_CODE] vec![UPDATED_EXIT_CODE],
), ),
( (
BundleTarget::Msi, BundleTarget::Msi,
@ -248,7 +246,7 @@ fn test_cases(
"target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi" "target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi"
)), )),
Some(format!("{target}-{}", BundleTarget::Msi.name())), Some(format!("{target}-{}", BundleTarget::Msi.name())),
vec![UPDATED_EXIT_CODE] vec![UPDATED_EXIT_CODE],
), ),
( (
BundleTarget::Msi, BundleTarget::Msi,
@ -256,8 +254,8 @@ fn test_cases(
"target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi" "target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi"
)), )),
None, None,
vec![ERROR_EXIT_CODE] vec![ERROR_EXIT_CODE],
) ),
] ]
} }
@ -287,7 +285,6 @@ fn update_app() {
Updater::String(V1Compatible::V1Compatible) Updater::String(V1Compatible::V1Compatible)
); );
let updater_zip_ext = if v1_compatible { let updater_zip_ext = if v1_compatible {
if cfg!(windows) { if cfg!(windows) {
Some("zip") Some("zip")

Loading…
Cancel
Save