Bake a selection of gradle versions into the image; use fdroid's gradle wrapper to determine which one to use.

Right now the image supports Gradle >= 3.0. This should be wide enough for the majority of use cases. If we need to add additional gradle versions we can easily do so.
This commit is contained in:
Adrian Malacoda 2018-06-24 03:49:05 -05:00
parent 873da0586b
commit 5d20e0585b
3 changed files with 17 additions and 2 deletions

View File

@ -25,5 +25,10 @@ A F-Droid metadata file is named `<appId>.txt` and [looks like this](https://git
and build the latest version of that app.
## Note on Gradle versions
F-droid's build server supports multiple versions of Gradle, and [uses several methods to detect which version to use](https://gitlab.com/fdroid/fdroidserver/blob/master/buildserver/gradle), such as parsing it out of `build.gradle` or `gradle-wrapper.properties`. This image uses that same approach, but it only includes Gradle versions >= 3.0.
Gradle versions are kept in `/opt/gradle/versions`.
## License
GNU GPL v3.

View File

@ -1,7 +1,7 @@
#!/bin/bash
REPO="$(pwd)"
source /root/.sdkman/bin/sdkman-init.sh
export PATH="/opt/gradle/bin:$PATH"
if [ -d "fdroid" ]; then
cp -Rv fdroid/* /fdroiddata/metadata;

View File

@ -8,4 +8,14 @@ apt-get update && apt-get install zip
curl -s "https://get.sdkman.io" | bash
source /root/.sdkman/bin/sdkman-init.sh
sdk install gradle
# https://gitlab.com/fdroid/fdroidserver/blob/master/buildserver/gradle#L28
#GRADLE_VERSIONS=(4.8 4.7 4.6 4.5.1 4.5 4.4.1 4.4 4.3.1 4.3 4.2.1 4.2 4.1 4.0.2 4.0.1 4.0 3.5.1 3.5 3.4.1 3.4 3.3 3.2.1 3.2 3.1 3.0 2.14.1 2.14 2.13 2.12 2.11 2.10 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2.1 2.2 2.1 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.4)
GRADLE_VERSIONS=(4.8 4.7 4.6 4.5.1 4.5 4.4.1 4.4 4.3.1 4.3 4.2.1 4.2 4.1 4.0.2 4.0.1 4.0 3.5.1 3.5 3.4.1 3.4 3.3 3.2.1 3.2 3.1 3.0)
for VERSION in "${GRADLE_VERSIONS[@]}"; do
sdk install gradle "$VERSION"
done
# Expose sdkman gradle to fdroid buildserver
mkdir -p /opt/gradle/bin
ln -s /root/.sdkman/candidates/gradle /opt/gradle/versions
cp /fdroidserver/buildserver/gradle /opt/gradle/bin