Files
Sable/src-tauri/build.rs
T
Erwan Leboucher 0ac23e92dd feat: optional tauri auto-updater behind cargo feature
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
2026-07-20 18:40:08 +02:00

30 lines
1.2 KiB
Rust

fn main() {
println!("cargo:rustc-env=TS_RS_EXPORT_DIR=../src/app/generated/tauri");
// Find libcef.so next to the binary (CEF ships it there).
if std::env::var_os("CARGO_FEATURE_CEF").is_some()
&& std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("linux")
{
println!("cargo:rustc-link-arg-bins=-Wl,-rpath,$ORIGIN");
}
// The notifications plugin links the Swift runtime via @rpath.
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
println!("cargo:rustc-link-arg-bins=-Wl,-rpath,/usr/lib/swift");
}
tauri_typegen::BuildSystem::generate_at_build_time()
.expect("Failed to generate TypeScript bindings");
// 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");
}