Fixes clean not cleaning files added to cleanFiles

Fixes #6395

The current code assumes cleanFiles are only directories. This fixes that.
This commit is contained in:
Eugene Yokota 2021-03-29 00:23:50 -04:00
parent 1cb23c843b
commit 2a3a0f5594
4 changed files with 7 additions and 4 deletions

View File

@ -93,8 +93,9 @@ private[sbt] object Clean {
val targetDir = (scope / target).?.value.map(_.toPath)
targetDir.filter(_ => full).foreach(deleteContents(_, excludeFilter, view, delete))
(scope / cleanFiles).?.value.getOrElse(Nil).foreach { f =>
deleteContents(f.toPath, excludeFilter, view, delete)
(scope / cleanFiles).?.value.getOrElse(Nil).foreach { x =>
if (x.isDirectory) deleteContents(x.toPath, excludeFilter, view, delete)
else delete(x.toPath)
}
// This is the special portion of the task where we clear out the relevant streams

View File

@ -1 +1,2 @@
cleanFiles += baseDirectory.value / "foo"
cleanFiles += baseDirectory.value / "foo"
cleanFiles += baseDirectory.value / "a.txt"

View File

@ -1,3 +1,4 @@
> clean
$ absent foo/bar/baz.txt
$ absent foo/bar/baz.txt
$ absent a.txt