use std::sync::{Arc, atomic::AtomicBool};
pub struct BuildRequest {
pub profile: String,
pub target: Option<String>,
pub force: bool,
pub verbose: bool,
pub workspace: Option<String>,
pub cancel: Arc<AtomicBool>,
}
#[allow(dead_code)]
pub struct BuildOutcome {
pub secs: f64,
}
pub struct BuildError {
pub message: String,
}
impl From<String> for BuildError {
fn from(message: String) -> Self {
BuildError { message }
}
}
pub enum BuildEvent<'a> {
TargetStart {
index: usize,
total: usize,
target: &'a str,
},
ProjectStart {
name: &'a str,
profile: &'a str,
target: &'a str,
},
DepBuilding {
name: &'a str,
version: &'a str,
},
DepReady {
name: &'a str,
version: &'a str,
rebuilt: bool,
},
Compiling {
name: &'a str,
version: &'a str,
},
CompilerOutput {
stream: &'a str,
text: &'a str,
},
Finished {
secs: f64,
},
}
pub trait BuildReporter {
fn on_event(&mut self, event: BuildEvent<'_>);
}