Skip to content

Commit ff43deb

Browse files
committed
Only write sourcedirs for local packages with files.
1 parent 9914c8b commit ff43deb

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

rewatch/src/sourcedirs.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ pub struct SourceDirs<'a> {
2121
}
2222

2323
fn package_to_dirs(package: &Package, root_package_path: &Path) -> AHashSet<Dir> {
24-
let relative_path = package.path.strip_prefix(&root_package_path).unwrap();
25-
26-
package
27-
.dirs
28-
.as_ref()
29-
.unwrap_or(&AHashSet::new())
30-
.iter()
31-
.map(|path| relative_path.join(path))
32-
.collect::<AHashSet<PathBuf>>()
24+
match package.path.strip_prefix(&root_package_path) {
25+
Err(_) => AHashSet::new(),
26+
Ok(relative_path) => package
27+
.dirs
28+
.as_ref()
29+
.unwrap_or(&AHashSet::new())
30+
.iter()
31+
.map(|path| relative_path.join(path))
32+
.collect::<AHashSet<PathBuf>>(),
33+
}
3334
}
3435

3536
fn deps_to_pkgs<'a>(
@@ -65,7 +66,7 @@ pub fn print(buildstate: &BuildState) {
6566
let (dirs, pkgs): (Vec<AHashSet<Dir>>, Vec<AHashMap<PackageName, AbsolutePath>>) = buildstate
6667
.packages
6768
.par_iter()
68-
.filter(|(_name, package)| !package.is_root)
69+
.filter(|(_name, package)| package.is_local_dep && package.source_files.is_some())
6970
.map(|(_name, package)| {
7071
// Extract Directories
7172
let dirs = package_to_dirs(package, &root_package.path);

0 commit comments

Comments
 (0)