Skip to content

Commit

Permalink
Update workspace builder to deduplicate paths
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Bottriell <[email protected]>
  • Loading branch information
rydrman committed Jan 14, 2025
1 parent 4ff5b28 commit 9ced96e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
6 changes: 4 additions & 2 deletions crates/spk-workspace/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
// https://github.com/spkenv/spk

use std::collections::HashSet;

use crate::error;

#[derive(Default)]
pub struct WorkspaceBuilder {
spec_files: Vec<std::path::PathBuf>,
spec_files: HashSet<std::path::PathBuf>,
}

impl WorkspaceBuilder {
Expand Down Expand Up @@ -53,7 +55,7 @@ impl WorkspaceBuilder {

/// Add a recipe file to the workspace.
pub fn with_recipe_file(mut self, path: impl Into<std::path::PathBuf>) -> Self {
self.spec_files.push(path.into());
self.spec_files.insert(path.into());
self
}

Expand Down
2 changes: 1 addition & 1 deletion crates/spk-workspace/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Workspace {
);
let by_name = self.templates.entry(template.name().cloned()).or_default();
by_name.push(template);
Ok(&by_name.last().expect("just pushed something"))
Ok(by_name.last().expect("just pushed something"))
}
}

Expand Down
17 changes: 10 additions & 7 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"language": "en",
"version": "0.2",
"words": [
"A7USTIBXPXHMD5CYEIIOBMFLM3X77ESVR3WAUXQ7XQQGTHKH7DMQ",
"ABCA",
"ABEA",
"abouts",
Expand All @@ -19,7 +20,6 @@
"aclocal",
"acyclical",
"addrs",
"A7USTIBXPXHMD5CYEIIOBMFLM3X77ESVR3WAUXQ7XQQGTHKH7DMQ",
"AEMKIJQ",
"AGVXA",
"alib",
Expand All @@ -31,6 +31,7 @@
"ASWF",
"atexit",
"autogen",
"automake",
"automounter",
"autopoint",
"autoreconf",
Expand All @@ -55,9 +56,11 @@
"Blosc",
"BLOSC",
"BMLX",
"bools",
"Boolish",
"bools",
"Bottriell",
"bracoxide",
"bracoxidize",
"bufread",
"buildable",
"builddep",
Expand Down Expand Up @@ -272,8 +275,8 @@
"hasattr",
"hashable",
"hashalgo",
"hashset",
"Hasher",
"hashset",
"helmignore",
"HFSBQEYR",
"HHMMSS",
Expand Down Expand Up @@ -495,7 +498,6 @@
"OWYWHJKCVRKGSBL",
"OXFB",
"OYMIQUY",
"PJDUUENJYFFDKZWRKHDUXK4FGGZ7FHDYMZ7P4CXORUG6TUMDJ7A",
"parsedbuf",
"parsewords",
"partio",
Expand All @@ -512,6 +514,7 @@
"pids",
"Pinnable",
"pixbuf",
"PJDUUENJYFFDKZWRKHDUXK4FGGZ7FHDYMZ7P4CXORUG6TUMDJ7A",
"pkga",
"pkgb",
"pkgconfig",
Expand Down Expand Up @@ -638,18 +641,18 @@
"SIMD",
"SNAPPROCESS",
"somedata",
"SOMEDIGEST",
"somedir",
"somename",
"someotherdata",
"SOMEOTHERDIGEST",
"somepkg",
"someproject",
"sometag",
"SOMETAG",
"somethingelse",
"somevalue",
"somevar",
"SOMEDIGEST",
"SOMEOTHERDIGEST",
"SOMETAG",
"SOVERSION",
"spdev",
"SPFS",
Expand Down

0 comments on commit 9ced96e

Please sign in to comment.