2
2
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
3
*/
4
4
5
- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
5
+ import me.champeau.gradle.*
6
+ import org.jetbrains.kotlin.gradle.tasks.*
6
7
7
8
plugins {
8
9
id(" net.ltgt.apt" )
9
10
id(" com.github.johnrengelman.shadow" )
10
- id(" me.champeau.gradle.jmh" )
11
+ id(" me.champeau.gradle.jmh" ) apply false
11
12
}
12
13
13
14
repositories {
14
15
maven(" https://repo.typesafe.com/typesafe/releases/" )
15
16
}
16
17
17
- tasks.withType<KotlinCompile >().configureEach {
18
- kotlinOptions.jvmTarget = " 1.8"
18
+ java {
19
+ sourceCompatibility = JavaVersion .VERSION_1_8
20
+ targetCompatibility = JavaVersion .VERSION_1_8
19
21
}
20
22
21
- tasks.compileJmhKotlin {
22
- kotlinOptions.freeCompilerArgs + = " -Xjvm-default=enable"
23
+ apply (plugin= " me.champeau.gradle.jmh" )
24
+
25
+ tasks.named<KotlinCompile >(" compileJmhKotlin" ) {
26
+ kotlinOptions {
27
+ jvmTarget = " 1.8"
28
+ freeCompilerArgs + = " -Xjvm-default=enable"
29
+ }
23
30
}
24
31
25
32
/*
@@ -39,20 +46,20 @@ val removeRedundantFiles = tasks.register<Delete>("removeRedundantFiles") {
39
46
delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$ play\$ histoOfLetters\$ 1\$\$ special\$\$ inlined\$ fold\$ 1\$ 1.class" )
40
47
delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$ play\$ buildHistoOnScore\$ 1\$\$ special\$\$ inlined\$ filter\$ 1\$ 1.class" )
41
48
delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$ play\$ histoOfLetters\$ 1\$\$ special\$\$ inlined\$ fold\$ 1\$ 1.class" )
42
- delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/scrabble// SaneFlowPlaysScrabble\$ play\$ buildHistoOnScore\$ 1\$\$ special\$\$ inlined\$ filter\$ 1\$ 1.class" )
49
+ delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/scrabble/SaneFlowPlaysScrabble\$ play\$ buildHistoOnScore\$ 1\$\$ special\$\$ inlined\$ filter\$ 1\$ 1.class" )
43
50
44
51
// Primes
45
52
delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$ special\$\$ inlined\$ filter\$ 1\$ 2\$ 1.class" )
46
53
delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$ special\$\$ inlined\$ filter\$ 1\$ 1.class" )
47
54
}
48
55
49
- tasks.jmhRunBytecodeGenerator {
56
+ tasks.named( " jmhRunBytecodeGenerator" ) {
50
57
dependsOn(removeRedundantFiles)
51
58
}
52
59
53
60
// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
54
61
// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
55
- jmh {
62
+ extensions.configure< JMHPluginExtension >( " jmh" ) {
56
63
jmhVersion = " 1.21"
57
64
duplicateClassesStrategy = DuplicatesStrategy .INCLUDE
58
65
failOnError = true
63
70
// includeTests = false
64
71
}
65
72
66
- tasks.jmhJar {
73
+ tasks.named< Jar >( " jmhJar" ) {
67
74
baseName = " benchmarks"
68
75
classifier = null
69
76
version = null
@@ -76,10 +83,9 @@ dependencies {
76
83
compile(" io.reactivex.rxjava2:rxjava:2.1.9" )
77
84
compile(" com.github.akarnokd:rxjava2-extensions:0.20.8" )
78
85
79
- compile(" org.openjdk.jmh:jmh-core:1.21" )
80
86
compile(" com.typesafe.akka:akka-actor_2.12:2.5.0" )
81
87
compile(project(" :kotlinx-coroutines-core" ))
82
88
83
89
// add jmh dependency on main
84
- jmhImplementation(sourceSets.main.get().runtimeClasspath)
90
+ " jmhImplementation" (sourceSets.main.get().runtimeClasspath)
85
91
}
0 commit comments