Skip to content

Separating source sets for benchmarks in multiplatform projects #70

@goncalossilva

Description

@goncalossilva

I've tried adding:

val commonBenchmark by creating {
    dependsOn(commonMain) // or commonTest

    dependencies {
        implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.3.1")
        implementation("com.goncalossilva:resources:0.2.1")
    }
}

And then configuring targets as documented:

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

But this is clearly not the right way, since nothing happens when running (“Test events were not received”) and there is this warning:

The Kotlin source set commonBenchmark was configured but not added to any Kotlin compilation. You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
BUILD SUCCESSFUL in 5s
1 actionable task: 1 executed
> Task :assembleBenchmarks UP-TO-DATE
> Task :kotlinNpmCachesSetup
> Task :jsPackageJson
> Task :kotlinNodeJsSetup UP-TO-DATE
> Task :kotlinYarnSetup UP-TO-DATE
> Task :jsBenchmarkPackageJson UP-TO-DATE
> Task :rootPackageJson
> Task :kotlinNpmInstall
> Task :jsGenerateExternalsIntegrated SKIPPED
> Task :compileKotlinJs UP-TO-DATE
> Task :jsProcessResources NO-SOURCE
> Task :jsMainClasses UP-TO-DATE
> Task :jsBenchmarkGenerate UP-TO-DATE
> Task :compileBenchmarkKotlinJs NO-SOURCE
> Task :jsBenchmark SKIPPED
> Task :benchmark UP-TO-DATE
BUILD SUCCESSFUL in 723ms
9 actionable tasks: 4 executed, 5 up-to-date
23:44:03: Execution finished 'benchmark'

Could this be documented?

Metadata

Metadata

Assignees

No one assigned

    Labels

    document this behaviorThe unexpected behavior described in this issue should be documented in the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions