This commit is contained in:
Able 2025-03-19 17:26:23 -05:00
parent 850e80b26c
commit 1b432980ae
2 changed files with 15 additions and 4 deletions
rlbuild/src

View file

@ -36,13 +36,22 @@ pub fn extend_environ<'a>(mut env: Environ<'a>) -> Environ<'a> {
.map(|d| match d {
Expr::List(dep_list) => {
if dep_list.len() != 2 {
return Err(RispError::Reason("dependency must have source".to_string()));
return Err(RispError::Reason("dependency must have type and source".to_string()));
}
let dep_type = match &dep_list[0] {
Expr::Symbol(s) => s.clone(),
_ => return Err(RispError::Reason("dependency type must be a symbol".to_string())),
};
let source = match &dep_list[1] {
Expr::Str(s) => s.clone(),
_ => return Err(RispError::Reason("dependency source must be a string".to_string())),
};
Ok(Dependency { source })
match dep_type.as_str() {
"library" => Ok(Dependency::Library { source }),
"binary" => Ok(Dependency::Binary { source }),
"source" => Ok(Dependency::Source { source }),
_ => Err(RispError::Reason(format!("Unknown dependency type: {}", dep_type))),
}
}
_ => Err(RispError::Reason("dependency must be a list".to_string())),
})

View file

@ -8,8 +8,10 @@ pub struct Package {
}
#[derive(Debug, Clone)]
pub struct Dependency {
pub source: String,
pub enum Dependency {
Library { source: String },
Binary { source: String },
Source { source: String },
}
impl Package {