xref: /aosp_15_r20/external/robolectric/integration_tests/roborazzi/build.gradle.kts (revision e6ba16074e6af37d123cb567d575f496bf0a58ee)

<lambda>null1*e6ba1607SAndroid Build Coastguard Worker plugins {
2*e6ba1607SAndroid Build Coastguard Worker   alias(libs.plugins.android.library)
3*e6ba1607SAndroid Build Coastguard Worker   alias(libs.plugins.detekt)
4*e6ba1607SAndroid Build Coastguard Worker   alias(libs.plugins.kotlin.android)
5*e6ba1607SAndroid Build Coastguard Worker   alias(libs.plugins.robolectric.android.project)
6*e6ba1607SAndroid Build Coastguard Worker   alias(libs.plugins.robolectric.spotless)
7*e6ba1607SAndroid Build Coastguard Worker   alias(libs.plugins.roborazzi)
8*e6ba1607SAndroid Build Coastguard Worker }
9*e6ba1607SAndroid Build Coastguard Worker 
<lambda>null10*e6ba1607SAndroid Build Coastguard Worker android {
11*e6ba1607SAndroid Build Coastguard Worker   compileSdk = 34
12*e6ba1607SAndroid Build Coastguard Worker   namespace = "org.robolectric.integration.roborazzi"
13*e6ba1607SAndroid Build Coastguard Worker 
14*e6ba1607SAndroid Build Coastguard Worker   defaultConfig { minSdk = 21 }
15*e6ba1607SAndroid Build Coastguard Worker 
16*e6ba1607SAndroid Build Coastguard Worker   compileOptions {
17*e6ba1607SAndroid Build Coastguard Worker     sourceCompatibility = JavaVersion.VERSION_1_8
18*e6ba1607SAndroid Build Coastguard Worker     targetCompatibility = JavaVersion.VERSION_1_8
19*e6ba1607SAndroid Build Coastguard Worker   }
20*e6ba1607SAndroid Build Coastguard Worker 
21*e6ba1607SAndroid Build Coastguard Worker   kotlinOptions { jvmTarget = "1.8" }
22*e6ba1607SAndroid Build Coastguard Worker 
23*e6ba1607SAndroid Build Coastguard Worker   testOptions {
24*e6ba1607SAndroid Build Coastguard Worker     targetSdk = 34
25*e6ba1607SAndroid Build Coastguard Worker     unitTests {
26*e6ba1607SAndroid Build Coastguard Worker       isIncludeAndroidResources = true
27*e6ba1607SAndroid Build Coastguard Worker       all {
28*e6ba1607SAndroid Build Coastguard Worker         // For Roborazzi users, please use Roborazzi plugin and gradle.properties instead of this.
29*e6ba1607SAndroid Build Coastguard Worker         // https://takahirom.github.io/roborazzi/how-to-use.html#roborazzi-gradle-properties-options
30*e6ba1607SAndroid Build Coastguard Worker 
31*e6ba1607SAndroid Build Coastguard Worker         // Change naming strategy of screenshots.
32*e6ba1607SAndroid Build Coastguard Worker         // org.robolectric.....RoborazziCaptureTest.checkDialogRendering.png ->
33*e6ba1607SAndroid Build Coastguard Worker         // RoborazziCaptureTest.checkDialogRendering.png
34*e6ba1607SAndroid Build Coastguard Worker         it.systemProperty("roborazzi.record.namingStrategy", "testClassAndMethod")
35*e6ba1607SAndroid Build Coastguard Worker 
36*e6ba1607SAndroid Build Coastguard Worker         // Use RoborazziRule's base path when you use captureRoboImage(path).
37*e6ba1607SAndroid Build Coastguard Worker         it.systemProperty(
38*e6ba1607SAndroid Build Coastguard Worker           "roborazzi.record.filePathStrategy",
39*e6ba1607SAndroid Build Coastguard Worker           "relativePathFromRoborazziContextOutputDirectory",
40*e6ba1607SAndroid Build Coastguard Worker         )
41*e6ba1607SAndroid Build Coastguard Worker       }
42*e6ba1607SAndroid Build Coastguard Worker     }
43*e6ba1607SAndroid Build Coastguard Worker   }
44*e6ba1607SAndroid Build Coastguard Worker 
45*e6ba1607SAndroid Build Coastguard Worker   androidComponents {
46*e6ba1607SAndroid Build Coastguard Worker     beforeVariants(selector().all()) { variantBuilder ->
47*e6ba1607SAndroid Build Coastguard Worker       // Roborazzi does not support AndroidTest.
48*e6ba1607SAndroid Build Coastguard Worker       variantBuilder.enableAndroidTest = false
49*e6ba1607SAndroid Build Coastguard Worker     }
50*e6ba1607SAndroid Build Coastguard Worker   }
51*e6ba1607SAndroid Build Coastguard Worker }
52*e6ba1607SAndroid Build Coastguard Worker 
<lambda>null53*e6ba1607SAndroid Build Coastguard Worker dependencies {
54*e6ba1607SAndroid Build Coastguard Worker   api(project(":robolectric"))
55*e6ba1607SAndroid Build Coastguard Worker   testImplementation(libs.androidx.test.core)
56*e6ba1607SAndroid Build Coastguard Worker   testImplementation(libs.junit4)
57*e6ba1607SAndroid Build Coastguard Worker   testImplementation(libs.truth)
58*e6ba1607SAndroid Build Coastguard Worker   testImplementation(libs.roborazzi)
59*e6ba1607SAndroid Build Coastguard Worker   testImplementation(libs.roborazzi.rule)
60*e6ba1607SAndroid Build Coastguard Worker }
61