gradlew now failing right away if --scan is specified with --offline

Bug: 201418435
Bug: https://github.com/gradle/gradle/issues/18474
Test: ./gradlew --scan --offline # and see that it fails right away rather than simply not creating a build scan

Change-Id: I72c7c56d47bf911a2a161a1972db225f229bfd20
diff --git a/gradlew b/gradlew
index 8f2ba2f..bbc6b8f2 100755
--- a/gradlew
+++ b/gradlew
@@ -294,6 +294,14 @@
   fi
 done
 
+if [[ " ${@} " =~ " --scan " ]]; then
+  if [[ " ${@} " =~ " --offline " ]]; then
+    echo "--scan incompatible with --offline"
+    echo "you could try --no-ci"
+    exit 1
+  fi
+fi
+
 function removeCaches() {
   rm -rf $SCRIPT_PATH/.gradle
   rm -rf $SCRIPT_PATH/buildSrc/.gradle