Skip to content

Plugin for IntelliJ Idea and Android Studio that converts direct Gradle dependency declarations into Version Catalog format (TOML)

License

Notifications You must be signed in to change notification settings

otraupe/Gradle-Dependencies-to-Catalog

Repository files navigation

Gradle-Dependencies-to-Catalog

Plugin for IntelliJ Idea and Android Studio that converts direct Gradle dependency declarations into version catalog format (TOML).

Copy/Paste legacy dependency declarations from Maven Central or tutorials and easily convert them into the new format. Simply select/mark the legacy dependencies in your Gradle build file and convert them via the entry in the Edit menu or the default keyboard shortcut: Ctrl+Alt+Shift+D

Supports the following legacy notations:

  • Kotlin: implementation("com.opappdevs:depstocatalog:1.0.0")
  • Groovy (short): implementation 'com.opappdevs:depstocatalog:1.0.0'

Output

opappdevs = "1.0.0"
com-opappdevs-depstocatalog = { group = "com.opappdevs", name = "depstocatalog", version.ref = "opappdevs" }
implementation(libs.com.opappdevs.depstocatalog)

Plugin behavior

This behavior could be configurable in future versions:

  • The version label is the last part of the group
  • The dependency label is created from the last two parts of the group (if available) and the fragment name
  • The output for multiple dependencies is grouped into version, definition, and declaration

Known issues

  • Any non-matched text between dependency declarations in the selection gets removed (such as catalog version notation or comments)
  • Output currently isn't being sorted
  • BUG: differences in tld only are not captured (unrealistic scenario)
  • BUG: differences in tld and org should also result in independent version numbers (unrealistic scenario)
  • BUG: differences in version number should result in separate definitions and declarations (unrealistic scenario)

Future plans

  • support Maven coordinates directly
  • support Groovy (long) format
  • automatically put the definitions into the catalog file

License

Distributed under the MIT license.

About

Plugin for IntelliJ Idea and Android Studio that converts direct Gradle dependency declarations into Version Catalog format (TOML)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages