Last active
December 16, 2023 08:10
-
-
Save Leialoha/18b0909315436949d0cd4580254e68df to your computer and use it in GitHub Desktop.
If you can't seem to run `gradle clean`, you might want to use this and replace the `**/expanded.lock` with the problem file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Removing all files but the expanded.lock | |
task customClean(type: Delete) { | |
// Specify the files or directories to delete | |
// delete 'otherDirectory' | |
// Remove all files except that one lock file | |
def files = [] | |
fileTree("build") | |
.exclude('**/expanded.lock') | |
.visit { FileVisitDetails fvd -> | |
files << fvd.file | |
} | |
files.reverse() | |
.each { f -> | |
def file = file(f) | |
if (!file.exists()) return; | |
if ((file.isDirectory() && file.list().size() == 0) | |
|| !file.isDirectory()) | |
delete f | |
} | |
} | |
clean.dependsOn customClean | |
clean.enabled = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment