mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-04 07:08:53 +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};
|
use std::{env, path::Path};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum DepType {
|
pub enum DepType {
|
||||||
SharedObject,
|
SharedObject,
|
||||||
Executable,
|
Executable,
|
||||||
Include,
|
Include,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Dependency {
|
pub struct Dependency {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub dep_type: DepType,
|
pub dep_type: DepType,
|
||||||
pub filename: String,
|
pub filename: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
pub struct DependencyCheckResult {
|
||||||
|
pub dependency: Dependency,
|
||||||
|
pub found: bool,
|
||||||
|
}
|
||||||
|
|
||||||
fn shared_obj_paths() -> Vec<String> {
|
fn shared_obj_paths() -> Vec<String> {
|
||||||
vec![
|
vec![
|
||||||
"/lib".to_string(),
|
"/lib".to_string(),
|
||||||
|
@ -48,6 +56,15 @@ pub fn check_dependency(dep: Dependency) -> bool {
|
||||||
return false;
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{check_dependency, DepType, Dependency};
|
use super::{check_dependency, DepType, Dependency};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue