buildSrc/src/main/kotlin/Avdl.kt
changeset 19 91a3ad3b1b9c
parent 10 9aad34f43f71
child 20 5d8a0555733d
--- a/buildSrc/src/main/kotlin/Avdl.kt	Wed Oct 06 16:05:47 2021 -0400
+++ b/buildSrc/src/main/kotlin/Avdl.kt	Tue Nov 29 14:05:44 2022 -0400
@@ -46,6 +46,34 @@
 fun Project.configureAvdlDevices(flydroidUrl: String, flydroidKey: String) {
     apply<FlydroidPlugin>()
 
+    // as FlydroidPlugin add some repositories to look for dependencies
+    // the repositories set in settings.gradle.kts via dependencyResolutionManagement
+    // are ignored because we are in mode PREFER_PROJECT
+    // to fix that we add the missing repository here too
+    repositories { // this mirror contents in settings.gradle.kts
+        google {
+            content {
+                includeGroupByRegex("""android\.arch\..*""")
+                includeGroupByRegex("""androidx\..*""")
+                includeGroupByRegex("""com\.android\..*""")
+                includeGroupByRegex("""com\.google\..*""")
+                includeGroup("com.crashlytics.sdk.android")
+                includeGroup("io.fabric.sdk.android")
+                includeGroup("org.chromium.net")
+                includeGroup("zipflinger")
+                includeGroup("com.android")
+            }
+        }
+        mavenCentral()
+        // for geekdroid
+        flatDir {
+            dirs("$rootDir/libs")
+        }
+        maven {
+            url = uri("https://jitpack.io")
+        }
+
+    }
     val oneInstrumentedTestService = gradle.sharedServices.registerIfAbsent(
             "oneInstrumentedTest", OneInstrumentedTestService::class.java) {
         maxParallelUsages.set(1)
@@ -57,12 +85,12 @@
     configure<AvdlExtension> {
         devices {
             android.testVariants.all {
-                register("android-n-${project.path}-$baseName") {
+                register("android-p-${project.path}-$baseName") {
                     setup = flydroid {
                         url = flydroidUrl
                         this.flydroidKey = flydroidKey
                         // android-q images fail, don't manage to start the tests
-                        image = "android-n"
+                        image = "android-p"
                          useTunnel = true
                     }
                 }
@@ -75,7 +103,7 @@
         var lastTestTask: TaskProvider<out Task>? = null
         android.testVariants.all {
             val (startTask, stopTask ) =
-                registerAvdlDevicesTaskForVariant(this, listOf("android-n-${project.path}-$baseName"))
+                registerAvdlDevicesTaskForVariant(this, listOf("android-p-${project.path}-$baseName"))
             listOf(startTask, stopTask).forEach {
                 it.configure {
                     usesService(oneInstrumentedTestService)