mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-20 13:50:12 +01:00
Merge branch 'gradle-wrapper' into 'master'
Make the gradle wrapper smarter @eighthave PTAL This will help with issues like https://gitlab.com/fdroid/fdroiddata/issues/515 See merge request !166
This commit is contained in:
commit
89010a1ba5
@ -5,9 +5,6 @@ basedir="$(dirname $bindir)"
|
|||||||
verdir="${basedir}/versions"
|
verdir="${basedir}/versions"
|
||||||
args=("$@")
|
args=("$@")
|
||||||
|
|
||||||
v_all=($(cd "${verdir}" && ls | sort -rV))
|
|
||||||
echo "Available gradle versions: ${v_all[@]}"
|
|
||||||
|
|
||||||
run_gradle() {
|
run_gradle() {
|
||||||
"${verdir}/${v_found}/bin/gradle" "${args[@]}"
|
"${verdir}/${v_found}/bin/gradle" "${args[@]}"
|
||||||
exit $?
|
exit $?
|
||||||
@ -29,16 +26,27 @@ d_plugin_v=(2.14.1 2.14.1 2.12 2.12 2.4 2.4 2.3 2.2.1 2.2.1 2.1 2.1 1.12 1.12
|
|||||||
# All gradle versions we know about
|
# All gradle versions we know about
|
||||||
plugin_v=(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)
|
plugin_v=(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)
|
||||||
|
|
||||||
# Find the highest version available
|
v_all=${plugin_v[@]}
|
||||||
for v in ${plugin_v[*]}; do
|
echo "Available gradle versions: ${v_all[@]}"
|
||||||
if contains $v "${v_all[*]}"; then
|
|
||||||
v_def=$v
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Earliest takes priority
|
# Earliest takes priority
|
||||||
for f in build.gradle ../build.gradle; do
|
for f in {.,..}/gradle/wrapper/gradle-wrapper.properties; do
|
||||||
|
[[ -f $f ]] || continue
|
||||||
|
while read l; do
|
||||||
|
if [[ $l == 'distributionUrl='* ]]; then
|
||||||
|
wrapper_ver=$(echo -n "$l" | sed "s/.*gradle-\\([0-9\\.\\+]\\+\\).*/\\1/")
|
||||||
|
fi
|
||||||
|
done < $f
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -n $wrapper_ver ]]; then
|
||||||
|
v_found=$wrapper_ver
|
||||||
|
echo "Found $v_found via distributionUrl"
|
||||||
|
run_gradle
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Earliest takes priority
|
||||||
|
for f in {.,..}/build.gradle; do
|
||||||
[[ -f $f ]] || continue
|
[[ -f $f ]] || continue
|
||||||
while read l; do
|
while read l; do
|
||||||
if [[ -z "$plugin_pver" && $l == *'com.android.tools.build:gradle:'* ]]; then
|
if [[ -z "$plugin_pver" && $l == *'com.android.tools.build:gradle:'* ]]; then
|
||||||
@ -72,6 +80,14 @@ if [[ -n $plugin_pver ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Find the highest version available
|
||||||
|
for v in ${plugin_v[*]}; do
|
||||||
|
if contains $v "${v_all[*]}"; then
|
||||||
|
v_def=$v
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [[ -z $v_found ]]; then
|
if [[ -z $v_found ]]; then
|
||||||
echo "No suitable gradle version found - defaulting to $v_def"
|
echo "No suitable gradle version found - defaulting to $v_def"
|
||||||
v_found=$v_def
|
v_found=$v_def
|
||||||
|
Loading…
Reference in New Issue
Block a user