I have a second set of tests that I'd like to have...
# multiplatform
I have a second set of tests that I'd like to have in a separate sourceSet and, ideally, compilation. I know I can't create a new compilation for the "common" level, but I created a new common source set, then new compllations for each target. Is there a way to make the new common source set (which I called "commonFeatures") depend on the commonMain source set? I'm aware of the
function, which makes it visible at compile time, but when I run the tests, using kotest, I'm getting a NPE the first time I reference a type from the commonMain code. Any way to link these together, or will I have to admit defeat and just make a separate gradle project just for the second test tree? SOLVED (check thread)
This is my current gradle setup:
Copy code
kotlin {
	val commonMain by sourceSets.getting

	val commonFeatures by sourceSets.creating {


		// dependsOn(commonMain) // makes common code visible to compiler, but not at runtime
		dependencies {


	jvm {
		compilations {
			val main by getting

			val features by compilations.creating {
				defaultSourceSet {
					dependencies {
						implementation(main.compileDependencyFiles + main.output.classesDirs)

				tasks.register<Test>("jvmFeaturesTest") {
					group = "verification"
					classpath = compileDependencyFiles + runtimeDependencyFiles + output.allOutputs
					testClassesDirs = output.classesDirs
As it turned out, it had absolutely nothing to do with the source set dependency and everything to do with my using a self-reference to an abstract class during construction and trying to call a method defined in a parent interface before that interface had been delegated to an object. Had to do with the overly-fancy way I was gluing code together.