diff --git a/crates/aiken-project/src/error.rs b/crates/aiken-project/src/error.rs index 9e887ddd..3c853d5b 100644 --- a/crates/aiken-project/src/error.rs +++ b/crates/aiken-project/src/error.rs @@ -393,7 +393,9 @@ impl Diagnostic for Error { #[derive(thiserror::Error)] pub enum Warning { - #[error("Checking")] + #[error("You do not have any validators to build!")] + NoValidators, + #[error("While trying to make sense of your code...")] Type { path: PathBuf, src: String, @@ -411,17 +413,21 @@ impl Diagnostic for Warning { fn source_code(&self) -> Option<&dyn SourceCode> { match self { Warning::Type { named, .. } => Some(named), + Warning::NoValidators => None, } } + fn labels(&self) -> Option + '_>> { match self { Warning::Type { warning, .. } => warning.labels(), + Warning::NoValidators => None, } } fn code<'a>(&'a self) -> Option> { match self { Warning::Type { .. } => Some(Box::new("aiken::check")), + Warning::NoValidators => Some(Box::new("aiken::check")), } } } diff --git a/crates/aiken-project/src/lib.rs b/crates/aiken-project/src/lib.rs index ec9c3e3e..ca5ea770 100644 --- a/crates/aiken-project/src/lib.rs +++ b/crates/aiken-project/src/lib.rs @@ -107,6 +107,8 @@ where } pub fn docs(&mut self, destination: Option) -> Result<(), Error> { + self.compile_deps()?; + self.event_listener .handle_event(Event::BuildingDocumentation { root: self.root.clone(), @@ -399,7 +401,7 @@ where Ok(()) } - fn validate_validators(&self) -> Result, Error> { + fn validate_validators(&mut self) -> Result, Error> { let mut errors = Vec::new(); let mut validators = Vec::new(); @@ -462,6 +464,10 @@ where } } + if validators.is_empty() { + self.warnings.push(Warning::NoValidators); + } + if errors.is_empty() { Ok(validators) } else {