1+ import org.apache.tools.ant.taskdefs.condition.Os
12import org.gradle.api.tasks.testing.logging.TestExceptionFormat
23import org.gradle.api.tasks.testing.logging.TestLogEvent
4+ import java.io.InputStream
35
46plugins {
57 alias(libs.plugins.android.application) apply false
@@ -9,6 +11,7 @@ plugins {
911 alias(libs.plugins.test.logger.plugin) apply false
1012 alias(libs.plugins.ben.manes.versions) apply false
1113 id(" base" )
14+ id(" testOptionsConvention" )
1215}
1316
1417val compileSdkVersion by extra(34 )
@@ -201,3 +204,50 @@ tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
201204 reportfileName = " dependency-updates"
202205}
203206// check for latest dependencies - ./gradlew dependencyUpdates -Drevision=release
207+
208+ tasks.register(" devRunEmulatorTests" ) {
209+ doLast {
210+ EmulatorJobsMatrix ().getTaskList(rootProject = rootProject).forEach { gradleTasks ->
211+ exec {
212+ executable = File (
213+ project.rootDir,
214+ if (Os .isFamily(Os .FAMILY_WINDOWS )) " gradlew.bat" else " gradlew" ,
215+ )
216+ .also { it.setExecutable(true ) }
217+ .absolutePath
218+ args = gradleTasks
219+ println (" exec: ${this .commandLine.joinToString(separator = " " )} " )
220+ }.apply { println (" ExecResult: $this " ) }
221+ }
222+ }
223+ }
224+
225+ tasks.register(" ciEmulatorJobsMatrixSetup" ) {
226+ doLast {
227+ EmulatorJobsMatrix ().createMatrixJsonFile(rootProject = rootProject)
228+ }
229+ }
230+
231+ tasks.register(" ciSdkManagerLicenses" ) {
232+ doLast {
233+ val sdkDirPath = getAndroidSdkPath(rootDir = rootDir)
234+ getSdkmanagerFile(rootDir = rootDir)?.let { sdkmanagerFile ->
235+ val yesInputStream = object : InputStream () {
236+ private val yesString = " y\n "
237+ private var counter = 0
238+ override fun read (): Int = yesString[counter % 2 ].also { counter++ }.code
239+ }
240+ exec {
241+ executable = sdkmanagerFile.absolutePath
242+ args = listOf (" --list" , " --sdk_root=$sdkDirPath " )
243+ println (" exec: ${this .commandLine.joinToString(separator = " " )} " )
244+ }.apply { println (" ExecResult: $this " ) }
245+ exec {
246+ executable = sdkmanagerFile.absolutePath
247+ args = listOf (" --licenses" , " --sdk_root=$sdkDirPath " )
248+ standardInput = yesInputStream
249+ println (" exec: ${this .commandLine.joinToString(separator = " " )} " )
250+ }.apply { println (" ExecResult: $this " ) }
251+ }
252+ }
253+ }
0 commit comments