Vsevolod Tolstopyatov | c7239ac | 2018-12-10 11:41:00 +0300 | [diff] [blame] | 1 | /* |
Roman Elizarov | d2f4b2b | 2019-09-02 17:22:39 +0300 | [diff] [blame] | 2 | * Copyright 2016-2019 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 | */ |
| 17 | shadow.extendsFrom(compile) // shadow - resulting configuration with shaded jar file |
| 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" |
Vsevolod Tolstopyatov | c7239ac | 2018-12-10 11:41:00 +0300 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | jar { |
| 28 | manifest { |
| 29 | attributes "Premain-Class": "kotlinx.coroutines.debug.AgentPremain" |
| 30 | attributes "Can-Redefine-Classes": "true" |
Vsevolod Tolstopyatov | c7239ac | 2018-12-10 11:41:00 +0300 | [diff] [blame] | 31 | } |
| 32 | } |
Vsevolod Tolstopyatov | 3781a82 | 2018-12-13 11:58:29 +0300 | [diff] [blame] | 33 | |
| 34 | shadowJar { |
| 35 | classifier null |
| 36 | // Shadow only byte buddy, do not package kotlin stdlib |
Roman Elizarov | d2f4b2b | 2019-09-02 17:22:39 +0300 | [diff] [blame] | 37 | configurations = [project.configurations.shadowDeps] |
Vsevolod Tolstopyatov | 3781a82 | 2018-12-13 11:58:29 +0300 | [diff] [blame] | 38 | relocate 'net.bytebuddy', 'kotlinx.coroutines.repackaged.net.bytebuddy' |
| 39 | } |