dipien / releases-hub-gradle-plugin

Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes
https://releaseshubplugin.dipien.com
Apache License 2.0
148 stars 7 forks source link

Gradle version catalogs support #113

Closed maxirosson closed 3 years ago

maxirosson commented 3 years ago

https://docs.gradle.org/current/userguide/platforms.html

As part of this issue, the basic notation is supported on the libs.versions.toml file:

[libraries]
groovy-core = "org.codehaus.groovy:groovy:3.0.5"
groovy-json = "org.codehaus.groovy:groovy-json:3.0.5"
groovy-nio = "org.codehaus.groovy:groovy-nio:3.0.5"

The support for [versions] tag will be implemented as part of this issue: https://github.com/dipien/releases-hub-gradle-plugin/issues/17

nachtien commented 3 years ago

Hi there! I haven't looked too deep into this code (I found this library just now). Do you think this would be as simple as just parsing each line in the toml file, and referencing the version number value, then performing a lookup to see if it's the latest version?

maxirosson commented 3 years ago

I think I should refactor DependenciesExtractor & DependenciesUpgrader classes first in order to allow multiple implementations. I will see if I can start with that refactor as the first step

nachtien commented 3 years ago

Yes! Nice work! At the moment DependencyBot doesn't support it, making this plugin the only one capable of creating PR's for dependency updates :). When do you think you'll release 3.0?

Oh it looks like I'll have to wait for 3.1.0 for the version support.

maxirosson commented 3 years ago

I expect to release 3.0 between today and tomorrow. Regarding the [versions] tag support, I don't see that as urgent, because in my opinion doesn't offer any advantage to use that tag if you are going to automatically upgrade your dependencies with the releases hub plugin.

nachtien commented 3 years ago

ah gotcha. Thanks for the message back.

If I just delete the version.ref from each of my dependency, so: ktor-clientAndroid = { module = "io.ktor:ktor-client-android", version.ref = "ktor" } becomes ktor-clientAndroid = { module = "io.ktor:ktor-client-android"} Would this plugin be smart enough to upgrade it?

maxirosson commented 3 years ago

You will need to have this string on any file:

"groupId:artifactId:version"

and then configure the dependenciesPaths extension property to define which files to parse. By default, these files are parsed:

releasesHub {
    dependenciesPaths = [
          "buildSrc/src/main/kotlin/Libs.kt", 
          "buildSrc/src/main/kotlin/BuildLibs.kt",
          "gradle/libs.versions.toml",
          "settings.gradle.kts"
        ]
}
maxirosson commented 3 years ago

The basic notation is supported on the libs.versions.toml file:

For example:

[libraries]
groovy-core = "org.codehaus.groovy:groovy:3.0.5"
groovy-json = "org.codehaus.groovy:groovy-json:3.0.5"
groovy-nio = "org.codehaus.groovy:groovy-nio:3.0.5"