Vsevolod Tolstopyatov | c7239ac | 2018-12-10 11:41:00 +0300 | [diff] [blame] | 1 | /* |
Vsevolod Tolstopyatov | 6d1a6e3 | 2020-02-18 15:28:00 +0300 | [diff] [blame] | 2 | * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Vsevolod Tolstopyatov | c7239ac | 2018-12-10 11:41:00 +0300 | [diff] [blame] | 3 | */ |
| 4 | |
Vsevolod Tolstopyatov | 3781a82 | 2018-12-13 11:58:29 +0300 | [diff] [blame] | 5 | apply plugin: "com.github.johnrengelman.shadow" |
| 6 | |
Roman Elizarov | d2f4b2b | 2019-09-02 17:22:39 +0300 | [diff] [blame] | 7 | configurations { |
| 8 | shadowDeps // shaded dependencies, not included into the resulting .pom file |
| 9 | compileOnly.extendsFrom(shadowDeps) |
| 10 | runtimeOnly.extendsFrom(shadowDeps) |
| 11 | |
| 12 | /* |
| 13 | * It is possible to extend a particular configuration with shadow, |
| 14 | * but in that case it changes dependency type to "runtime" and resolves it |
| 15 | * (so it cannot be further modified). Otherwise, shadow just ignores all dependencies. |
| 16 | */ |
dkhalanskyjb | 02b403d | 2020-04-06 16:33:22 +0300 | [diff] [blame] | 17 | shadow.extendsFrom(api) // shadow - resulting configuration with shaded jar file |
Roman Elizarov | d2f4b2b | 2019-09-02 17:22:39 +0300 | [diff] [blame] | 18 | configureKotlinJvmPlatform(shadow) |
| 19 | } |
| 20 | |
Vsevolod Tolstopyatov | c7239ac | 2018-12-10 11:41:00 +0300 | [diff] [blame] | 21 | dependencies { |
Vsevolod Tolstopyatov | 2bdd460 | 2019-02-20 17:00:57 +0300 | [diff] [blame] | 22 | compileOnly "junit:junit:$junit_version" |
Roman Elizarov | d2f4b2b | 2019-09-02 17:22:39 +0300 | [diff] [blame] | 23 | shadowDeps "net.bytebuddy:byte-buddy:$byte_buddy_version" |
| 24 | shadowDeps "net.bytebuddy:byte-buddy-agent:$byte_buddy_version" |
dkhalanskyjb | 02b403d | 2020-04-06 16:33:22 +0300 | [diff] [blame] | 25 | compileOnly "io.projectreactor.tools:blockhound:$blockhound_version" |
| 26 | testCompile "io.projectreactor.tools:blockhound:$blockhound_version" |
| 27 | api "net.java.dev.jna:jna:$jna_version" |
| 28 | api "net.java.dev.jna:jna-platform:$jna_version" |
Vsevolod Tolstopyatov | c7239ac | 2018-12-10 11:41:00 +0300 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | jar { |
| 32 | manifest { |
| 33 | attributes "Premain-Class": "kotlinx.coroutines.debug.AgentPremain" |
| 34 | attributes "Can-Redefine-Classes": "true" |
Vsevolod Tolstopyatov | c7239ac | 2018-12-10 11:41:00 +0300 | [diff] [blame] | 35 | } |
| 36 | } |
Vsevolod Tolstopyatov | 3781a82 | 2018-12-13 11:58:29 +0300 | [diff] [blame] | 37 | |
| 38 | shadowJar { |
| 39 | classifier null |
| 40 | // Shadow only byte buddy, do not package kotlin stdlib |
Roman Elizarov | d2f4b2b | 2019-09-02 17:22:39 +0300 | [diff] [blame] | 41 | configurations = [project.configurations.shadowDeps] |
dkhalanskyjb | 02b403d | 2020-04-06 16:33:22 +0300 | [diff] [blame] | 42 | relocate('net.bytebuddy', 'kotlinx.coroutines.repackaged.net.bytebuddy') |
Vsevolod Tolstopyatov | 3781a82 | 2018-12-13 11:58:29 +0300 | [diff] [blame] | 43 | } |