blob: 420a88bd38ec0bede1a835b0c22bba13bda7fee9 [file] [log] [blame]
Vsevolod Tolstopyatovc7239ac2018-12-10 11:41:00 +03001/*
Roman Elizarovd2f4b2b2019-09-02 17:22:39 +03002 * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Vsevolod Tolstopyatovc7239ac2018-12-10 11:41:00 +03003 */
4
Vsevolod Tolstopyatov3781a822018-12-13 11:58:29 +03005apply plugin: "com.github.johnrengelman.shadow"
6
Roman Elizarovd2f4b2b2019-09-02 17:22:39 +03007configurations {
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 Tolstopyatovc7239ac2018-12-10 11:41:00 +030021dependencies {
Vsevolod Tolstopyatov2bdd4602019-02-20 17:00:57 +030022 compileOnly "junit:junit:$junit_version"
Roman Elizarovd2f4b2b2019-09-02 17:22:39 +030023 shadowDeps "net.bytebuddy:byte-buddy:$byte_buddy_version"
24 shadowDeps "net.bytebuddy:byte-buddy-agent:$byte_buddy_version"
Vsevolod Tolstopyatovc7239ac2018-12-10 11:41:00 +030025}
26
27jar {
28 manifest {
29 attributes "Premain-Class": "kotlinx.coroutines.debug.AgentPremain"
30 attributes "Can-Redefine-Classes": "true"
Vsevolod Tolstopyatovc7239ac2018-12-10 11:41:00 +030031 }
32}
Vsevolod Tolstopyatov3781a822018-12-13 11:58:29 +030033
34shadowJar {
35 classifier null
36 // Shadow only byte buddy, do not package kotlin stdlib
Roman Elizarovd2f4b2b2019-09-02 17:22:39 +030037 configurations = [project.configurations.shadowDeps]
Vsevolod Tolstopyatov3781a822018-12-13 11:58:29 +030038 relocate 'net.bytebuddy', 'kotlinx.coroutines.repackaged.net.bytebuddy'
39}