David Herman
07/27/2023, 12:22 AMDavid Herman
07/27/2023, 12:25 AMproject.buildTargets.withType<KotlinJsIrTarget>.configureEach {
val jsTarget = JsTarget(this)
...
}
The "this" going into the callback should be KotlinJsIrTarget
but with Kotlin 1.9.0 I'm getting this error:
e: file:///home/d9n/Code/scratch/kobweb/gradle-plugins/core/src/main/kotlin/com/varabyte/kobweb/gradle/core/KobwebCorePlugin.kt:54:37 Type mismatch: inferred type is KobwebCorePlugin but KotlinJsIrTarget was expected
so it thinks "this" is coming from the parent scope.David Herman
07/27/2023, 12:25 AMvoid configureEach(Action<? super T> action);
@HasImplicitReceiver
public interface Action<T> {
/**
* Performs this action against the given object.
*
* @param t The object to perform the action on.
*/
void execute(T t);
}
David Herman
07/27/2023, 12:27 AMHasImplicitReceiver
is doing something funky that is confusing the Kotlin 1.9.0 compiler? Because I'm having trouble imagining how to create such a functional interface manually.
fun interface Action<T> {
fun T.execute()
}
maybe?David Herman
07/27/2023, 12:29 AMgit clone <https://github.com/varabyte/kobweb> && cd kobweb
• Edit gradle/libs.versions.toml
â—¦ compose = 1.4.1
--> compose = 1.4.3
â—¦ kotlin = 1.8.20
--> kotlin = 1.9.0
• ./gradlew :gradle-plugins:core:build
David Herman
07/27/2023, 12:30 AMChris Lee
07/27/2023, 12:35 AMkotlin("jvm")
which configures Kotlin for your application code.Chris Lee
07/27/2023, 12:36 AMChris Lee
07/27/2023, 12:39 AMChris Lee
07/27/2023, 12:41 AMkotlin-dsl
and `kotlin("jvm")`:
plugins {
// this brings in embedded kotlin + java-gradle-plugin and a few other settings
`kotlin-dsl`
// never mix this with `kotlin-dsl` - either a module is building Gradle code (`kotlin-dsl`) or application code (kotlin("jvm)"))
alias(libs.plugins.kotlin.jvm)
id("com.varabyte.kobweb.internal.publish")
// both of these are redundant, included via `kotlin-dsl`
`java-library`
`java-gradle-plugin`
alias(libs.plugins.kotlinx.serialization)
}
Chris Lee
07/27/2023, 12:43 AMChris Lee
07/27/2023, 12:46 AMDavid Herman
07/27/2023, 12:48 AM