Skip to content

Commit

Permalink
Keep properties for sourcegroups without files
Browse files Browse the repository at this point in the history
Fixes #161
  • Loading branch information
micprog committed Oct 22, 2024
1 parent 1e97817 commit 5e426e4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/src.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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<SourceFile<'ctx>>, into: &mut Vec<SourceGroup<'ctx>>| {
if files.is_empty() {
if files.is_empty() && self.package.is_none() {
return;
}
let files = std::mem::take(files);
Expand Down

0 comments on commit 5e426e4

Please sign in to comment.