busytown/androidx_multiplatform_mac_arm64.sh without higher memory

Bug: 322408860

Test: Run `busytown/androidx_multiplatform_mac_arm64.sh`      and see that it mentions androidx.lowMemory overriding androidx.highMemory
Test: Run `busytown/androidx_multiplatform_mac.sh`            and see that it doesn't mention androidx.lowMemory
Test: Run `busytown/androidx_multiplatform_mac_host_tests.sh` and see that it doesn't mention androidx.lowMemory
Test: Run `busytown/impl/build.sh`                            and see that it doesn't mention androidx.lowMemory.

Change-Id: I2f761085890ce731af6df226738434dde322fe11
diff --git a/gradlew b/gradlew
index 11901b7e..64c7da7 100755
--- a/gradlew
+++ b/gradlew
@@ -303,14 +303,26 @@
   fi
 done
 
+raiseMemory=false
 if [[ " ${@} " =~ " -Pandroidx.highMemory " ]]; then
-    #Set the initial heap size to match the max heap size,
-    #by replacing a string like "-Xmx1g" with one like "-Xms1g -Xmx1g"
-    MAX_MEM=32g
-    ORG_GRADLE_JVMARGS="$(echo $ORG_GRADLE_JVMARGS | sed "s/-Xmx\([^ ]*\)/-Xms$MAX_MEM -Xmx$MAX_MEM/")"
+    raiseMemory=true
+fi
+if [[ " ${@} " =~ " -Pandroidx.lowMemory " ]]; then
+  if [ "$raiseMemory" == "true" ]; then
+    echo "androidx.lowMemory overriding androidx.highMemory"
+    echo
+  fi
+  raiseMemory=false
+fi
 
-    # Increase the compiler cache size: b/260643754 . Remove when updating to JDK 20 ( https://bugs.openjdk.org/browse/JDK-8295724 )
-    ORG_GRADLE_JVMARGS="$(echo $ORG_GRADLE_JVMARGS | sed "s|$| -XX:ReservedCodeCacheSize=576M|")"
+if [ "$raiseMemory" == "true" ]; then
+  # Set the initial heap size to match the max heap size,
+  # by replacing a string like "-Xmx1g" with one like "-Xms1g -Xmx1g"
+  MAX_MEM=32g
+  ORG_GRADLE_JVMARGS="$(echo $ORG_GRADLE_JVMARGS | sed "s/-Xmx\([^ ]*\)/-Xms$MAX_MEM -Xmx$MAX_MEM/")"
+
+  # Increase the compiler cache size: b/260643754 . Remove when updating to JDK 20 ( https://bugs.openjdk.org/browse/JDK-8295724 )
+  ORG_GRADLE_JVMARGS="$(echo $ORG_GRADLE_JVMARGS | sed "s|$| -XX:ReservedCodeCacheSize=576M|")"
 fi
 
 # check whether the user has requested profiling via yourkit