How do I manually create a Test source set (for li...
# gradle
n
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)
        }
    }
Is there a way to create a source set that covers both source code and test code (for a platform common module)?
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
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
@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.
In the end the idea of having the linuxCommonTest source set was scrapped in favour of going with the linuxCommon / linuxX64Test combination.
v
Btw. since when can a source set depend on a source set? o_O
Ah, that's something Kotlin MPP specific, I see