Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically filter out empty directories in cleanCargoSource #725

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

### Changed

* `cleanCargoSource` will now automatically filter out empty directories to
avoid causing unnecessary rebuilds.

## [0.19.1] - 2024-10-12

### Added
Expand Down
17 changes: 11 additions & 6 deletions lib/cleanCargoSource.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
, lib
}:

src: lib.cleanSourceWith {
# Apply the default source cleaning from nixpkgs
src = lib.cleanSource src;
src: lib.fileset.toSource {
root = src;

# Then add our own filter on top
filter = filterCargoSources;
# Filter out empty directories by converting back and forth from a file set
fileset = lib.fileset.fromSource (lib.cleanSourceWith {
# Apply the default source cleaning from nixpkgs
src = lib.cleanSource src;

name = internalCrateNameForCleanSource src;
# Then add our own filter on top
filter = filterCargoSources;

name = internalCrateNameForCleanSource src;
});
}