diff --git a/crates/tauri-plugin-holochain/Cargo.toml b/crates/tauri-plugin-holochain/Cargo.toml index 78eaf2f7..ce86b934 100644 --- a/crates/tauri-plugin-holochain/Cargo.toml +++ b/crates/tauri-plugin-holochain/Cargo.toml @@ -63,3 +63,10 @@ async-trait = "0.1" [build-dependencies] tauri-plugin = { version = "2.0.0-rc", features = ["build"] } + +[features] +default = ["gossip_arc_normal"] + +gossip_arc_empty = [] +gossip_arc_full = [] +gossip_arc_normal = [] \ No newline at end of file diff --git a/crates/tauri-plugin-holochain/src/features.rs b/crates/tauri-plugin-holochain/src/features.rs new file mode 100644 index 00000000..37e319f8 --- /dev/null +++ b/crates/tauri-plugin-holochain/src/features.rs @@ -0,0 +1,15 @@ +#[cfg(all(feature = "gossip_arc_empty", feature = "gossip_arc_full"))] +compile_error!( + "The `gossip_arc_empty` and `gossip_arc_full` features are both enabled, which is an error. Please enable only one." +); +#[cfg(all(feature = "gossip_arc_empty", feature = "gossip_arc_normal"))] +compile_error!( + "The `gossip_arc_empty` and `gossip_arc_normal` features are both enabled, which is an error. Please enable only one." +); +#[cfg(all(feature = "gossip_arc_full", feature = "gossip_arc_normal"))] +compile_error!( + "The `gossip_arc_full` and `gossip_arc_normal` features are both enabled, which is an error. Please enable only one." +); + +#[cfg(all(not(feature = "gossip_arc_empty"), not(feature = "gossip_arc_full"), not(feature = "gossip_arc_normal")))] +compile_error!("All of the `gossip_arc_empty`, `gossip_arc_full`, and `gossip_arc_normal` features are disabled. Please enable one of them."); diff --git a/crates/tauri-plugin-holochain/src/launch.rs b/crates/tauri-plugin-holochain/src/launch.rs index dd33d739..c808cc49 100644 --- a/crates/tauri-plugin-holochain/src/launch.rs +++ b/crates/tauri-plugin-holochain/src/launch.rs @@ -18,12 +18,19 @@ mod mdns; mod signal; use mdns::spawn_mdns_bootstrap; +#[cfg(feature="gossip_arc_empty")] fn override_gossip_arc_clamping() -> Option { - if cfg!(mobile) { - Some(String::from("empty")) - } else { - None - } + Some(String::from("empty")) +} + +#[cfg(feature="gossip_arc_full")] +fn override_gossip_arc_clamping() -> Option { + Some(String::from("full")) +} + +#[cfg(feature="gossip_arc_normal")] +fn override_gossip_arc_clamping() -> Option { + None } // pub static RUNNING_HOLOCHAIN: RwLock> = RwLock::const_new(None); diff --git a/crates/tauri-plugin-holochain/src/lib.rs b/crates/tauri-plugin-holochain/src/lib.rs index aa9eb2a0..052205c4 100644 --- a/crates/tauri-plugin-holochain/src/lib.rs +++ b/crates/tauri-plugin-holochain/src/lib.rs @@ -32,6 +32,7 @@ mod filesystem; mod http_server; mod lair_signer; mod launch; +mod features; use commands::install_web_app::{install_app, install_web_app, update_app, UpdateAppError}; pub use error::{Error, Result};