Suppose I have a Scala program that creates files ending in .foo
.
I'm building with sbt
and want to remove these files whenever sbt clean
is called.
Add additional directory to clean task in SBT build shows that a singe file can be added by
cleanFiles <+= baseDirectory { _ / "test.foo" }
However, it's unclear how to extend this to do:
cleanFiles <append> <*.foo>
All .foo
files will be in the same directory, so I don't need to recursively check directories.
Though, that would also be interesting to see.
- How can I configure
sbt
to clean files matching a wildcard, or regex? - Is it a bad design decision to have
sbt clean
remove files my program generates? Should I instead use a flag in my program? Usingsbt clean
seems cleaner to me rather than having to callsbt clean
thensbt "run --clean"
.