From 7f1acadaf1caa3e0aa19cd34e67b995ef18f2010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 11 Mar 2014 17:33:19 +0100 Subject: [PATCH] Properly default to the highest version of gradle --- buildserver/cookbooks/gradle/recipes/gradle | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/buildserver/cookbooks/gradle/recipes/gradle b/buildserver/cookbooks/gradle/recipes/gradle index 072aa407..3afbc268 100755 --- a/buildserver/cookbooks/gradle/recipes/gradle +++ b/buildserver/cookbooks/gradle/recipes/gradle @@ -9,7 +9,6 @@ pushd "${verdir}" &>/dev/null v_all=(*/) v_all=(${v_all[@]%/}) -v_def=${v_all[-1]} echo "Available gradle versions: ${v_all[@]}" popd &>/dev/null @@ -19,11 +18,23 @@ run_gradle() { exit $? } +contains() { + local e + for e in $2; do + [[ $e == $1 ]] && return 0; + done + return 1 +} + # key-value pairs of what gradle version each gradle plugin version # should accept d_plugin_k=( 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2) d_plugin_v=(1.11 1.10 1.9 1.8 1.6 1.6 1.4 1.4) +for v in ${d_plugin_v}; do + contains $v "${v_all[*]}" && v_def=$v && break +done + # Latest takes priority for f in ../build.gradle build.gradle; do [[ -f $f ]] || continue