Disable gradle deamon by default.

Change-Id: I917466150656ef880e94e2b8220b4912b2d933f1
Bug: https://github.com/flutter/flutter/issues/66509
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/6740
Reviewed-by: Christopher Fujino <fujino@google.com>
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipe_modules/android_sdk/api.py b/recipe_modules/android_sdk/api.py
index a106234..9884158 100644
--- a/recipe_modules/android_sdk/api.py
+++ b/recipe_modules/android_sdk/api.py
@@ -66,6 +66,7 @@
     # Setup environment variables
     env['ANDROID_SDK_ROOT'] = sdk_root
     env['ANDROID_HOME'] = sdk_root
+    env['GRADLE_OPTS'] = '-Dorg.gradle.daemon=false'
     paths = env_prefixes.get('PATH', [])
     paths.append(sdk_root.join('platform-tools'))
     paths.append(sdk_root.join('tools'))
diff --git a/recipe_modules/android_sdk/examples/full.expected/demo.json b/recipe_modules/android_sdk/examples/full.expected/demo.json
index 9eefe6e..be26b20 100644
--- a/recipe_modules/android_sdk/examples/full.expected/demo.json
+++ b/recipe_modules/android_sdk/examples/full.expected/demo.json
@@ -185,7 +185,8 @@
     ],
     "env": {
       "ANDROID_HOME": "[CACHE]/android29",
-      "ANDROID_SDK_ROOT": "[CACHE]/android29"
+      "ANDROID_SDK_ROOT": "[CACHE]/android29",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false"
     },
     "env_prefixes": {
       "PATH": [
diff --git a/recipe_modules/flutter_deps/examples/full.expected/with-gems.json b/recipe_modules/flutter_deps/examples/full.expected/with-gems.json
index fbc8884..b4a992a 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/with-gems.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/with-gems.json
@@ -578,7 +578,8 @@
       "CHROME_EXECUTABLE": "[CACHE]/chrome/chrome/chrome",
       "CHROME_NO_SANDBOX": "true",
       "GEM_HOME": "[START_DIR]/gems",
-      "GOPATH": "[CLEANUP]/go_path"
+      "GOPATH": "[CLEANUP]/go_path",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false"
     },
     "env_prefixes": {
       "PATH": [
@@ -611,7 +612,8 @@
       "CHROME_EXECUTABLE": "[CACHE]/chrome/chrome/chrome",
       "CHROME_NO_SANDBOX": "true",
       "GEM_HOME": "[START_DIR]/gems",
-      "GOPATH": "[CLEANUP]/go_path"
+      "GOPATH": "[CLEANUP]/go_path",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false"
     },
     "env_prefixes": {
       "PATH": [
diff --git a/recipes/devicelab.expected/android_defines_test.json b/recipes/devicelab.expected/android_defines_test.json
index 18e8101..91746da 100644
--- a/recipes/devicelab.expected/android_defines_test.json
+++ b/recipes/devicelab.expected/android_defines_test.json
@@ -409,6 +409,7 @@
       "ANDROID_HOME": "[CACHE]/android",
       "ANDROID_SDK_ROOT": "[CACHE]/android",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "PUB_CACHE": "[CACHE]/.pub-cache"
     },
     "env_prefixes": {
diff --git a/recipes/devicelab.expected/flavors_test.json b/recipes/devicelab.expected/flavors_test.json
index 79c6c6b..c154cd0 100644
--- a/recipes/devicelab.expected/flavors_test.json
+++ b/recipes/devicelab.expected/flavors_test.json
@@ -409,6 +409,7 @@
       "ANDROID_HOME": "[CACHE]/android",
       "ANDROID_SDK_ROOT": "[CACHE]/android",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "PUB_CACHE": "[CACHE]/.pub-cache"
     },
     "env_prefixes": {
diff --git a/recipes/flutter/flutter_drone.expected/android_sdk.json b/recipes/flutter/flutter_drone.expected/android_sdk.json
index bc671c1..5d9400a 100644
--- a/recipes/flutter/flutter_drone.expected/android_sdk.json
+++ b/recipes/flutter/flutter_drone.expected/android_sdk.json
@@ -299,6 +299,7 @@
       "ANDROID_HOME": "[CACHE]/android",
       "ANDROID_SDK_ROOT": "[CACHE]/android",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
       "SUBSHARD": null
@@ -323,6 +324,7 @@
       "ANDROID_HOME": "[CACHE]/android",
       "ANDROID_SDK_ROOT": "[CACHE]/android",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
       "SUBSHARD": null
@@ -348,6 +350,7 @@
       "ANDROID_HOME": "[CACHE]/android",
       "ANDROID_SDK_ROOT": "[CACHE]/android",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
       "SUBSHARD": null
diff --git a/recipes/flutter/flutter_drone_1_21_0.expected/android_sdk.json b/recipes/flutter/flutter_drone_1_21_0.expected/android_sdk.json
index 2d6aa62..a15d9d6 100644
--- a/recipes/flutter/flutter_drone_1_21_0.expected/android_sdk.json
+++ b/recipes/flutter/flutter_drone_1_21_0.expected/android_sdk.json
@@ -433,6 +433,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
@@ -464,6 +465,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
@@ -495,6 +497,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
diff --git a/recipes/flutter/flutter_drone_1_21_0.expected/no_requirements.json b/recipes/flutter/flutter_drone_1_21_0.expected/no_requirements.json
index 2d6aa62..a15d9d6 100644
--- a/recipes/flutter/flutter_drone_1_21_0.expected/no_requirements.json
+++ b/recipes/flutter/flutter_drone_1_21_0.expected/no_requirements.json
@@ -433,6 +433,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
@@ -464,6 +465,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
@@ -495,6 +497,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
diff --git a/recipes/flutter/flutter_drone_1_21_0.expected/xcode.json b/recipes/flutter/flutter_drone_1_21_0.expected/xcode.json
index 2d6aa62..a15d9d6 100644
--- a/recipes/flutter/flutter_drone_1_21_0.expected/xcode.json
+++ b/recipes/flutter/flutter_drone_1_21_0.expected/xcode.json
@@ -433,6 +433,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
@@ -464,6 +465,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,
@@ -495,6 +497,7 @@
       "CHROME_NO_SANDBOX": "true",
       "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
       "GOLDCTL": "[CACHE]/gold/goldctl",
+      "GRADLE_OPTS": "-Dorg.gradle.daemon=false",
       "JAVA_HOME": "[CACHE]/java",
       "PUB_CACHE": "[CACHE]/.pub-cache",
       "SHARD": null,