File tree Expand file tree Collapse file tree 2 files changed +50
-53
lines changed Expand file tree Collapse file tree 2 files changed +50
-53
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import kotlinx.benchmark.gradle.JvmBenchmarkTarget
2
+
3
+ plugins {
4
+ kotlin(" jvm" )
5
+ id(" org.jetbrains.kotlin.plugin.allopen" ) version " 1.9.21"
6
+ id(" org.jetbrains.kotlinx.benchmark" )
7
+ }
8
+
9
+ // how to apply plugin to a specific source set?
10
+ allOpen {
11
+ annotation(" org.openjdk.jmh.annotations.State" )
12
+ }
13
+
14
+ sourceSets {
15
+ create(" benchmarks" )
16
+ }
17
+
18
+ sourceSets.configureEach {
19
+ kotlin.setSrcDirs(listOf (file(" $name /src" )))
20
+ java.setSrcDirs(listOf (file(" $name /src" )))
21
+ resources.setSrcDirs(listOf (file(" $name /resources" )))
22
+ }
23
+
24
+ kotlin {
25
+ /*
26
+ Associate the benchmarks with the main compilation.
27
+ This will:
28
+ 1. Allow 'benchmarks' to see all internals of 'main'
29
+ 2. Forward all dependencies from 'main' to be also visible in 'benchmarks'
30
+ */
31
+ target.compilations.getByName(" benchmarks" )
32
+ .associateWith(target.compilations.getByName(" main" ))
33
+ }
34
+
35
+ // Add dependency to the benchmark runtime
36
+ dependencies {
37
+ " benchmarksImplementation" (project(" :kotlinx-benchmark-runtime" ))
38
+ }
39
+
40
+
41
+ // Configure benchmark
42
+ benchmark {
43
+ targets {
44
+ register(" benchmarks" ) {
45
+ if (this is JvmBenchmarkTarget ) {
46
+ jmhVersion = " 1.21"
47
+ }
48
+ }
49
+ }
50
+ }
You can’t perform that action at this time.
0 commit comments