@@ -4,6 +4,7 @@ import groovy.lang.*
4
4
import org.gradle.api.*
5
5
import org.gradle.api.plugins.*
6
6
import org.jetbrains.kotlin.gradle.dsl.*
7
+ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
7
8
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
8
9
import org.jetbrains.kotlin.gradle.plugin.mpp.*
9
10
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation
@@ -49,9 +50,8 @@ open class BenchmarksExtension(val project: Project) {
49
50
50
51
when {
51
52
multiplatform != null -> {
52
- val compilations = multiplatform.targets.flatMap { it.compilations }
53
- val compilation = compilations.singleOrNull { it.apiConfigurationName.removeSuffix(" Api" ) == name }
54
- when (compilation) {
53
+ val target = multiplatform.targets.findByName(name)
54
+ when (val compilation = target?.compilations?.findByName(KotlinCompilation .MAIN_COMPILATION_NAME )) {
55
55
null -> {
56
56
project.logger.warn(" Warning: Cannot find a benchmark compilation '$name ', ignoring." )
57
57
BenchmarkTarget (this , name) // ignore
@@ -78,8 +78,7 @@ open class BenchmarksExtension(val project: Project) {
78
78
79
79
}
80
80
javaExtension != null -> {
81
- val sourceSet = javaExtension.sourceSets.findByName(name)
82
- when (sourceSet) {
81
+ when (val sourceSet = javaExtension.sourceSets.findByName(name)) {
83
82
null -> {
84
83
project.logger.warn(" Warning: Cannot find a benchmark sourceSet '$name ', ignoring." )
85
84
BenchmarkTarget (this , name) // ignore
0 commit comments