fix(build): configure core domain source sets through container members

The second CI round got past the missing configure import but still
failed in the same file: bare name accessors inside sourceSets { }
(commonMain.dependencies { ... }, commonTest, jvmTest) are kotlin-dsl
script syntax generated for .kts files. Plugin source compiled as plain
Kotlin has no such accessors on its classpath, so the four dependency
blocks failed with receiver type mismatches while every real member call
around them - jvmToolchain, jvm(), the ios targets, binaries.framework -
already resolved.

Configure the source sets through the container API instead:
sourceSets.getByName("commonMain").dependencies { ... }. getByName,
dependencies and implementation are all members on types that ship with
KGP 2.4.10, verified against the gradle plugin jars byte for byte.
getByName is safe at this point because jvm() above has just created the
jvm source sets synchronously; commonMain and commonTest exist as soon
as the multiplatform plugin is applied.
This commit is contained in:
mckero committed 2026-09-27 10:28:37 +01:00
1 parent fa91e89024
commit 9deb517874
1 file changed
+16 -14
@@ -46,20 +46,22 @@ internal class CoreDomainPlugin : Plugin<Project> {
isStatic = true isStatic = true
} }
} }
sourceSets { // The bare name accessors (commonMain, jvmTest, ...) are script-only syntax;
commonMain.dependencies { // plugin source has to resolve through the container members, so configure each
implementation(libs.kotlin.coroutines) // source set by name. getByName is safe here: jvm() above has just created the
implementation(libs.kotlin.serialization) // jvm source sets, the same pattern the local probe build script relies on.
} sourceSets.getByName("commonMain").dependencies {
commonTest.dependencies { implementation(libs.kotlin.coroutines)
implementation(libs.kotlin.test) implementation(libs.kotlin.serialization)
implementation(libs.test.coroutines) }
} sourceSets.getByName("commonTest").dependencies {
// JVM-only tests live here: the AndroidManifest check reads the file system, and implementation(libs.kotlin.test)
// the formatter oracle tests compare against java.lang.String.format. implementation(libs.test.coroutines)
jvmTest.dependencies { }
implementation(libs.test.junit4) // JVM-only tests live here: the AndroidManifest check reads the file system, and
} // the formatter oracle tests compare against java.lang.String.format.
sourceSets.getByName("jvmTest").dependencies {
implementation(libs.test.junit4)
} }
} }
} }