-
Notifications
You must be signed in to change notification settings - Fork 42
Simplify creations of separate benchmark source sets in multiplatform projects #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is how "manual" configuration looks like now: kotlin {
sourceSets {
val benchmarkMain by creating {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.13")
}
}
}
val bmm = sourceSets.getByName("benchmarkMain")
targets.matching { it.name != "metadata" }.all {
compilations.create("benchmark") {
associateWith(this@all.compilations.getByName("main"))
defaultSourceSet {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.13")
}
dependsOn(bmm)
}
}
}
targets.matching { it.name != "metadata" }.all {
benchmark.targets.register("${name}Benchmark")
}
} Yes, it could be cleaned up and simplified. Yet, it's hard to come up with something like that unless you spend enough time writing and debugging build scripts. |
A good default for the plugin could be creating source sets based on active platforms.
|
I understand the idea of the word "benchmark" appearing in the second spot of this magical tuple. But what's the role of |
Yep, |
It's what you mentioned in the last comment. Do you know how could we "polyfill" exactly this setup? |
I found an official example for shared cross-platform benchmark code, but it's in |
@cubuspl42, I guess something like #291 (comment) but with different source set names. |
Documentation describes a way to place benchmarks in separate source sets. It kinda works when you need a single source set associated with a particular target. However, creating a separate common benchmark source set where benchmarks could be executed for each and every target is quite difficult.
It would be nice to provide an extension function for
Project
, that'll do that itself, instead of delegating this tedious work to users.The text was updated successfully, but these errors were encountered: