CLOVIS
03/11/2024, 7:32 PMkotlinExtension.sourceSets.named { it == "jsMain" }.configureEach {
println("The JS source set exists")
}
then the build fails with
> Configure project :core
e: Please initialize at least one Kotlin target in 'core (:core)'.
Read more <https://kotl.in/set-up-targets>
w: The following Kotlin source sets were configured but not added to any Kotlin compilation:
* commonMain
* commonTest
where :core
is just:
plugins {
kotlin("multiplatform")
id("my.plugin.here")
id("maven-publish")
}
kotlin {
jvm()
js(IR) {
browser()
}
}
My understanding is that .named { … }.configureEach { … }
is lazy and thus shouldn't impact the build configuration at all, and certainly not which platforms are declared.
I also tried
kotlinExtension.sourceSets.configureEach {
if (it.name != "jsMain") return@configureEach
println("The JS source set exists")
}
to the same result.CLOVIS
03/11/2024, 7:32 PMapply false
, as usual.CLOVIS
03/11/2024, 7:34 PM./gradlew check --include-build=../path-to-the-plugin
)CLOVIS
03/11/2024, 7:35 PMCLOVIS
03/11/2024, 7:42 PMkotlinExtension
❌
• extensions.findByName("kotlin")
✔️
• extensions.findByType(KotlinProjectExtension::class.java)
❌
• extensions.findByName("kotlin") as KotlinProjectExtension
❌
Is it just whenever I mention any symbol from the Kotlin plugin? If so, that's inconvenient 😅CLOVIS
03/11/2024, 7:44 PMcompileOnly
dependency on the Kotlin plugin, and the tests are in another dependent module, so it shouldn't be that the plugin is changing the Kotlin version?CLOVIS
03/11/2024, 7:50 PMbuild/tmp/tests/work/.gradle-test-kit/caches/module-2/
, so it is injected by Gradle.CLOVIS
03/11/2024, 7:53 PMAdam S
03/11/2024, 8:04 PM.named {}
filter https://github.com/gradle/gradle/issues/28347
Is there a change if you try kotlinExtension.sourceSets.matching { it.name == "jsMain" }.configureEach {}
?CLOVIS
03/11/2024, 8:05 PMkotlinExtension
at all causes the problem, even if I access none of its methods, so I don't believe named
/`matching` is the cause for this.Adam S
03/11/2024, 8:08 PMJavier
03/11/2024, 8:36 PMCLOVIS
03/11/2024, 8:37 PMJavier
03/11/2024, 8:37 PMCLOVIS
03/11/2024, 8:38 PMJavier
03/11/2024, 8:39 PMJavier
03/11/2024, 8:39 PMJavier
03/11/2024, 8:44 PMJavier
03/11/2024, 8:44 PMCLOVIS
03/11/2024, 8:44 PMapi
dependency on the Kotlin plugin and didn't need to do this.
I believe it's a somewhat recent thing? Not sure.Javier
03/11/2024, 8:45 PMJavier
03/11/2024, 8:46 PMCLOVIS
03/11/2024, 8:48 PMVampire
03/11/2024, 9:25 PMthere's some sort of minor bug with the newI wouldn't call that "minor", it voids the whole rectification for existence as the exact cause why it was invented does not work but it is just behaving exactly likefilter.named {}
matching
. I'd more say this is a major bug at least. 😄