use std::fmt;
use std::path::{Path, PathBuf};
use crate::generate::archetypes::Archetype;
use crate::generate::templates::TemplateError;
use crate::spec::types::OpSpec;
use super::{GenError, GenerationPlan, GenerationReport};
#[inline]
pub fn generate(plan: &GenerationPlan, out_dir: &Path) -> Result<GenerationReport, GenError> {
if plan.ops.is_empty() {
return Err(GenError::InvalidPlan {
reason: "provide at least one OpSpec in GenerationPlan::ops.".to_string(),
});
}
if plan.archetypes.is_empty() {
return Err(GenError::InvalidPlan {
reason: "provide at least one archetype in GenerationPlan::archetypes.".to_string(),
});
}
if plan.templates.is_empty() {
return Err(GenError::InvalidPlan {
reason: "provide at least one TemplateKind in GenerationPlan::templates.".to_string(),
});
}
cross_product::generate_cross_product(plan, out_dir)
}