Abhilash Mandaliya
04/19/2023, 7:06 AMkotlin-stdlib
. I have to do this as one of the dependency of my project brings older version of kotlin and I face issues at runtime. I tried using the standard johnrengelman
gradle plugin to shade the library and it worked well. The problem is, it converts kotlin code to java code in the shaded library. I loose all suspend functions in the shaded file and stuck at it. How can I deal with it?
Thanks in advance 🙂hfhbd
04/19/2023, 8:32 AMAbhilash Mandaliya
04/19/2023, 8:37 AMrunBlocking
in normal file looks like this:
@Throws(InterruptedException::class)
public actual fun <T> runBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T {
// some code
}
the same runBlocking
from the shaded file:
public static final <T> T runBlocking(@NotNull CoroutineContext context, @NotNull Function2<? super CoroutineScope, ? super Continuation<? super T>, ? extends Object> block) throws InterruptedException {
return BuildersKt__BuildersKt.runBlocking(context, block);
}
Abhilash Mandaliya
04/19/2023, 8:38 AMephemient
04/19/2023, 4:21 PMephemient
04/19/2023, 4:23 PMkotlin-stdlib
, even if you adjust the rules to not touch metadata (I don't know if it's possible with shadow, I know it is with r8), your suspend funs will not work with external Kotlin callers. why do you even want to do this?ephemient
04/19/2023, 4:24 PM"kotlin"
in your code, breaking itAbhilash Mandaliya
04/20/2023, 5:09 AM