Does anyone know if there's a good plugin (or even...
# gradle
m
Does anyone know if there's a good plugin (or even a decent way to implement one) to examine the entire kotlin compile classpath plus transitive dependencies to look for the usage of deprecated functions and classes? I know it's probably a complex and daunting task, but it's got to be better than trying to figure all that out manually. We have a poly repo situation going on, and i want to see where the usages are of deprecated things so i can see if they can be removed. I suppose the R8 output can probably help with that, but it's still something i'd have to manually look through if i can't find a way to automate it.
🙌 1
e
on JVM it's pretty easy to scan classes. as a demo,
Copy code
$ unzip example.zip && cd example && gradle scanBytecode

> Task :scanMainBytecode
kotlin.io.ByteStreamsKt.readBytes$default:(Ljava/io/InputStream;IILjava/lang/Object;)[B uses annotated method kotlin.io.ByteStreamsKt.readBytes:(Ljava/io/InputStream;I)[B
...

> Task :scanTestBytecode
...
kotlin.time.AbstractDoubleTimeSource.markNow:()Lkotlin/time/TimeMark; uses annotated method kotlin.time.AbstractDoubleTimeSource.markNow:()Lkotlin/time/ComparableTimeMark;

BUILD SUCCESSFUL in 2s
7 actionable tasks: 7 executed
$
in reality you probably want to do some filtering so it's only your usages and not stuff inside transitive dependencies like this demo, but that's just details
for non-JVM platforms… might be easier to just re-run the Kotlin compiler and grep all the deprecation warnings from the logs
v
Within IntelliJ you could also use structural search
m
I'll take a look @ephemient. But i actually want to know where it's used in transitive dependencies. As an example, we have a design library that is used in several repositories. Those are then brought into a host application. So upgrading the design library is always risky if you change signatures and get ourselves into jar hell. I just want to be able to know if particular functions are being used so i can remove them. The hard part is identifying where they are in use. Github search can only help so much.
e
getting them from compiler logs include file name and line number