Do not build release variant for Android Gradle test
This speeds up the test case significally. On my machine the time spent in test case dropped from 1+ minute to 15 seconds.
This commit is contained in:
+5
-10
@@ -131,7 +131,7 @@ abstract class AbstractKotlinAndroidGradleTests(
|
||||
|
||||
val modules = listOf("Android", "Lib")
|
||||
val flavors = listOf("Flavor1", "Flavor2")
|
||||
val buildTypes = listOf("Debug", "Release")
|
||||
val buildTypes = listOf("Debug")
|
||||
|
||||
val tasks = arrayListOf<String>()
|
||||
for (module in modules) {
|
||||
@@ -142,31 +142,26 @@ abstract class AbstractKotlinAndroidGradleTests(
|
||||
}
|
||||
}
|
||||
|
||||
project.build("build", "assembleAndroidTest") {
|
||||
project.build("assembleDebug", "test") {
|
||||
assertSuccessful()
|
||||
// Before 3.0 AGP test only modules are compiled only against one flavor and one build type,
|
||||
// and contain only the compileDebugKotlin task.
|
||||
// After 3.0 AGP test only modules contain a compile<Variant>Kotlin task for each variant.
|
||||
tasks.addAll(findTasksByPattern(":Test:compile[\\w\\d]+Kotlin"))
|
||||
assertTasksExecuted(tasks)
|
||||
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
||||
// known bug: new AGP does not run Kotlin tests
|
||||
// https://issuetracker.google.com/issues/38454212
|
||||
// TODO: remove when the bug is fixed
|
||||
assertContains("InternalDummyTest PASSED")
|
||||
}
|
||||
assertContains("InternalDummyTest PASSED")
|
||||
checkKotlinGradleBuildServices()
|
||||
}
|
||||
|
||||
// Run the build second time, assert everything is up-to-date
|
||||
project.build("build") {
|
||||
project.build("assembleDebug") {
|
||||
assertSuccessful()
|
||||
assertTasksUpToDate(tasks)
|
||||
}
|
||||
|
||||
// Run the build third time, re-run tasks
|
||||
|
||||
project.build("build", "--rerun-tasks") {
|
||||
project.build("assembleDebug", "--rerun-tasks") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(tasks)
|
||||
checkKotlinGradleBuildServices()
|
||||
|
||||
Reference in New Issue
Block a user