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 modules = listOf("Android", "Lib")
|
||||||
val flavors = listOf("Flavor1", "Flavor2")
|
val flavors = listOf("Flavor1", "Flavor2")
|
||||||
val buildTypes = listOf("Debug", "Release")
|
val buildTypes = listOf("Debug")
|
||||||
|
|
||||||
val tasks = arrayListOf<String>()
|
val tasks = arrayListOf<String>()
|
||||||
for (module in modules) {
|
for (module in modules) {
|
||||||
@@ -142,31 +142,26 @@ abstract class AbstractKotlinAndroidGradleTests(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project.build("build", "assembleAndroidTest") {
|
project.build("assembleDebug", "test") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
// Before 3.0 AGP test only modules are compiled only against one flavor and one build type,
|
// Before 3.0 AGP test only modules are compiled only against one flavor and one build type,
|
||||||
// and contain only the compileDebugKotlin task.
|
// and contain only the compileDebugKotlin task.
|
||||||
// After 3.0 AGP test only modules contain a compile<Variant>Kotlin task for each variant.
|
// After 3.0 AGP test only modules contain a compile<Variant>Kotlin task for each variant.
|
||||||
tasks.addAll(findTasksByPattern(":Test:compile[\\w\\d]+Kotlin"))
|
tasks.addAll(findTasksByPattern(":Test:compile[\\w\\d]+Kotlin"))
|
||||||
assertTasksExecuted(tasks)
|
assertTasksExecuted(tasks)
|
||||||
if (isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
|
assertContains("InternalDummyTest PASSED")
|
||||||
// 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")
|
|
||||||
}
|
|
||||||
checkKotlinGradleBuildServices()
|
checkKotlinGradleBuildServices()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the build second time, assert everything is up-to-date
|
// Run the build second time, assert everything is up-to-date
|
||||||
project.build("build") {
|
project.build("assembleDebug") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertTasksUpToDate(tasks)
|
assertTasksUpToDate(tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the build third time, re-run tasks
|
// Run the build third time, re-run tasks
|
||||||
|
|
||||||
project.build("build", "--rerun-tasks") {
|
project.build("assembleDebug", "--rerun-tasks") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertTasksExecuted(tasks)
|
assertTasksExecuted(tasks)
|
||||||
checkKotlinGradleBuildServices()
|
checkKotlinGradleBuildServices()
|
||||||
|
|||||||
Reference in New Issue
Block a user