kotlinx-benchmark icon indicating copy to clipboard operation
kotlinx-benchmark copied to clipboard

NoSuchMethodError in project that uses Kotlinx Benchmark and KGP 2.0

Open adam-enko opened this issue 7 months ago • 0 comments

kotlinx-benchmark uses a utility to create a new D8Exec task.

https://github.com/Kotlin/kotlinx-benchmark/blob/1aefc62c585362e2dca2f7b695519e4d7c5052cf/plugin/main/src/kotlinx/benchmark/gradle/JsEngineExecTasks.kt#L108-L113

However, the signature of this method changed in KGP 2.0

https://github.com/JetBrains/kotlin/blob/9589486e67c5867b41ed6c58c9614aff39633fe3/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/d8/D8Exec.kt#L54

compilation: KotlinJsCompilation changed to compilation: KotlinJsIrCompilation

This causes a failure during Gradle project configuration.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'junit2932190119581877902'.
> Failed to notify project evaluation listener.
   > 'org.gradle.api.tasks.TaskProvider org.jetbrains.kotlin.gradle.targets.js.d8.D8Exec$Companion.create(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation, java.lang.String, kotlin.jvm.functions.Function1)'

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'junit2932190119581877902'
[...]
Caused by: java.lang.NoSuchMethodError: 'org.gradle.api.tasks.TaskProvider org.jetbrains.kotlin.gradle.targets.js.d8.D8Exec$Companion.create(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation, java.lang.String, kotlin.jvm.functions.Function1)'
	at kotlinx.benchmark.gradle.JsEngineExecTasksKt.createD8Exec(JsEngineExecTasks.kt:113)

adam-enko avatar Jul 04 '24 15:07 adam-enko