Skip to content

Commit e76f10b

Browse files
committed
Fix Byte Buddy use in debug jar
The `shadow` configuration extends `api` now, which means that all the `api`-style dependencies of this module are not bundled in the fat jar and are instead mentioned in the POM file as `RUNTIME` dependencies. This means that now JNA is not included with the jar, but when someone depends on the jar to later call `DebugProbes.install()`, JNA is fetched as a transitive dependency. This is what we want: JNA is not needed in the jar, because when the debugger is run as a Java agent, attachment of Byte Buddy happens in `Installer`, and JNA-based attach emulation is not used; Byte Buddy is also written is such a way that if JNA is not in the class path, nothing breaks unless one tries to use attach emulation.
1 parent 20cc2ff commit e76f10b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kotlinx-coroutines-debug/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ configurations {
1414
* but in that case it changes dependency type to "runtime" and resolves it
1515
* (so it cannot be further modified). Otherwise, shadow just ignores all dependencies.
1616
*/
17-
shadow.extendsFrom(compile) // shadow - resulting configuration with shaded jar file
17+
shadow.extendsFrom(api) // shadow - resulting configuration with shaded jar file
1818
configureKotlinJvmPlatform(shadow)
1919
}
2020

@@ -24,8 +24,8 @@ dependencies {
2424
shadowDeps "net.bytebuddy:byte-buddy-agent:$byte_buddy_version"
2525
compileOnly "io.projectreactor.tools:blockhound:$blockhound_version"
2626
testCompile "io.projectreactor.tools:blockhound:$blockhound_version"
27-
runtime "net.java.dev.jna:jna:$jna_version"
28-
runtime "net.java.dev.jna:jna-platform:$jna_version"
27+
api "net.java.dev.jna:jna:$jna_version"
28+
api "net.java.dev.jna:jna-platform:$jna_version"
2929
}
3030

3131
jar {

0 commit comments

Comments
 (0)