Skip to content

Commit

Permalink
Merge pull request #184 from qryxip/ignore-workspace-members-when-che…
Browse files Browse the repository at this point in the history
…cking-licenses

Ignore workspace members when checking licenses
  • Loading branch information
qryxip authored Mar 26, 2022
2 parents ec8882a + 1afb9cf commit 7fa0054
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- Ignores [workspace members](https://doc.rust-lang.org/cargo/reference/workspaces.html) when checking licenses.

### Changed

- Embedded rust-analyzer for expanding procedural macros.
Expand Down
24 changes: 11 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,20 +980,18 @@ fn bundle(

let notices = libs
.iter()
.filter(|(_, (p, _, _, _))| p.has_lib())
.map(|(_, (p, _, _, _))| p)
.flat_map(|lib_package| {
if let Err(err) =
shell.status("Checking", format!("the license of `{}`", lib_package.id))
{
return Some(Err(err.into()));
}
match lib_package.read_license_text(mine, cache_dir) {
Ok(Some(license_text)) => Some(Ok((&lib_package.id, license_text))),
Ok(None) => None,
Err(err) => Some(Err(err)),
}
.filter(|(_, (p, _, _, _))| {
p.has_lib() && !metadata.workspace_members.contains(&p.id)
})
.map(|(_, (lib_package, _, _, _))| {
shell.status("Checking", format!("the license of `{}`", lib_package.id))?;
lib_package
.read_license_text(mine, cache_dir)
.map(|license_text| {
license_text.map(|license_text| (&lib_package.id, license_text))
})
})
.flat_map(Result::transpose)
.collect::<Result<Vec<_>, _>>()?;

if !notices.is_empty() {
Expand Down

0 comments on commit 7fa0054

Please sign in to comment.