solonovamax
02/04/2025, 4:02 AMw: Kotlin Source Set 'commonBenchmarks' can't depend on 'commonMain' as they are from different Source Set Trees.
Please remove this dependency edge.
my gradle buildscript looks roughly like this (this is not the exact buildscript, just a rough recreation with only the relevant bits)
plugins {
kotlin("multiplatform") version "2.1.10"
kotlin("plugin.allopen")
id("org.jetbrains.kotlinx.benchmark")
}
allOpen {
annotation("org.openjdk.jmh.annotations.State") // Make jmh happy
}
kotlin {
jvm {
val benchmarks by compilations.creating {
associateWith(this@jvm.compilations["main"])
}
}
sourceSets {
val commonBenchmarks by creating {
dependsOn(commonMain.get())
dependencies {
implementation(libs.kotlinx.benchmark.runtime)
}
}
val jvmBenchmarks by getting {
dependsOn(commonBenchmarks)
}
}
}
benchmark {
configurations {
named("main") {
reportFormat = "json"
warmups = 5
iterations = 5
iterationTime = 5
iterationTimeUnit = "s"
}
}
targets {
register("jvmBenchmarks") {
this as JvmBenchmarkTarget
jmhVersion = "1.37"
}
}
}
does anyone know how to solve this issue?tapchicoma
02/04/2025, 9:28 AMkotlin {
applyDefaultHierarchyTemplate {
common {
group("commonJvm") {
withJvm()
withAndroid()
}
}
}
}
solonovamax
02/04/2025, 6:09 PMjvmMain
source set (or any other such leaf source set, asside from the other new source set I introduced, jvmBenchmarks
) does not depend on the commonBenchmarks
source set.ephemient
02/07/2025, 9:21 AMkotlin {
applyDefaultHierarchyTemplate {
withSourceSetTree(KotlinSourceSetTree("benchmarks"))
}
}
instead of dependsOn
solonovamax
02/07/2025, 8:26 PM