feat: deduplicate missing deps

This commit is contained in:
Gabriele Musco 2023-06-18 16:15:22 +02:00
parent 5b4f4ab085
commit e905fa7569
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE
2 changed files with 15 additions and 1 deletions

View file

@ -15,6 +15,18 @@ pub struct Dependency {
pub filename: String,
}
impl Ord for Dependency {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.name.cmp(&other.name)
}
}
impl PartialOrd for Dependency {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DependencyCheckResult {
pub dependency: Dependency,

View file

@ -273,6 +273,8 @@ impl SimpleComponent for App {
}
runners.push(get_build_opencomposite_runner(profile.clone()));
if !missing_deps.is_empty() {
missing_deps.sort_unstable();
missing_deps.dedup(); // dedup only works if sorted, hence the above
self.dependencies_dialog.set_body(
missing_deps
.iter()
@ -462,7 +464,7 @@ impl SimpleComponent for App {
.sender()
.emit(MainViewMsg::UpdateProfileNames(
model.profiles.iter().map(|p| p.clone().name).collect(),
model.config.clone()
model.config.clone(),
));
let timer_sender = sender.clone();