feat: optional tauri auto-updater behind cargo feature (#1149)

Add cargo feature (on by default) so downstream builders can disable the
Tauri auto-updater with --no-default-features --features wry.

- tauri-plugin-updater becomes an optional dependency
- plugin registration gated by #[cfg(all(desktop, feature = updater))]
- updater:default permission moved to its own
capabilities/updater/updater.json
- build.rs selects the capability glob based on the feature, since
tauri-build fails on permissions from missing plugins

<!-- Please read
https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before
submitting your pull request -->

### Description

<!-- Please include a summary of the change. Please also include
relevant motivation and context. List any dependencies that are required
for this change. -->

Fixes #

#### Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings

### AI disclosure:

- [ ] Partially AI assisted (clarify which code was AI assisted and
briefly explain what it does).
- [ ] Fully AI generated (explain what all the generated code does in
moderate detail).
<!-- Write any explanation required here, but do not generate the
explanation using AI!! You must prove you understand what the code in
this PR does. -->
This commit is contained in:
7w1 authored and GitHub committed 2026-07-20 19:10:06 +00:00
commit b059308491
8 files changed
+27 -8

No files matched your search

+4 -2
View File
@@ -70,7 +70,7 @@ tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugi
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "df09f08e64b840e4d51cde2720030836eed40f4c", default-features = false }
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-updater = "2"
tauri-plugin-updater = { version = "2", optional = true }
tauri-plugin-process = "2"
tauri-plugin-dialog = "2"
tauri-plugin-window-state = "2.4.1"
@@ -104,9 +104,11 @@ tauri-plugin-android-fs = { version = "=28.4.0", features = ["legacy-storage-per
jni = "0.21"
[features]
default = ["wry"]
default = ["wry", "updater"]
custom-protocol = ["tauri/custom-protocol"]
wry = ["tauri/wry"]
# Tauri auto-updater. Disable with --no-default-features --features wry,cef.
updater = ["dep:tauri-plugin-updater"]
# CEF (Chromium) runtime. Build with --no-default-features --features cef.
cef = ["dep:tauri-runtime-cef", "dep:cef"]
[patch.crates-io]
+10 -1
View File
@@ -16,5 +16,14 @@ fn main() {
tauri_typegen::BuildSystem::generate_at_build_time()
.expect("Failed to generate TypeScript bindings");
tauri_build::build()
// tauri-build fails on permissions from missing plugins, so only glob the
// updater capability file when the `updater` feature is on.
#[cfg(feature = "updater")]
let tauri_attrs =
tauri_build::Attributes::new().capabilities_path_pattern("./capabilities/**/*.json");
#[cfg(not(feature = "updater"))]
let tauri_attrs =
tauri_build::Attributes::new().capabilities_path_pattern("./capabilities/*.json");
tauri_build::try_build(tauri_attrs).expect("tauri-build failed");
}
-1
View File
@@ -8,7 +8,6 @@
"window-state:default",
"store:default",
"notifications:default",
"updater:default",
"process:default",
"dialog:default"
]
@@ -0,0 +1,7 @@
{
"$schema": "../../gen/schemas/desktop-schema.json",
"identifier": "updater-capability",
"platforms": ["macOS", "windows", "linux"],
"windows": ["main"],
"permissions": ["updater:default"]
}
+3 -1
View File
@@ -242,9 +242,11 @@ pub fn run() {
#[cfg(any(mobile, desktop))]
let builder = builder.plugin(tauri_plugin_notifications::init());
#[cfg(all(desktop, feature = "updater"))]
let builder = builder.plugin(tauri_plugin_updater::Builder::new().build());
#[cfg(desktop)]
let builder = builder
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_dialog::init());
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* Auto-generated TypeScript bindings for Tauri commands
* Generated by tauri-typegen v0.5.0
* Generated at: 2026-07-20T05:55:07.154868857+00:00
* Generated at: 2026-07-20T16:38:06.342501881+00:00
* Generator: none
*
* Do not edit manually - regenerate using: cargo tauri-typegen generate
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* Auto-generated TypeScript bindings for Tauri commands
* Generated by tauri-typegen v0.5.0
* Generated at: 2026-07-20T05:55:07.155133577+00:00
* Generated at: 2026-07-20T16:38:06.342846421+00:00
* Generator: none
*
* Do not edit manually - regenerate using: cargo tauri-typegen generate
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* Auto-generated TypeScript bindings for Tauri commands
* Generated by tauri-typegen v0.5.0
* Generated at: 2026-07-20T05:55:07.154428637+00:00
* Generated at: 2026-07-20T16:38:06.341992373+00:00
* Generator: none
*
* Do not edit manually - regenerate using: cargo tauri-typegen generate