fwcd / kotlin-debug-adapter

Kotlin/JVM debugging for any editor/IDE using the Debug Adapter Protocol
MIT License
110 stars 19 forks source link

Gradle runtimeOnly dependencies not in classpath #79

Open LuLeRoemer opened 9 months ago

LuLeRoemer commented 9 months ago

Gradle runtimeOnly dependencies cannot be resolved by the debugger. As a workaround, I was able to get the app running by adding

main {
  compileClasspath += configurations.runtimeClasspath
}

to the sourceSets. However, I would expect the debugger to use the runtimeClasspath.

themkat commented 5 months ago

Good catch! 🙂 Sorry for answering late.

The main "issue" here is the code sharing between kotlin-language-server and debug-adapter for getting the classpath entries. They use the same logic. While it is easy enough to just add the runtime classpath, I don't think that is the best choice for the language server, as that is supposed to handle compile-time bits. Maybe we could add a flag to to the classpath handling functions to include runtime dependencies or not? Then it is just a way of deciding to include them in the classpath or not. Simplest solution is probably an own artifact pattern for the helper scripts (i.e, like we have kotlin-lsp-gradle as a pattern for our regular dependencies).

Feel free to disagree with my ramblings 🙂

Classpath handling in debug adapter