gradle-doctor icon indicating copy to clipboard operation
gradle-doctor copied to clipboard

Add a task to easily delete empty directories

Open runningcode opened this issue 5 years ago • 2 comments

The gradle doctor finds empty directories in source directories, but if the root directory is empty, it does not warn you. Let's add a task which removes all empty source directories. Related to: https://github.com/gradle/gradle/issues/2463

runningcode avatar Jul 23 '20 09:07 runningcode

I'd love that. Is there any special consideration to implement it or should it just delete any empty dirs recursively?

LouisCAD avatar Sep 14 '20 08:09 LouisCAD

@ZacSweers 's PR to check the furthest empty parent makes this a lot easier when finding cache misses: https://github.com/runningcode/gradle-doctor/pull/105 However it still doesn't fix the case when the root directory is empty. Although a cache miss with an empty root directory is usually not a big deal since it doesn't take long to compile empty sources.

As for a script, the only consideration would be that some projects might have empty source directories which are somehow meaningful to the build. Otherwise I would think it would be safe to delete all empty directories in the entire project.

runningcode avatar Sep 14 '20 08:09 runningcode