Centralize setting up robolectric
This makes sure that projects explicitly enable robolectric. This is
important because before this patch we were setting
isReturnDefaultValues and isIncludeAndroidResources for every project
and that can lead to unexpected issues:
- isReturnDefaultValues allows calling stub android.jar without crashes
but with no-op values which can lead to non-realistic tests
- isIncludeAndroidResources causes projects without any tests to attempt
to run as it generates R.class, but there is nothing to run. This
breaks with Gradle 9.0
We were also accidentally setting heap size to 3g for more projects than
necessary.
Bug: 414597336
Test: ./gradlew testReleaseUnitTest testAndroidHostTest
Change-Id: I945c9531faf69f106460b64559213eaa43023a3c
diff --git a/appfunctions/appfunctions-service/build.gradle b/appfunctions/appfunctions-service/build.gradle
index 912a05b8..fefa036 100644
--- a/appfunctions/appfunctions-service/build.gradle
+++ b/appfunctions/appfunctions-service/build.gradle
@@ -53,7 +53,6 @@
testImplementation(project(":appfunctions:appfunctions-stubs"))
testImplementation(libs.mockitoCore)
testImplementation(libs.testCore)
- testImplementation(libs.robolectric)
testImplementation(libs.kotlinTest)
androidTestCompileOnly(project(":appfunctions:appfunctions-stubs"))
@@ -83,4 +82,5 @@
type = SoftwareType.PUBLISHED_LIBRARY
inceptionYear = "2025"
description = "A runtime library for the app to expose AppFunctions"
+ enableRobolectric()
}