diff --git a/Cargo.lock b/Cargo.lock index db212803590a..40abf6af5900 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1452,6 +1452,7 @@ version = "0.8.0" dependencies = [ "hydro_deploy", "hydroflow_plus", + "nameof", "prettyplease", "serde", "sha2", diff --git a/hydro_deploy/core/src/hydroflow_crate/mod.rs b/hydro_deploy/core/src/hydroflow_crate/mod.rs index 5080f300ef17..adc0dc724708 100644 --- a/hydro_deploy/core/src/hydroflow_crate/mod.rs +++ b/hydro_deploy/core/src/hydroflow_crate/mod.rs @@ -1,6 +1,7 @@ use std::path::PathBuf; use std::sync::Arc; +use nameof::name_of; use tracing_options::TracingOptions; use super::Host; @@ -63,7 +64,7 @@ impl HydroflowCrate { /// equivalent to `cargo run --bin `. pub fn bin(mut self, bin: impl Into) -> Self { if self.target != CrateTarget::Default { - panic!("target already set"); + panic!("{} already set", name_of!(target in Self)); } self.target = CrateTarget::Bin(bin.into()); @@ -74,7 +75,7 @@ impl HydroflowCrate { /// equivalent to `cargo run --example `. pub fn example(mut self, example: impl Into) -> Self { if self.target != CrateTarget::Default { - panic!("target already set"); + panic!("{} already set", name_of!(target in Self)); } self.target = CrateTarget::Example(example.into()); @@ -85,7 +86,7 @@ impl HydroflowCrate { /// Equivalent to `cargo run --profile `. pub fn profile(mut self, profile: impl Into) -> Self { if self.profile.is_some() { - panic!("profile already set"); + panic!("{} already set", name_of!(profile in Self)); } self.profile = Some(profile.into()); @@ -94,7 +95,7 @@ impl HydroflowCrate { pub fn rustflags(mut self, rustflags: impl Into) -> Self { if self.rustflags.is_some() { - panic!("rustflags already set"); + panic!("{} already set", name_of!(rustflags in Self)); } self.rustflags = Some(rustflags.into()); @@ -103,7 +104,7 @@ impl HydroflowCrate { pub fn target_dir(mut self, target_dir: impl Into) -> Self { if self.target_dir.is_some() { - panic!("target_dir already set"); + panic!("{} already set", name_of!(target_dir in Self)); } self.target_dir = Some(target_dir.into()); @@ -117,7 +118,7 @@ impl HydroflowCrate { pub fn features(mut self, features: impl IntoIterator>) -> Self { if self.features.is_some() { - panic!("features already set"); + panic!("{} already set", name_of!(features in Self)); } self.features = Some(features.into_iter().map(|s| s.into()).collect()); @@ -126,7 +127,7 @@ impl HydroflowCrate { pub fn tracing(mut self, perf: impl Into) -> Self { if self.tracing.is_some() { - panic!("tracing options are already set"); + panic!("{} already set", name_of!(tracing in Self)); } self.tracing = Some(perf.into()); @@ -142,7 +143,7 @@ impl HydroflowCrate { /// Sets the display name for this service, which will be used in logging. pub fn display_name(mut self, display_name: impl Into) -> Self { if self.display_name.is_some() { - panic!("display_name already set"); + panic!("{} already set", name_of!(display_name in Self)); } self.display_name = Some(display_name.into()); diff --git a/hydro_deploy/hydroflow_plus_deploy/Cargo.toml b/hydro_deploy/hydroflow_plus_deploy/Cargo.toml index 3eeaf9c7ea9f..6154debccaa1 100644 --- a/hydro_deploy/hydroflow_plus_deploy/Cargo.toml +++ b/hydro_deploy/hydroflow_plus_deploy/Cargo.toml @@ -12,20 +12,21 @@ deploy = [ "hydro_deploy", "trybuild-internals-api", "toml", "prettyplease" ] stageleft_devel = [] [dependencies] -stageleft = { path = "../../stageleft", version = "^0.3.0" } hydroflow_plus = { path = "../../hydroflow_plus", version = "^0.8.0", features = [ "deploy_integration" ] } +nameof = "1.0.0" +serde = { version = "1.0.197", features = [ "derive" ] } +sha2 = "0.10.0" +stageleft = { path = "../../stageleft", version = "^0.3.0" } syn = { version = "2.0.46", features = [ "parsing", "extra-traits" ] } tokio = { version = "1.29.0", features = [ "full" ] } -serde = { version = "1.0.197", features = [ "derive" ] } hydro_deploy = { path = "../core", version = "^0.8.0", optional = true } -trybuild-internals-api = { version = "1.0.99", optional = true } -toml = { version = "0.8.0", optional = true } prettyplease = { version = "0.2.0", features = [ "verbatim" ], optional = true } +toml = { version = "0.8.0", optional = true } +trybuild-internals-api = { version = "1.0.99", optional = true } # added to workaround `cargo smart-release` https://github.com/Byron/cargo-smart-release/issues/16 stageleft_tool = { path = "../../stageleft_tool", version = "^0.2.0", optional = true } -sha2 = "0.10.0" [build-dependencies] stageleft_tool = { path = "../../stageleft_tool", version = "^0.2.0" } diff --git a/hydro_deploy/hydroflow_plus_deploy/src/deploy.rs b/hydro_deploy/hydroflow_plus_deploy/src/deploy.rs index 1b9f8229e0b2..cad8a79249a2 100644 --- a/hydro_deploy/hydroflow_plus_deploy/src/deploy.rs +++ b/hydro_deploy/hydroflow_plus_deploy/src/deploy.rs @@ -12,6 +12,7 @@ use hydro_deploy::hydroflow_crate::HydroflowCrateService; use hydro_deploy::{Deployment, Host, HydroflowCrate}; use hydroflow_plus::deploy::{ClusterSpec, Deploy, Node, ProcessSpec}; use hydroflow_plus::lang::graph::HydroflowGraph; +use nameof::name_of; use sha2::{Digest, Sha256}; use stageleft::Quoted; use tokio::sync::RwLock; @@ -278,20 +279,20 @@ impl TrybuildHost { } } - pub fn display_name(self, name: impl Into) -> Self { + pub fn display_name(self, display_name: impl Into) -> Self { if self.display_name.is_some() { - panic!("display_name already set"); + panic!("{} already set", name_of!(display_name in Self)); } Self { - display_name: Some(name.into()), + display_name: Some(display_name.into()), ..self } } pub fn rustflags(self, rustflags: impl Into) -> Self { if self.rustflags.is_some() { - panic!("rustflags already set"); + panic!("{} already set", name_of!(rustflags in Self)); } Self { @@ -302,7 +303,7 @@ impl TrybuildHost { pub fn tracing(self, tracing: TracingOptions) -> Self { if self.tracing.is_some() { - panic!("tracing already set"); + panic!("{} already set", name_of!(tracing in Self)); } Self {