mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-20 19:44:50 +00:00
feat: check for multiple dependencies and return a vector
This commit is contained in:
parent
86ab0cdf31
commit
15f4548999
1 changed files with 17 additions and 0 deletions
|
@ -1,17 +1,25 @@
|
|||
use std::{env, path::Path};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum DepType {
|
||||
SharedObject,
|
||||
Executable,
|
||||
Include,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Dependency {
|
||||
pub name: String,
|
||||
pub dep_type: DepType,
|
||||
pub filename: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct DependencyCheckResult {
|
||||
pub dependency: Dependency,
|
||||
pub found: bool,
|
||||
}
|
||||
|
||||
fn shared_obj_paths() -> Vec<String> {
|
||||
vec![
|
||||
"/lib".to_string(),
|
||||
|
@ -48,6 +56,15 @@ pub fn check_dependency(dep: Dependency) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
pub fn check_dependencies(deps: Vec<Dependency>) -> Vec<DependencyCheckResult> {
|
||||
deps.iter()
|
||||
.map(|dep| DependencyCheckResult {
|
||||
dependency: dep.clone(),
|
||||
found: check_dependency(dep.clone()),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{check_dependency, DepType, Dependency};
|
||||
|
|
Loading…
Add table
Reference in a new issue