gradle: Add update.sh maintenance script

This commit is contained in:
Lorenz Leutgeb
2021-11-02 09:43:24 +01:00
parent 43750fb958
commit 580951d4e2
5 changed files with 77 additions and 17 deletions
@@ -63,35 +63,23 @@ rec {
};
};
gradle_7_3 = gradleGen (gradleSpec {
version = "7.3-rc-2";
nativeVersion = "0.22-milestone-21";
sha256 = "0ydg26i376bjax5lval9n79v8afng467vkx3zdga0bzxl8dbi9z6";
});
gradle_latest = gradle_7;
# NOTE: 7.3 is a candidate.
gradle_7 = gradle_7_2;
gradle_7_2 = gradleGen (gradleSpec {
version = "7.2";
nativeVersion = "0.22-milestone-21";
sha256 = "1pg6w5czysywsgdvmll5bwd2p6y99cn5sn3gw69cps9mkjd710gm";
});
gradle_6_9 = gradleGen (gradleSpec {
version = "6.9.1";
nativeVersion = "0.22-milestone-20";
sha256 = "1zmjfwlh34b65rdx9izgavw3qwqqwm39h5siyj2bf0m55111a4lc";
});
gradle_7_3 = gradleGen (gradleSpec (import ./gradle-7.3-rc-3-spec.nix));
gradle_7_2 = gradleGen (gradleSpec (import ./gradle-7.2-spec.nix));
gradle_6_9 = gradleGen (gradleSpec (import ./gradle-6.9.1-spec.nix));
# NOTE: No GitHub Release for this release, so update.sh does not work.
gradle_5_6 = gradleGen (gradleSpec {
version = "5.6.4";
nativeVersion = "0.18";
sha256 = "03d86bbqd19h9xlanffcjcy3vg1k5905vzhf9mal9g21603nfc0z";
});
# NOTE: No GitHub Release for this release, so update.sh does not work.
gradle_4_10 = gradleGen (gradleSpec {
version = "4.10.3";
nativeVersion = "0.14";
@@ -0,0 +1,5 @@
{
version = "6.9.1";
nativeVersion = "0.22-milestone-20";
sha256 = "1zmjfwlh34b65rdx9izgavw3qwqqwm39h5siyj2bf0m55111a4lc";
}
@@ -0,0 +1,5 @@
{
version = "7.2";
nativeVersion = "0.22-milestone-21";
sha256 = "1pg6w5czysywsgdvmll5bwd2p6y99cn5sn3gw69cps9mkjd710gm";
}
@@ -0,0 +1,5 @@
{
version = "7.3-rc-3";
nativeVersion = "0.22-milestone-21";
sha256 = "0401q4qpl36a2vnlrlsblflfiiy3b95gyj2wj62hzc1x00hbfznm";
}
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix-prefetch curl jq
# Generates Gradle release specs from GitHub Releases.
#
# As of 2021-11, this script has very poor error handling,
# it is expected to be run by maintainers as one-off job
# only.
#
# NOTE: The earliest Gradle release that has a
# corresponding entry as GitHub Release is 6.8-rc-1.
for v in $(curl -s "https://api.github.com/repos/gradle/gradle/releases" | jq -r '.[].tag_name' | sort -n -r)
do
# Tag names and download filenames are not the same,
# we modify the tag name slightly to translate it
# to the naming scheme of download filenames.
# This translation assumes a tag naming scheme.
# As of 2021-11 it works from 6.8-rc-1 to 7.3-rc-3.
# Remove first letter (assumed to be "v").
v=${v:1}
# To lower case.
v=${v,,}
# Add dash after "rc".
v=${v/-rc/-rc-}
# Remove trailing ".0"
v=${v%.0}
# Remove trailing ".0" for release candidates.
v=${v/.0-rc/-rc}
f="gradle-${v}-spec.nix"
if [ -f "$f" ]
then
echo "$v SKIP"
continue
fi
url="https://services.gradle.org/distributions/gradle-${v}-bin.zip"
read -d "\n" gradle_hash gradle_path < <(nix-prefetch-url --print-path $url)
# Prefix and suffix for "native-platform" dependency.
gradle_native_prefix="gradle-$v/lib/native-native-"
gradle_native_suffix=".jar"
gradle_native=$(zipinfo -1 "$gradle_path" "$gradle_native_prefix*$gradle_native_suffix" | head -n1)
gradle_native=${gradle_native#"$gradle_native_prefix"}
gradle_native=${gradle_native%"$gradle_native_suffix"}
echo -e "{\\n version = \"$v\";\\n nativeVersion = \"$gradle_native\";\\n sha256 = \"$gradle_hash\";\\n}" > $f
echo "$v DONE"
done