How do I manually create a Test source set (for linuxCommon)? Currently the sourceSets block looks like the following:
Copy code
// ...
sourceSets {
commonMain {
dependencies {
// ...
}
}
val linuxCommonMain by creating {
// ...
}
@Suppress("UNUSED_VARIABLE")
val linuxX64Main by getting {
dependsOn(linuxCommonMain)
}
@Suppress("UNUSED_VARIABLE")
val frontendMain by getting {
resources.srcDir(webDir)
}
}
napperley
09/17/2022, 3:22 AM
Is there a way to create a source set that covers both source code and test code (for a platform common module)?
napperley
09/17/2022, 3:25 AM
With Kotlin Native for example a module can be created that is based on a target (eg linuxX64), which covers test and source as separate modules.
e
ephemient
09/17/2022, 6:30 AM
it should automatically be the case that
linuxX64Test.dependsOn(linuxX64Main)
, which means it transitively depends on
linuxCommonMain
. is what you want a
linuxCommonTest
source set?
n
napperley
09/18/2022, 2:53 AM
@Sebastian Sellmair [JB] The linuxX64Test source set would be required to run the tests for obvious reasons. Looks the the Kotlin Multiplatform plugin doesn't support adding test libraries as dependencies (via the missing testImplementation function) 😦 . Having a linuxCommonTest source set to cover the testing for linuxCommon is the plan, along with linuxX64Test being used as the test runner.
napperley
09/19/2022, 2:26 AM
In the end the idea of having the linuxCommonTest source set was scrapped in favour of going with the linuxCommon / linuxX64Test combination.
v
Vampire
09/19/2022, 10:09 AM
Btw. since when can a source set depend on a source set? o_O