SeikoDes
02/06/2023, 2:38 AMandroidInstrumentedTest
doesn’t dependsOn commonTest
by default, is this a bug or desgin this?Sebastian Sellmair [JB]
02/06/2023, 8:08 AMkotlin {
val commonTest by sourceSets.getting
val androidInstrumentedTest by sourceSets.getting
androidInstrumentedTest.dependsOn(commonTest)
}
Paul Woitaschek
02/06/2023, 8:24 AMJohn O'Reilly
02/06/2023, 8:58 AMPaul Woitaschek
02/06/2023, 9:00 AMSebastian Sellmair [JB]
02/06/2023, 10:09 AMWhat’s the reason behind this?Because previously unitTests and instrumentedTests declared a dependsOn edge to commonTest. This certainly was not a good idea, since most projects either want to actualise a test from common as unit or instrumented test. The requirement to do it for both was bad. So given that you cannot have them both depend on commonTest: There needs to be a default to be chosen. Either instrumentedTests or unitTest or none will by default dependOn commonTest. We decided to go with unitTest by default.
Paul Woitaschek
02/06/2023, 10:43 AMJavier
02/06/2023, 10:45 AMSebastian Sellmair [JB]
02/06/2023, 11:00 AMkotlin {
val commonTestUtils by sourceSets.creating
val androidUnitTest by sourceSets.getting
val androidInstrumentedTest by sourceSets.getting
androidUnitTest.dependsOn(commonTestUtils)
androidInstrumentedTest.dependsOn(commonTestUtils)
// ...
}