Skip to content

Jvm bench in multiplatform with separate SourceSet. No benchmarks to run; check the include/exclude regexps. #71

@elect86

Description

@elect86

I'm trying to benchmark jvm on a multiplatform project with separate sourceSet

To reproduce just clone this branch

This is my setup so far:

kotlin {
    ...
    sourceSets {
        val jvmBench by creating {
            dependsOn(commonMain)
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.0")
                //                "benchCompile"(sourceSets.main.output + sourceSets.main.runtimeClasspath)
            }
        }
        ...
    }
    targets {
        jvm {
            compilations.create("bench")
        }
    }
}

benchmark {
    ...
    targets {
        register("jvm")
        //        register("js")
        //        register("native")
    }
}

val SourceSetContainer.main: SourceSet
    get() = named("main").get()
dependencies {
    kspMetadata(projects.processor)
    "jvmBenchImplementation"(sourceSets.main.output + sourceSets.main.runtimeClasspath)
    ...
}

When I try to execute jvmBenchmark I get:

Type-safe project accessors is an incubating feature.
Configure project :
Kotlin Multiplatform Projects are an Alpha feature. See: https://kotlinlang.org/docs/reference/evolution/components-stability.html. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.
Task :processor:compileKotlinJvm UP-TO-DATE
Task :processor:jvmProcessResources UP-TO-DATE
Task :processor:jvmMainClasses UP-TO-DATE
Task :processor:jvmJar UP-TO-DATE
Task :kspKotlinMetadata UP-TO-DATE
Task :compileKotlinJvm UP-TO-DATE
Task :compileJava NO-SOURCE
Task :jvmProcessResources NO-SOURCE
Task :jvmMainClasses UP-TO-DATE
Task :jvmBenchmarkGenerate UP-TO-DATE
Task :jvmBenchmarkCompile NO-SOURCE
Task :jvmBenchmark FAILED
Running 'main' benchmarks for 'jvm'
Error: Could not find or load main class kotlinx.benchmark.jvm.JvmBenchmarkRunnerKt
Caused by: java.lang.ClassNotFoundException: kotlinx.benchmark.jvm.JvmBenchmarkRunnerKt
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':jvmBenchmark'.
    Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
  • Try:
    Run with --stacktrace option to get the stack trace.
    Run with --info or --debug option to get more log output.
    Run with --scan to get full insights.
  • Get more help at https://help.gradle.org
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
    You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
    See https://docs.gradle.org/7.3/userguide/command_line_interface.html#sec:command_line_warnings
    BUILD FAILED in 151ms
    7 actionable tasks: 1 executed, 6 up-to-date

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions