mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-18 16:57:19 +02:00
fix bundler
This commit is contained in:
@@ -29,6 +29,12 @@ pub use config::Config;
|
||||
pub use error::{Error, Result};
|
||||
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.
|
||||
pub trait UpdaterExt<R: Runtime> {
|
||||
/// Gets the updater builder to build and updater
|
||||
|
||||
@@ -29,7 +29,7 @@ use url::Url;
|
||||
|
||||
use crate::{
|
||||
error::{Error, Result},
|
||||
Config,
|
||||
Config, __TAURI_BUNDLE_TYPE,
|
||||
};
|
||||
|
||||
const UPDATER_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);
|
||||
@@ -363,7 +363,7 @@ pub struct Updater {
|
||||
|
||||
impl Updater {
|
||||
fn get_updater_installer(&self) -> Result<Option<Installer>> {
|
||||
match tauri::__TAURI_BUNDLE_TYPE {
|
||||
match __TAURI_BUNDLE_TYPE {
|
||||
"DEB_BUNDLE" => Ok(Some(Installer::Deb)),
|
||||
"RPM_BUNDLE" => Ok(Some(Installer::Rpm)),
|
||||
"APP_BUNDLE" => Ok(Some(Installer::AppImage)),
|
||||
|
||||
@@ -9,7 +9,6 @@ use tauri_plugin_updater::UpdaterExt;
|
||||
fn main() {
|
||||
#[allow(unused_mut)]
|
||||
let mut context = tauri::generate_context!();
|
||||
println!("{}", tauri::__TAURI_BUNDLE_TYPE);
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.setup(|app| {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"identifier": "com.tauri.updater",
|
||||
"plugins": {
|
||||
"updater": {
|
||||
"dangerousInsecureTransportProtocol": true,
|
||||
"endpoints": ["http://localhost:3007"],
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUwNDRGMjkwRjg2MDhCRDAKUldUUWkyRDRrUEpFNEQ4SmdwcU5PaXl6R2ZRUUNvUnhIaVkwVUltV0NMaEx6VTkrWVhpT0ZqeEEK",
|
||||
"windows": {
|
||||
|
||||
@@ -78,7 +78,6 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
enum BundleTarget {
|
||||
AppImage,
|
||||
@@ -119,7 +118,6 @@ fn target_to_platforms(
|
||||
update_platform: Option<String>,
|
||||
signature: String,
|
||||
) -> HashMap<String, PlatformUpdate> {
|
||||
|
||||
let mut platforms = HashMap::new();
|
||||
if let Some(platform) = update_platform {
|
||||
println!("TARGET: {}", platform.clone());
|
||||
@@ -207,7 +205,7 @@ fn bundle_path(root_dir: &Path, _version: &str, v1compatible: bool) -> PathBuf {
|
||||
fn test_cases(
|
||||
root_dir: &Path,
|
||||
version: &str,
|
||||
target: String
|
||||
target: String,
|
||||
) -> Vec<(BundleTarget, PathBuf, Option<String>, Vec<i32>)> {
|
||||
vec![
|
||||
(
|
||||
@@ -216,7 +214,7 @@ fn test_cases(
|
||||
"target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe"
|
||||
)),
|
||||
Some(target.clone()),
|
||||
vec![UPDATED_EXIT_CODE]
|
||||
vec![UPDATED_EXIT_CODE],
|
||||
),
|
||||
(
|
||||
BundleTarget::Nsis,
|
||||
@@ -224,7 +222,7 @@ fn test_cases(
|
||||
"target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe"
|
||||
)),
|
||||
Some(format!("{target}-{}", BundleTarget::Nsis.name())),
|
||||
vec![UPDATED_EXIT_CODE]
|
||||
vec![UPDATED_EXIT_CODE],
|
||||
),
|
||||
(
|
||||
BundleTarget::Nsis,
|
||||
@@ -232,7 +230,7 @@ fn test_cases(
|
||||
"target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe"
|
||||
)),
|
||||
None,
|
||||
vec![ERROR_EXIT_CODE]
|
||||
vec![ERROR_EXIT_CODE],
|
||||
),
|
||||
(
|
||||
BundleTarget::Msi,
|
||||
@@ -240,7 +238,7 @@ fn test_cases(
|
||||
"target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi"
|
||||
)),
|
||||
Some(target.clone()),
|
||||
vec![UPDATED_EXIT_CODE]
|
||||
vec![UPDATED_EXIT_CODE],
|
||||
),
|
||||
(
|
||||
BundleTarget::Msi,
|
||||
@@ -248,7 +246,7 @@ fn test_cases(
|
||||
"target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi"
|
||||
)),
|
||||
Some(format!("{target}-{}", BundleTarget::Msi.name())),
|
||||
vec![UPDATED_EXIT_CODE]
|
||||
vec![UPDATED_EXIT_CODE],
|
||||
),
|
||||
(
|
||||
BundleTarget::Msi,
|
||||
@@ -256,8 +254,8 @@ fn test_cases(
|
||||
"target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi"
|
||||
)),
|
||||
None,
|
||||
vec![ERROR_EXIT_CODE]
|
||||
)
|
||||
vec![ERROR_EXIT_CODE],
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -287,7 +285,6 @@ fn update_app() {
|
||||
Updater::String(V1Compatible::V1Compatible)
|
||||
);
|
||||
|
||||
|
||||
let updater_zip_ext = if v1_compatible {
|
||||
if cfg!(windows) {
|
||||
Some("zip")
|
||||
|
||||
Reference in New Issue
Block a user