aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hoisie <hoisie@google.com>2024-04-04 17:40:22 -0700
committerCopybara-Service <copybara-worker@google.com>2024-04-04 17:41:03 -0700
commit479f1fc7221df34e94dd00941ddf894837eead09 (patch)
treeaad8f15ba6d4ff05c1e7f5099cacc97eba932d94
parentb7244e3e1a49d52069afba98d82b095148d178c2 (diff)
downloadrobolectric-479f1fc7221df34e94dd00941ddf894837eead09.tar.gz
Update dependency-on-stubs build.gradle to use AGP
There were several issues with the dependency-on-stubs build.gradle: 1) The original intent of this test is to ensure that the runtime classpath does not contain the android-all jar, but the android-all was explicitly being used in the runtime classpath. 2) The android-29 stubs jar was hardcoded in the dependency-on-stubs build.gradle. It is not guaranteed that android-29 will be installed. Update the dependency-on-stubs to use AGP, and remove the runtime dependency on android-all. Fixes #8962 PiperOrigin-RevId: 622020695
-rw-r--r--integration_tests/dependency-on-stubs/build.gradle30
1 files changed, 21 insertions, 9 deletions
diff --git a/integration_tests/dependency-on-stubs/build.gradle b/integration_tests/dependency-on-stubs/build.gradle
index 683de182d..8bd8e1bf3 100644
--- a/integration_tests/dependency-on-stubs/build.gradle
+++ b/integration_tests/dependency-on-stubs/build.gradle
@@ -1,18 +1,30 @@
-import org.robolectric.gradle.RoboJavaModulePlugin
+import org.robolectric.gradle.AndroidProjectConfigPlugin
-apply plugin: RoboJavaModulePlugin
+apply plugin: 'com.android.library'
+apply plugin: AndroidProjectConfigPlugin
// test with a project that depends on the stubs jar, not org.robolectric:android-all
-dependencies {
- api project(":robolectric")
- api libs.junit4
+android {
+ compileSdk 33
+ namespace 'org.robolectric'
+
+ defaultConfig {
+ minSdk 19
+ targetSdk 33
+ }
- testImplementation files("${System.getenv("ANDROID_HOME")}/platforms/android-29/android.jar")
+ compileOptions {
+ sourceCompatibility = '1.8'
+ targetCompatibility = '1.8'
+ }
- testCompileOnly AndroidSdk.MAX_SDK.coordinates // compile against latest Android SDK
- testRuntimeOnly AndroidSdk.MAX_SDK.coordinates
+ testOptions.unitTests.includeAndroidResources true
+}
+
+dependencies {
+ testImplementation project(":robolectric")
+ testImplementation libs.junit4
testImplementation libs.truth
- testImplementation libs.mockito
testImplementation libs.hamcrest.junit
}