File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,8 +24,19 @@ echo "Using Java @ ${JAVA_HOME}"
2424
2525source .gitlab/scripts/includes.sh
2626
27- # Remove any zero-byte or corrupt JARs from the Gradle cache (can result from partial downloads)
28- find .gradle -name " *.jar" -size 0 -delete 2> /dev/null || true
27+ # Remove corrupt JARs from Gradle caches (non-ZIP content from failed/proxied downloads)
28+ # JARs not starting with PK magic bytes are invalid and must be deleted before Gradle reads them
29+ for cache_dir in .gradle ~ /.gradle; do
30+ if [ -d " $cache_dir " ]; then
31+ find " $cache_dir " -name " *.jar" | while IFS= read -r jar; do
32+ magic=$( head -c 2 " $jar " 2> /dev/null | od -A n -t x1 | tr -d ' \n' )
33+ if [ " $magic " != " 504b" ]; then
34+ echo " WARN: removing corrupt JAR (magic=${magic:- empty} ): $jar "
35+ rm -f " $jar "
36+ fi
37+ done
38+ fi
39+ done
2940
3041function onexit {
3142 mkdir -p " ${REPO_ROOT} /test/${TARGET} /reports"
@@ -40,7 +51,7 @@ function onexit {
4051trap onexit EXIT
4152
4253set -x
43- ./gradlew -Pddprof_version=" $( get_version) " -Pskip-cpp-tests :ddprof-lib:assembleReleaseJar --build-cache --stacktrace --info --no-watch-fs --no-daemon
54+ ./gradlew -Pddprof_version=" $( get_version) " -Pskip-cpp-tests :ddprof-lib:assembleReleaseJar --no- build-cache --stacktrace --info --no-watch-fs --no-daemon
4455
4556mkdir -p " ${REPO_ROOT} /libs"
4657cp -r " ${REPO_ROOT} /ddprof-lib/build/native/release/META-INF/native-libs/" * " ${REPO_ROOT} /libs/"
You can’t perform that action at this time.
0 commit comments