• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 import org.gradle.api.JavaVersion
2 import org.gradle.api.file.DuplicatesStrategy
3 import org.gradle.api.tasks.bundling.Jar
4 import org.gradle.api.tasks.testing.Test
5 
<lambda>null6 plugins {
7     id("org.jetbrains.kotlinx.kover") // apply plugin to use autocomplete for Kover DSL
8 }
9 
10 val junit_version by properties
11 val junit5_version by properties
12 val byte_buddy_version by properties
13 val blockhound_version by properties
14 val jna_version by properties
15 
<lambda>null16 dependencies {
17     compileOnly("junit:junit:$junit_version")
18     compileOnly("org.junit.jupiter:junit-jupiter-api:$junit5_version")
19     testImplementation("org.junit.jupiter:junit-jupiter-engine:$junit5_version")
20     testImplementation("org.junit.platform:junit-platform-testkit:1.7.0")
21     implementation("net.bytebuddy:byte-buddy:$byte_buddy_version")
22     implementation("net.bytebuddy:byte-buddy-agent:$byte_buddy_version")
23     compileOnly("io.projectreactor.tools:blockhound:$blockhound_version")
24     testImplementation("io.projectreactor.tools:blockhound:$blockhound_version")
25     testImplementation("com.google.code.gson:gson:2.8.6")
26     api("net.java.dev.jna:jna:$jna_version")
27     api("net.java.dev.jna:jna-platform:$jna_version")
28 }
29 
<lambda>null30 java {
31     /* This is needed to be able to run JUnit5 tests. Otherwise, Gradle complains that it can't find the
32     JVM1.6-compatible version of the `junit-jupiter-api` artifact. */
33     disableAutoTargetJvm()
34 }
35 
36 // This is required for BlockHound tests to work, see https://github.com/Kotlin/kotlinx.coroutines/issues/3701
<lambda>null37 tasks.withType<Test>().configureEach {
38     if (JavaVersion.toVersion(jdkToolchainVersion).isCompatibleWith(JavaVersion.VERSION_13)) {
39         jvmArgs("-XX:+AllowRedefinitionToAddDeleteMethods")
40     }
41 }
42 
<lambda>null43 tasks.named<Jar>("jar") {
44     manifest {
45         attributes(
46             mapOf(
47                 "Premain-Class" to "kotlinx.coroutines.debug.internal.AgentPremain",
48                 "Can-Redefine-Classes" to "true",
49                 "Multi-Release" to "true"
50             )
51         )
52     }
53 
54     // add module-info.class to the META-INF/versions/9/ directory.
55     dependsOn(tasks.compileModuleInfoJava)
56     from(tasks.compileModuleInfoJava.get().outputs.files.asFileTree.matching {
57         include("module-info.class")
58     }) {
59         this.duplicatesStrategy = DuplicatesStrategy.INCLUDE
60         into("META-INF/versions/9")
61     }
62 }
63 
64 
<lambda>null65 kover {
66     reports {
67         filters {
68             excludes {
69                 // Never used, safety mechanism
70                 classes("kotlinx.coroutines.debug.NoOpProbesKt")
71             }
72         }
73     }
74 }
75