Fix CC invalidation when switching between IDE and cmdline

Set org.gradle.projectcachedir in gradle.properties so that Studio
picks up this value when running Gradle commands. We set this value
in gradlew, but Studio does not run gradlew, so gradle.properties
fixes that. It does have a short-coming that OUT_DIR being set is
not supported within studio, but it is way better than what we had
before. The main reason this is important is because kotlin gradle
compiler puts incremental compilation data into this cache directory
and having it move (prior to this change) was causing buildSrc to
be rebuilt every time when switching between the two.

Bug: 279090332
Test: ./gradlew tasks
      ./studiow all (and gradle sync)
      ./gradlew tasks -> hit the configuration cache
Change-Id: Icfce7061d996d05638d66da082cf8b6e4f8b3301
diff --git a/gradlew b/gradlew
index d4e9c09..3a5a6ec 100755
--- a/gradlew
+++ b/gradlew
@@ -397,14 +397,14 @@
   fi
 
   RETURN_VALUE=0
-  PROJECT_CACHE_DIR_ARGUMENT="--project-cache-dir $OUT_DIR/gradle-project-cache"
+  set -- "$@" -Dorg.gradle.projectcachedir="$OUT_DIR/gradle-project-cache"
   # Disabled in Studio until these errors become shown (b/268380971) or computed more quickly (https://github.com/gradle/gradle/issues/23272)
   if [[ " ${@} " =~ " --dependency-verification=" ]]; then
     VERIFICATION_ARGUMENT="" # already specified by caller
   else
     VERIFICATION_ARGUMENT=--dependency-verification=strict
   fi
-  if $wrapper "$JAVACMD" "${JVM_OPTS[@]}" $TMPDIR_ARG -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain $HOME_SYSTEM_PROPERTY_ARGUMENT $TMPDIR_ARG $PROJECT_CACHE_DIR_ARGUMENT $VERIFICATION_ARGUMENT "$ORG_GRADLE_JVMARGS" "$@"; then
+  if $wrapper "$JAVACMD" "${JVM_OPTS[@]}" $TMPDIR_ARG -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain $HOME_SYSTEM_PROPERTY_ARGUMENT $TMPDIR_ARG $VERIFICATION_ARGUMENT "$ORG_GRADLE_JVMARGS" "$@"; then
     RETURN_VALUE=0
   else
     # Print AndroidX-specific help message if build fails