Big Chungus
01/29/2023, 6:28 PMandroidInstrumentedTest sourceSet doesn't inherit dependencies from androidUnitTest nor sources from commonTest?Jeff Lockhart
01/29/2023, 9:36 PMandroidInstrumentedTest no longer inherits from commonTest.
I'm not sure about the dependency sharing. Did that used to be the case in the old source set layout?Sebastian Sellmair [JB]
01/30/2023, 11:13 PMSebastian Sellmair [JB]
01/30/2023, 11:13 PMJeff Lockhart
01/30/2023, 11:23 PMandroidInstrumentedTest to inherit from commonTest, but not androidUnitTest, as the common tests require running on a device for the Android platform. So I still employ this workaround to sever the dependency for androidUnitTest.Sebastian Sellmair [JB]
01/31/2023, 7:50 AMJeff Lockhart
02/01/2023, 3:41 AMandroidUnitTest dependency on commonTest? I haven't run into any issues with this workaround. Without it, the tests attempt to run as Android unit tests and fail.Sebastian Sellmair [JB]
02/01/2023, 8:44 AMJeff Lockhart
02/02/2023, 1:45 AMandroidUnitTest) or has Android-specific dependencies that require androidInstrumentedTest. In my case, it's the latter. The majority of code is shared between the JVM and Android source sets, but the underlying Android library requires a valid Android Context and loads a native JNI library which only works on a physical Android device.
I think it's good that androidInstrumentedTest no longer depends on commonTest by default, as it's unlikely someone would want both androidUnitTest and androidInstrumentedTest to depend on commonTest. But it should be equally possible to choose androidInstrumentedTest as the edge that does depend on commonTest and not androidUnitTest.
Will it be possible to configure the source set dependency graph this way with the new source set DSL in 1.8.20?Jeff Lockhart
02/08/2023, 6:32 PMandroidUnitTest as a commonTest edge no longer works as of Kotlin 1.8. It worked up to 1.7.21. I'm looking forward to a solution for how to properly remove the edge or switch it to use androidInstrumentedTest. Please let me know if I can assist in any way.Sebastian Sellmair [JB]
02/08/2023, 7:00 PMJeff Lockhart
02/08/2023, 9:24 PMkotlin {
android {
commonTestEdge = INSTRUMENTED // UNIT, INSTRUMENTED, or BOTH (default UNIT)
}
}
// or
kotlin {
android(commonTestEdge = INSTRUMENTED)
}
This would allow the user to configure either of the Android test edges to depend on common, or both, as it seems there are some users that use the commonTest source set for common test fixtures, but not necessarily tests that cannot run as either unit or instrumented.
This API change should not affect existing code, which would continue with the default behavior of BOTH pre-1.8 and UNIT post-1.8.Jeff Lockhart
02/09/2023, 9:11 PMtargetHierarchy.default {
common {
withAndroid(commonTestEdge = INSTRUMENTED)
}
}Alex Vanyo
04/25/2023, 5:55 PMjvmUnitTest and jvmInstrumentedTest instead of jvmTest (if you wanted to)?Sebastian Sellmair [JB]
04/25/2023, 6:03 PMJeff Lockhart
05/05/2023, 5:06 PMandroidUnitTest being connected to commonTest.
targetHierarchy.android {
instrumentedTest.sourceSetTree.set(SourceSetTree.test)
unitTest.sourceSetTree.set(SourceSetTree.unitTest)
}