SAMZA-474: check-all script fails more gracefully in the absence of gradlew
authorAleksandar Pejakovic <a.pejakovic@levi9.com>
Thu, 11 Jun 2015 00:56:13 +0000 (17:56 -0700)
committerYan Fang <yanfang724@gmail.com>
Thu, 11 Jun 2015 00:56:13 +0000 (17:56 -0700)
bin/check-all.sh

index 0725b82..67bf776 100755 (executable)
@@ -56,6 +56,21 @@ if [ "$any_not_set" = "true" ]; then
   exit 0
 fi
 
+# chose gradle script (prefers gradlew)
+if [ -e "${base_dir}/gradlew" ]; then
+  gradle_file="${base_dir}/gradlew"
+else
+  gradle_base_file=$(which gradle)
+
+  if [ -f "${gradle_base_file}" ]; then
+    gradle_file="${gradle_base_file}"
+    echo "Gradlew is not found. Using currently installed gradle, found on: ${gradle_file}."
+  else
+    echo "No gradle has been found on system, please install it."
+    exit 1
+  fi
+fi
+
 # run all checks
 for i in "${JDKs[@]}"
 do
@@ -66,7 +81,7 @@ do
     for yarn_version in "${YARNs[@]}"
     do
       echo "------------- Running check task against JDK${jdk_number}/Scala ${scala_version}/YARN ${yarn_version}"
-      $base_dir/gradlew -PscalaVersion=${scala_version} -PyarnVersion=${yarn_version} -Dorg.gradle.java.home=${!i} clean check $@
+      ${gradle_file} -PscalaVersion=${scala_version} -PyarnVersion=${yarn_version} -Dorg.gradle.java.home=${!i} clean check $@
       echo "------------- Finished running check task against JDK${jdk_number}/Scala ${scala_version}/YARN ${yarn_version}"
     done
   done