From 34a6b2486f974d5310b26511e0a5fb9422997a5e Mon Sep 17 00:00:00 2001 From: Michael Rogenmoser Date: Wed, 17 Apr 2024 13:39:32 +0200 Subject: [PATCH] Keep properties for sourcegroups without files Fixes #161 --- src/src.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/src.rs b/src/src.rs index 17071eff..f653c96e 100644 --- a/src/src.rs +++ b/src/src.rs @@ -53,7 +53,12 @@ impl<'ctx> SourceGroup<'ctx> { let group = group.simplify(); // Discard empty groups. - if group.files.is_empty() && group.package.is_none() { + if group.files.is_empty() + && group.include_dirs.is_empty() + && group.defines.is_empty() + && group.target.is_wildcard() + && group.package.is_none() + { return None; } @@ -221,7 +226,7 @@ impl<'ctx> SourceGroup<'ctx> { let mut files = vec![]; let subfiles = std::mem::take(&mut self.files); let flush_files = |files: &mut Vec>, into: &mut Vec>| { - if files.is_empty() { + if files.is_empty() && self.package.is_none() { return; } let files = std::mem::take(files);