Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions .github/scripts/gradle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# (--no-scan on every run).
# 2. Early warning (static): gradle/verification-metadata.xml verifies metadata and trusts no
# artifact or key without a checksum, the wrapper settings are exactly the official download
# into the Gradle user home with its sha256, gradle.properties holds project values only, and
# no Gradle user home init script, properties file, environment variable or build script
# changes dependency verification.
# into the Gradle user home with its sha256 and at least the minimum Gradle version,
# gradle.properties holds project values only, and no Gradle user home init script,
# properties file, environment variable or build script changes dependency verification.
# 3. Probe run: Gradle starts from the wrapper jar. Before settings are evaluated, an init script
# resolves a probe artifact from a temporary local repository (a coordinate no project uses,
# so it is never in gradle/verification-metadata.xml); dependency verification must refuse it.
Expand Down Expand Up @@ -53,6 +53,32 @@ zipStorePath=wrapper/dists$'
[[ "$settings" =~ $expected_re ]] || fail "$wrapper must hold exactly the official distribution settings"
dist_sha="$(sed -n 's/^distributionSha256Sum=//p' "$wrapper")"
dist_name="$(sed -n 's#^distributionUrl=.*/\(gradle-[0-9.]*-[a-z]*\)\.zip$#\1#p' "$wrapper")"
# The wrapper's Gradle version is at least the minimum (set below): 9.x has its own, 10 and later
# pass, 8.x and earlier need the 8.x one. Versions are compared number by number.
dist_version="${dist_name#gradle-}"
dist_version="${dist_version%-*}"
version_at_least() {
local -a have want
IFS=. read -r -a have <<< "$1"
IFS=. read -r -a want <<< "$2"
local i a b
for ((i = 0; i < ${#have[@]} || i < ${#want[@]}; i++)); do
a="${have[i]:-0}"
b="${want[i]:-0}"
# Bounded so the arithmetic below cannot overflow.
[[ "$a" =~ ^[0-9]{1,6}$ ]] || return 1
((10#$a > 10#$b)) && return 0
((10#$a < 10#$b)) && return 1
done
return 0
}
case "${dist_version%%.*}" in
9) minimum=9.9.2 ;;
[1-9][0-9]*) minimum="${dist_version%%.*}" ;;
*) minimum=8.14.8 ;;
esac
version_at_least "$dist_version" "$minimum" ||
fail "$wrapper: Gradle $dist_version is below the minimum version $minimum"
gradle_home="${GRADLE_USER_HOME:-$HOME/.gradle}"
# A distribution already unpacked in the Gradle user home sits next to its zip, which has the
# pinned sha256.
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Aug 02 15:19:01 BST 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
distributionSha256Sum=ed1a8d686605fd7c23bdf62c7fc7add1c5b23b2bbc3721e661934ef4a4911d7c
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.8-all.zip
distributionSha256Sum=34b008b7b744e4d12468e97ba03c572d0cd786fd0334e61e0171ea3d1a566b73
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
Loading