22 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33 */
44
5- import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
5+ import me.champeau.gradle.*
6+ import org.jetbrains.kotlin.gradle.tasks.*
67
78plugins {
89 id(" net.ltgt.apt" )
910 id(" com.github.johnrengelman.shadow" )
10- id(" me.champeau.gradle.jmh" )
11+ id(" me.champeau.gradle.jmh" ) apply false
1112}
1213
1314repositories {
1415 maven(" https://repo.typesafe.com/typesafe/releases/" )
1516}
1617
17- tasks.withType<KotlinCompile >().configureEach {
18- kotlinOptions.jvmTarget = " 1.8"
18+ java {
19+ sourceCompatibility = JavaVersion .VERSION_1_8
20+ targetCompatibility = JavaVersion .VERSION_1_8
1921}
2022
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+ }
2330}
2431
2532/*
@@ -39,20 +46,20 @@ val removeRedundantFiles = tasks.register<Delete>("removeRedundantFiles") {
3946 delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$ play\$ histoOfLetters\$ 1\$\$ special\$\$ inlined\$ fold\$ 1\$ 1.class" )
4047 delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$ play\$ buildHistoOnScore\$ 1\$\$ special\$\$ inlined\$ filter\$ 1\$ 1.class" )
4148 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" )
4350
4451 // Primes
4552 delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$ special\$\$ inlined\$ filter\$ 1\$ 2\$ 1.class" )
4653 delete(" $buildDir /classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$ special\$\$ inlined\$ filter\$ 1\$ 1.class" )
4754}
4855
49- tasks.jmhRunBytecodeGenerator {
56+ tasks.named( " jmhRunBytecodeGenerator" ) {
5057 dependsOn(removeRedundantFiles)
5158}
5259
5360// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
5461// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
55- jmh {
62+ extensions.configure< JMHPluginExtension >( " jmh" ) {
5663 jmhVersion = " 1.21"
5764 duplicateClassesStrategy = DuplicatesStrategy .INCLUDE
5865 failOnError = true
6370// includeTests = false
6471}
6572
66- tasks.jmhJar {
73+ tasks.named< Jar >( " jmhJar" ) {
6774 baseName = " benchmarks"
6875 classifier = null
6976 version = null
@@ -76,10 +83,9 @@ dependencies {
7683 compile(" io.reactivex.rxjava2:rxjava:2.1.9" )
7784 compile(" com.github.akarnokd:rxjava2-extensions:0.20.8" )
7885
79- compile(" org.openjdk.jmh:jmh-core:1.21" )
8086 compile(" com.typesafe.akka:akka-actor_2.12:2.5.0" )
8187 compile(project(" :kotlinx-coroutines-core" ))
8288
8389 // add jmh dependency on main
84- jmhImplementation(sourceSets.main.get().runtimeClasspath)
90+ " jmhImplementation" (sourceSets.main.get().runtimeClasspath)
8591}
0 commit comments