mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 17:11:17 -08:00
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
30 lines
1.2 KiB
Rust
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");
|
|
}
|