blob: f64c4aaa21cb1b6ece794348b8f51cb3a77689a5 [file] [log] [blame]
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +03001/*
Aurimas Liutikas79e555e2021-05-17 17:41:41 +00002 * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +03003 */
4
Victor Turansky964cd922020-05-02 19:52:56 +03005@file:Suppress("UnstableApiUsage")
6
Victor Turansky4511c232020-05-15 12:00:36 +03007import me.champeau.gradle.*
8import org.jetbrains.kotlin.gradle.tasks.*
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +03009
10plugins {
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030011 id("com.github.johnrengelman.shadow")
Victor Turansky4511c232020-05-15 12:00:36 +030012 id("me.champeau.gradle.jmh") apply false
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030013}
14
15repositories {
16 maven("https://repo.typesafe.com/typesafe/releases/")
17}
18
Victor Turansky4511c232020-05-15 12:00:36 +030019java {
20 sourceCompatibility = JavaVersion.VERSION_1_8
21 targetCompatibility = JavaVersion.VERSION_1_8
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030022}
23
Victor Turansky4511c232020-05-15 12:00:36 +030024apply(plugin="me.champeau.gradle.jmh")
25
26tasks.named<KotlinCompile>("compileJmhKotlin") {
27 kotlinOptions {
28 jvmTarget = "1.8"
29 freeCompilerArgs += "-Xjvm-default=enable"
30 }
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030031}
32
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030033// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
34// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
Victor Turansky4511c232020-05-15 12:00:36 +030035extensions.configure<JMHPluginExtension>("jmh") {
Vsevolod Tolstopyatov95875902020-10-20 02:40:38 -070036 jmhVersion = "1.26"
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030037 duplicateClassesStrategy = DuplicatesStrategy.INCLUDE
38 failOnError = true
39 resultFormat = "CSV"
40 project.findProperty("jmh")?.also {
41 include = listOf(".*$it.*")
42 }
43// includeTests = false
44}
45
Steve Elliottca095be2022-07-25 14:26:10 +000046val jmhJarTask = tasks.named<Jar>("jmhJar") {
Victor Turansky964cd922020-05-02 19:52:56 +030047 archiveBaseName by "benchmarks"
48 archiveClassifier by null
49 archiveVersion by null
50 destinationDirectory.file("$rootDir")
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030051}
52
Steve Elliottca095be2022-07-25 14:26:10 +000053tasks {
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 }
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030059
Steve Elliottca095be2022-07-25 14:26:10 +000060 build {
61 dependsOn(jmhJarTask)
62 }
63}
64
65dependencies {
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"))
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030074
75 // add jmh dependency on main
Victor Turansky4511c232020-05-15 12:00:36 +030076 "jmhImplementation"(sourceSets.main.get().runtimeClasspath)
Vsevolod Tolstopyatov0f158122020-04-29 23:35:41 +030077}