-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathbuild.gradle.kts
50 lines (42 loc) · 1.17 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import kotlinx.benchmark.gradle.JvmBenchmarkTarget
plugins {
kotlin("jvm")
id("org.jetbrains.kotlin.plugin.allopen") version "2.0.20"
id("org.jetbrains.kotlinx.benchmark")
}
// how to apply plugin to a specific source set?
allOpen {
annotation("org.openjdk.jmh.annotations.State")
}
sourceSets {
create("benchmarks")
}
sourceSets.configureEach {
kotlin.setSrcDirs(listOf(file("$name/src")))
java.setSrcDirs(listOf(file("$name/src")))
resources.setSrcDirs(listOf(file("$name/resources")))
}
kotlin {
/*
Associate the benchmarks with the main compilation.
This will:
1. Allow 'benchmarks' to see all internals of 'main'
2. Forward all dependencies from 'main' to be also visible in 'benchmarks'
*/
target.compilations.getByName("benchmarks")
.associateWith(target.compilations.getByName("main"))
}
// Add dependency to the benchmark runtime
dependencies {
"benchmarksImplementation"(project(":kotlinx-benchmark-runtime"))
}
// Configure benchmark
benchmark {
targets {
register("benchmarks") {
if (this is JvmBenchmarkTarget) {
jmhVersion = "1.21"
}
}
}
}