• 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
5apply plugin: "com.github.johnrengelman.shadow"
6
7// apply plugin to use autocomplete for Kover DSL
8apply plugin: 'org.jetbrains.kotlinx.kover'
9
10configurations {
11    shadowDeps // shaded dependencies, not included into the resulting .pom file
12    compileOnly.extendsFrom(shadowDeps)
13    runtimeOnly.extendsFrom(shadowDeps)
14}
15
16dependencies {
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    shadowDeps "net.bytebuddy:byte-buddy:$byte_buddy_version"
22    shadowDeps "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
30java {
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
37tasks.withType(Test).configureEach {
38    if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_13)) {
39        jvmArgs += ["-XX:+AllowRedefinitionToAddDeleteMethods"]
40    }
41}
42
43jar {
44    setEnabled(false)
45}
46
47def shadowJarTask = shadowJar {
48    classifier null
49    // Shadow only byte buddy, do not package kotlin stdlib
50    configurations = [project.configurations.shadowDeps]
51    relocate('net.bytebuddy', 'kotlinx.coroutines.repackaged.net.bytebuddy')
52
53    manifest {
54        attributes "Premain-Class": "kotlinx.coroutines.debug.AgentPremain"
55        attributes "Can-Redefine-Classes": "true"
56    }
57}
58
59configurations {
60    artifacts {
61        add("apiElements", shadowJarTask)
62        add("runtimeElements", shadowJarTask)
63    }
64}
65
66koverReport {
67    filters {
68        excludes {
69            // Never used, safety mechanism
70            classes("kotlinx.coroutines.debug.internal.NoOpProbesKt")
71        }
72    }
73}
74