• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 @file:Suppress("UnstableApiUsage")
6 
7 import me.champeau.gradle.*
8 import org.jetbrains.kotlin.gradle.tasks.*
9 
<lambda>null10 plugins {
11     id("com.github.johnrengelman.shadow")
12     id("me.champeau.gradle.jmh") apply false
13 }
14 
<lambda>null15 repositories {
16     maven("https://repo.typesafe.com/typesafe/releases/")
17 }
18 
<lambda>null19 java {
20     sourceCompatibility = JavaVersion.VERSION_1_8
21     targetCompatibility = JavaVersion.VERSION_1_8
22 }
23 
24 apply(plugin="me.champeau.gradle.jmh")
25 
<lambda>null26 tasks.named<KotlinCompile>("compileJmhKotlin") {
27     kotlinOptions {
28         jvmTarget = "1.8"
29         freeCompilerArgs += "-Xjvm-default=enable"
30     }
31 }
32 
33 // It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
34 // ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
<lambda>null35 extensions.configure<JMHPluginExtension>("jmh") {
36     jmhVersion = "1.26"
37     duplicateClassesStrategy = DuplicatesStrategy.INCLUDE
38     failOnError = true
39     resultFormat = "CSV"
40     project.findProperty("jmh")?.also {
41         include = listOf(".*$it.*")
42     }
43 //    includeTests = false
44 }
45 
<lambda>null46 val jmhJarTask = tasks.named<Jar>("jmhJar") {
47     archiveBaseName by "benchmarks"
48     archiveClassifier by null
49     archiveVersion by null
50     destinationDirectory.file("$rootDir")
51 }
52 
<lambda>null53 tasks {
54     // For some reason the DuplicatesStrategy from jmh is not enough
55     // and errors with duplicates appear unless I force it to WARN only:
56     withType<Copy> {
57         duplicatesStrategy = DuplicatesStrategy.WARN
58     }
59 
60     build {
61         dependsOn(jmhJarTask)
62     }
63 }
64 
<lambda>null65 dependencies {
66     implementation("org.openjdk.jmh:jmh-core:1.26")
67     implementation("io.projectreactor:reactor-core:${version("reactor")}")
68     implementation("io.reactivex.rxjava2:rxjava:2.1.9")
69     implementation("com.github.akarnokd:rxjava2-extensions:0.20.8")
70 
71     implementation("com.typesafe.akka:akka-actor_2.12:2.5.0")
72     implementation(project(":kotlinx-coroutines-core"))
73     implementation(project(":kotlinx-coroutines-reactive"))
74 
75     // add jmh dependency on main
76     "jmhImplementation"(sourceSets.main.get().runtimeClasspath)
77 }
78