forked from DanySK/Gravis-CI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean-gradle-cache
executable file
·32 lines (30 loc) · 1.38 KB
/
clean-gradle-cache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Since Gradle 4.10, cache cleaning happens by stopping the running daemon (if any)
echo 'Searching for the gradle executable and stopping the daemons'
find $TRAVIS_BUILD_DIR -name gradlew -exec echo Killing Gradle daemons using {} \; -exec "{}" --stop \; -quit
echo 'Additional cleaning disabled, as it hinders automatic cleaning procedures'
echo '*.lock files change at every build, generating an unavoidable repack'
echo 'on the other hand, they are required for Gradle to maintain its cache size under control'
# Manual cleaning disabled, as it hinders automatic cleaning procedures,
# leading to larger caches and ultimately spoiling the caching in the long run,
# as large archives take longer to unpack than small archives take to pack and unpack.
# echo 'Cleanup files triggering unwanted cache refresh'
# rm -vfr $HOME/.gradle/caches/*/plugin-resolution
# rm -vfr $HOME/.gradle/caches/*/workerMain/
# rm -vfr $HOME/.gradle/caches/*/gradle-kotlin-dsl/*/cache/
# rm -vfr $HOME/.gradle/caches/*/gradle-kotlin-dsl-accessors/*/cache/
# rm -vf $HOME/.gradle/caches/*/fileHashes/*.bin
# PATTERNS=(
# '*.class'
# '*.lock'
# 'buildSrc.jar'
# 'cache.properties'
# 'file-access.bin'
# 'module-versions.bin'
# 'resource-at-url.bin'
# 'user-id.txt'
# )
# for PATTERN in ${PATTERNS[@]}
# do
# find "${HOME}/.gradle/caches/" -name "${PATTERN}" -type f -delete -print
# done