autonomousapps / dependency-analysis-gradle-plugin

Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
Apache License 2.0
1.82k stars 120 forks source link

Update Kotlin DSL rewriting functionality to use KotlinEditor #1299

Closed wsutina closed 1 week ago

wsutina commented 3 weeks ago

📝 Description

Updating the RewritingTask to use kotlin-editor, which contains an updated grammar for more complex Kotlin Gradle build scripts. The grammar used for parsing Groovy build scripts remains unchanged.

Note: this depends on https://github.com/cashapp/kotlin-editor/pull/17

autonomousapps commented 1 week ago

The :buildHealth failure is interesting, and I'll have to think about how to resolve it. The existing antlr support for Groovy deliberately shades antlr to work around common problems with people bringing in different versions of that tool and breaking this plugin. However, now we have KotlinEditor also bringing in antlr. ~Maybe the most straightforward answer is to shade KotlinEditor as well. Could maybe do it with the extant shadowed/antlr project.~ 🤔 No, just checked again and that doesn't make sense. I could add a new module just for a shaded version of KotlinEditor. Or I could make the more substantial effort to add Shadow directly to the main module (but this doesn't excite me as a great idea). Or we could even add a shaded version of antlr directly to KotlinEditor -- but I think that's really a user concern and not the responsibility of KotlinEditor.