Skip to content

Commit

Permalink
Fix script when specifying multiple --only-*
Browse files Browse the repository at this point in the history
Ensure defines/includes/sources are included in script when specifying
multiple `--only-*`.
  • Loading branch information
micprog committed Jan 24, 2024
1 parent d27fe11 commit 962b8c5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased
### Fixed
- Ensure defines/includes/sources are included in script when specifying multiple `--only-*`.

## 0.28.0 - 2024-01-19
### Added
Expand Down
44 changes: 25 additions & 19 deletions src/cmd/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,33 +519,39 @@ fn emit_template(
}
all_defines.extend(target_defines.clone());
add_defines_from_matches(&mut all_defines, matches);
let all_defines = if !matches.get_flag("only-includes") && !matches.get_flag("only-sources") {
let all_defines = if (!matches.get_flag("only-includes") && !matches.get_flag("only-sources"))
|| matches.get_flag("only-defines")
{
all_defines.into_iter().collect()
} else {
IndexSet::new()
};
tera_context.insert("all_defines", &all_defines);

all_incdirs.sort();
let all_incdirs: IndexSet<PathBuf> =
if !matches.get_flag("only-defines") && !matches.get_flag("only-sources") {
all_incdirs.into_iter().map(|p| p.to_path_buf()).collect()
} else {
IndexSet::new()
};
let all_incdirs: IndexSet<PathBuf> = if (!matches.get_flag("only-defines")
&& !matches.get_flag("only-sources"))
|| matches.get_flag("only-includes")
{
all_incdirs.into_iter().map(|p| p.to_path_buf()).collect()
} else {
IndexSet::new()
};
tera_context.insert("all_incdirs", &all_incdirs);
let all_files: IndexSet<PathBuf> =
if !matches.get_flag("only-defines") && !matches.get_flag("only-includes") {
all_files
.into_iter()
.filter_map(|file| match file {
SourceFile::File(p) => Some(p.to_path_buf()),
_ => None,
})
.collect()
} else {
IndexSet::new()
};
let all_files: IndexSet<PathBuf> = if (!matches.get_flag("only-defines")
&& !matches.get_flag("only-includes"))
|| matches.get_flag("only-sources")
{
all_files
.into_iter()
.filter_map(|file| match file {
SourceFile::File(p) => Some(p.to_path_buf()),
_ => None,
})
.collect()
} else {
IndexSet::new()
};
tera_context.insert("all_files", &all_files);

let mut split_srcs = vec![];
Expand Down

0 comments on commit 962b8c5

Please sign in to comment.