From eb9a034572a0749f0af5017369bd8d87b65500eb Mon Sep 17 00:00:00 2001 From: Brad Corso Date: Wed, 6 Dec 2023 14:40:43 -0800 Subject: [PATCH] Configure Bazel and Gradle to avoid spurious flakes. This CL updates the global `bazelrc` file to enable `--incompatible_sandbox_hermetic_tmp` to avoid tmp file collision issues between actions. This CL also updates the `gradle.properties` to give more memory to avoid Java Heap OOM issues. RELNOTES=N/A PiperOrigin-RevId: 588547788 --- .../artifacts/dagger-android-ksp/gradle.properties | 1 + .../artifacts/dagger-android/simple/gradle.properties | 3 ++- javatests/artifacts/dagger-ksp/gradle.properties | 3 ++- javatests/artifacts/dagger/gradle.properties | 3 ++- .../hilt-android/pluginMarker/gradle.properties | 3 ++- .../artifacts/hilt-android/simple/gradle.properties | 1 + .../hilt-android/simpleKotlin/gradle.properties | 1 + .../hilt-android/viewmodel/gradle.properties | 3 ++- tools/bazel.rc | 11 +++++++++++ 9 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 tools/bazel.rc diff --git a/javatests/artifacts/dagger-android-ksp/gradle.properties b/javatests/artifacts/dagger-android-ksp/gradle.properties index c344b594be0..0bdf325d5ed 100644 --- a/javatests/artifacts/dagger-android-ksp/gradle.properties +++ b/javatests/artifacts/dagger-android-ksp/gradle.properties @@ -1,3 +1,4 @@ android.useAndroidX=true org.gradle.caching=true org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/javatests/artifacts/dagger-android/simple/gradle.properties b/javatests/artifacts/dagger-android/simple/gradle.properties index 6cde789f65d..0bdf325d5ed 100644 --- a/javatests/artifacts/dagger-android/simple/gradle.properties +++ b/javatests/artifacts/dagger-android/simple/gradle.properties @@ -1,3 +1,4 @@ android.useAndroidX=true org.gradle.caching=true -org.gradle.parallel=true \ No newline at end of file +org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/javatests/artifacts/dagger-ksp/gradle.properties b/javatests/artifacts/dagger-ksp/gradle.properties index e68633cff62..a516e458ccd 100644 --- a/javatests/artifacts/dagger-ksp/gradle.properties +++ b/javatests/artifacts/dagger-ksp/gradle.properties @@ -1,2 +1,3 @@ org.gradle.caching=true -org.gradle.parallel=true \ No newline at end of file +org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/javatests/artifacts/dagger/gradle.properties b/javatests/artifacts/dagger/gradle.properties index e68633cff62..a516e458ccd 100644 --- a/javatests/artifacts/dagger/gradle.properties +++ b/javatests/artifacts/dagger/gradle.properties @@ -1,2 +1,3 @@ org.gradle.caching=true -org.gradle.parallel=true \ No newline at end of file +org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/javatests/artifacts/hilt-android/pluginMarker/gradle.properties b/javatests/artifacts/hilt-android/pluginMarker/gradle.properties index 6cde789f65d..0bdf325d5ed 100644 --- a/javatests/artifacts/hilt-android/pluginMarker/gradle.properties +++ b/javatests/artifacts/hilt-android/pluginMarker/gradle.properties @@ -1,3 +1,4 @@ android.useAndroidX=true org.gradle.caching=true -org.gradle.parallel=true \ No newline at end of file +org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/javatests/artifacts/hilt-android/simple/gradle.properties b/javatests/artifacts/hilt-android/simple/gradle.properties index b88e839aa53..1efa70f690c 100644 --- a/javatests/artifacts/hilt-android/simple/gradle.properties +++ b/javatests/artifacts/hilt-android/simple/gradle.properties @@ -9,3 +9,4 @@ org.gradle.unsafe.configuration-cache-problems=fail org.gradle.unsafe.configuration-cache.max-problems=0 org.gradle.caching=true org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/javatests/artifacts/hilt-android/simpleKotlin/gradle.properties b/javatests/artifacts/hilt-android/simpleKotlin/gradle.properties index b88e839aa53..1efa70f690c 100644 --- a/javatests/artifacts/hilt-android/simpleKotlin/gradle.properties +++ b/javatests/artifacts/hilt-android/simpleKotlin/gradle.properties @@ -9,3 +9,4 @@ org.gradle.unsafe.configuration-cache-problems=fail org.gradle.unsafe.configuration-cache.max-problems=0 org.gradle.caching=true org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/javatests/artifacts/hilt-android/viewmodel/gradle.properties b/javatests/artifacts/hilt-android/viewmodel/gradle.properties index 8ba35263a51..1efa70f690c 100644 --- a/javatests/artifacts/hilt-android/viewmodel/gradle.properties +++ b/javatests/artifacts/hilt-android/viewmodel/gradle.properties @@ -8,4 +8,5 @@ android.enableJetifier=true org.gradle.unsafe.configuration-cache-problems=fail org.gradle.unsafe.configuration-cache.max-problems=0 org.gradle.caching=true -org.gradle.parallel=true \ No newline at end of file +org.gradle.parallel=true +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/tools/bazel.rc b/tools/bazel.rc new file mode 100644 index 00000000000..2707c1c3ac6 --- /dev/null +++ b/tools/bazel.rc @@ -0,0 +1,11 @@ +# Global bazelrc file (see https://bazel.build/run/bazelrc#global-bazelrc) + +# Note: This flag is required to prevent actions from clashing with each when +# reading/writing tmp files. Without this flag we get errors like: +# +# Error: Cannot use file /tmp/hsperfdata_runner/12 because it is locked by +# another process +# +# This flag will be enabled by default in Bazel 7.0.0, but for now we enable it +# manually. For more details: https://github.com/bazelbuild/bazel/issues/3236. +build --incompatible_sandbox_hermetic_tmp \ No newline at end of file