From 72b6fdd71938dc4bdeac556e298cece658e40065 Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Tue, 6 Aug 2024 08:23:53 -0700 Subject: [PATCH 1/4] feat: specify gossip arc clamping via feature flag --- crates/tauri-plugin-holochain/Cargo.toml | 7 +++++++ crates/tauri-plugin-holochain/src/launch.rs | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/crates/tauri-plugin-holochain/Cargo.toml b/crates/tauri-plugin-holochain/Cargo.toml index 78eaf2f7..a2729e60 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_no_clamping"] + +gossip_arc_clamping_empty = [] +gossip_arc_clamping_full = [] +gossip_arc_no_clamping = [] \ No newline at end of file diff --git a/crates/tauri-plugin-holochain/src/launch.rs b/crates/tauri-plugin-holochain/src/launch.rs index dd33d739..b7307d0f 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_clamping_empty")] fn override_gossip_arc_clamping() -> Option { - if cfg!(mobile) { - Some(String::from("empty")) - } else { - None - } + Some(String::from("empty")) +} + +#[cfg(feature="gossip_arc_clamping_full")] +fn override_gossip_arc_clamping() -> Option { + Some(String::from("full")) +} + +#[cfg(feature="gossip_arc_no_clamping")] +fn override_gossip_arc_clamping() -> Option { + None } // pub static RUNNING_HOLOCHAIN: RwLock> = RwLock::const_new(None); From 31fe22929b85ef3a7dd459b54275c3dea7b08d00 Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Tue, 6 Aug 2024 15:34:19 -0700 Subject: [PATCH 2/4] build: only one gossip feature at a time --- crates/tauri-plugin-holochain/src/features.rs | 15 +++++++++++++++ crates/tauri-plugin-holochain/src/lib.rs | 1 + 2 files changed, 16 insertions(+) create mode 100644 crates/tauri-plugin-holochain/src/features.rs diff --git a/crates/tauri-plugin-holochain/src/features.rs b/crates/tauri-plugin-holochain/src/features.rs new file mode 100644 index 00000000..9b078bd9 --- /dev/null +++ b/crates/tauri-plugin-holochain/src/features.rs @@ -0,0 +1,15 @@ +#[cfg(all(feature = "gossip_arc_clamping_empty", feature = "gossip_arc_clamping_full"))] +compile_error!( + "The `gossip_arc_clamping_empty` and `gossip_arc_clamping_full` features are both enabled, which is an error. Please enable only once." +); +#[cfg(all(feature = "gossip_arc_clamping_empty", feature = "gossip_arc_no_clamping"))] +compile_error!( + "The `gossip_arc_clamping_empty` and `gossip_arc_no_clamping` features are both enabled, which is an error. Please enable only once." +); +#[cfg(all(feature = "gossip_arc_clamping_full", feature = "gossip_arc_no_clamping"))] +compile_error!( + "The `gossip_arc_clamping_full` and `gossip_arc_no_clamping` features are both enabled, which is an error. Please enable only once." +); + +#[cfg(all(not(feature = "gossip_arc_clamping_empty"), not(feature = "gossip_arc_clamping_full"), not(feature = "gossip_arc_no_clamping")))] +compile_error!("All of the `gossip_arc_clamping_empty`, `gossip_arc_clamping_full`, and `gossip_arc_no_clamping` features are disabled. Please enable one of them."); 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}; From ccc600180afceef25dfe234a29e901e5e3918f16 Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Tue, 6 Aug 2024 19:34:12 -0700 Subject: [PATCH 3/4] build: better feature names --- crates/tauri-plugin-holochain/Cargo.toml | 8 ++++---- crates/tauri-plugin-holochain/src/features.rs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/tauri-plugin-holochain/Cargo.toml b/crates/tauri-plugin-holochain/Cargo.toml index a2729e60..ce86b934 100644 --- a/crates/tauri-plugin-holochain/Cargo.toml +++ b/crates/tauri-plugin-holochain/Cargo.toml @@ -65,8 +65,8 @@ async-trait = "0.1" tauri-plugin = { version = "2.0.0-rc", features = ["build"] } [features] -default = ["gossip_arc_no_clamping"] +default = ["gossip_arc_normal"] -gossip_arc_clamping_empty = [] -gossip_arc_clamping_full = [] -gossip_arc_no_clamping = [] \ No newline at end of file +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 index 9b078bd9..37e319f8 100644 --- a/crates/tauri-plugin-holochain/src/features.rs +++ b/crates/tauri-plugin-holochain/src/features.rs @@ -1,15 +1,15 @@ -#[cfg(all(feature = "gossip_arc_clamping_empty", feature = "gossip_arc_clamping_full"))] +#[cfg(all(feature = "gossip_arc_empty", feature = "gossip_arc_full"))] compile_error!( - "The `gossip_arc_clamping_empty` and `gossip_arc_clamping_full` features are both enabled, which is an error. Please enable only once." + "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_clamping_empty", feature = "gossip_arc_no_clamping"))] +#[cfg(all(feature = "gossip_arc_empty", feature = "gossip_arc_normal"))] compile_error!( - "The `gossip_arc_clamping_empty` and `gossip_arc_no_clamping` features are both enabled, which is an error. Please enable only once." + "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_clamping_full", feature = "gossip_arc_no_clamping"))] +#[cfg(all(feature = "gossip_arc_full", feature = "gossip_arc_normal"))] compile_error!( - "The `gossip_arc_clamping_full` and `gossip_arc_no_clamping` features are both enabled, which is an error. Please enable only once." + "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_clamping_empty"), not(feature = "gossip_arc_clamping_full"), not(feature = "gossip_arc_no_clamping")))] -compile_error!("All of the `gossip_arc_clamping_empty`, `gossip_arc_clamping_full`, and `gossip_arc_no_clamping` features are disabled. Please enable one of them."); +#[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."); From 9b383cf04846028edaa7be33cd5bbac984b7651d Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Tue, 6 Aug 2024 19:46:44 -0700 Subject: [PATCH 4/4] fix: feature names --- crates/tauri-plugin-holochain/src/launch.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/tauri-plugin-holochain/src/launch.rs b/crates/tauri-plugin-holochain/src/launch.rs index b7307d0f..c808cc49 100644 --- a/crates/tauri-plugin-holochain/src/launch.rs +++ b/crates/tauri-plugin-holochain/src/launch.rs @@ -18,17 +18,17 @@ mod mdns; mod signal; use mdns::spawn_mdns_bootstrap; -#[cfg(feature="gossip_arc_clamping_empty")] +#[cfg(feature="gossip_arc_empty")] fn override_gossip_arc_clamping() -> Option { Some(String::from("empty")) } -#[cfg(feature="gossip_arc_clamping_full")] +#[cfg(feature="gossip_arc_full")] fn override_gossip_arc_clamping() -> Option { Some(String::from("full")) } -#[cfg(feature="gossip_arc_no_clamping")] +#[cfg(feature="gossip_arc_normal")] fn override_gossip_arc_clamping() -> Option { None }