renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.19k stars 2.25k forks source link

Update version of Java Lombok inside the Gradle configuration #13333

Closed kennethjor closed 1 year ago

kennethjor commented 2 years ago

What would you like Renovate to be able to do?

Update the version of Lombok (org.projectlombok/lombok) inside the build.gradle configuration:

lombok {
    version = "1.18.20"
}

allprojects {
    lombok {
        version = "1.18.20"
    }
}

subprojects {
    lombok {
        version = "1.18.20"
    }
}

The minimal repo can be found here: https://github.com/kennethjor/renovate-bot-lombok-plugin-minimal-repo

If you have any ideas on how this should be implemented, please tell us here.

I don't.

Is this a feature you are interested in implementing yourself?

No

rarkins commented 2 years ago

Is this a standard? If so then can you point us to documentation of lombok versions in build.gradle specifically?

rarkins commented 2 years ago

It is not mentioned here: https://projectlombok.org/setup/gradle

kennethjor commented 2 years ago

@rarkins It's how you set up the Lombok Gradle plugin: https://docs.freefair.io/gradle-plugins/6.3.0/reference/#_lombok.

rarkins commented 2 years ago

So this is about io.freefair.lombok-base specifically and not lombok generally?

I'm not sure about this. Doesn't this mean we could end up with hundreds of similar ones like this if we go down this path? As in, anyone can publish a Gradle plugin and say "configure it with foo { ... } and then people would ask Renovate to support foo too?

Are there any stats available to support this, e.g.

Otherwise if the answer is "there are thousands of Gradle plugins with equal or less popularity as this" then we don't want thousands of feature requests to implement each one separately - we need something more generic.

kennethjor commented 2 years ago

@rarkins To be honest, I had a feeling there'd be some pushback on this one, as it is very specific.

I've worked with Java for a long time and I think I've encountered two or so Gradle plugins that could be configured in this way, Lombok being one of them. In my own subjective experience, I don't think it's common.

A workaround would be to use Lombok without the Gradle plugin and then Renovate would pick it up just fine.

kennethjor commented 2 years ago

So this is about io.freefair.lombok-base specifically and not lombok generally?

This is about the version of Lombok being set on the plugin config.

kennethjor commented 2 years ago

I had a look a the repo responsible for the Gradle plugin, and it looks like they have Dependabot running to update the default Lombok version. The reason I define the version directly is that I wanted to use the latest one and it wasn't the default in the plugin yet. It just became a habit.

The "official" workaround could thus be to just not define the version at all. I'd be happy with this.

rarkins commented 2 years ago

If it's common for plugins to define a "short" config like this then we can consider supporting it, e.g. with a series of in-built mappings such as lombok->io.freefair.lombok-base. Are there any other plugins which do similarly?

kennethjor commented 2 years ago

The only one I can think of is Gradle itself, as mentioned over in https://github.com/renovatebot/renovate/issues/13251.

rarkins commented 2 years ago

That's a different syntax though

jfisbein commented 2 years ago

Lombok is a widespread library in Java, and the developers recommended way to use it is by using the plugin because the plugin is also configuring some other things (ie: needed annotation processor)

rarkins commented 2 years ago

Reproduction forked to https://github.com/renovate-reproductions/13333

rarkins commented 2 years ago

@Churro do you have any thoughts on this?

Churro commented 2 years ago

This can be made working easily using a custom preset:

"regexManagers": [
  {
    "fileMatch": ["\\.gradle$"],
    "matchStrings": ["lombok(?:\\s*\\{\\s*|\\.)version[ \\t]*=[ \\t]*[\"'](?<currentValue>.*?)[\"']"],
    "datasourceTemplate": "maven",
    "depNameTemplate": "org.projectlombok:lombok"
  },
],

The pattern is admittedly ugly but works fine with the reproduction repo and also covers some nuances (different spaces, quotes), as well as the synonymous definition: lombok.version = "..."

If it's common for plugins to define a "short" config like this then we can consider supporting it, e.g. with a series of in-built mappings such as lombok->io.freefair.lombok-base. Are there any other plugins which do similarly?

Afaik, there are two kinds of plugins:

I can think of two ways how to make this work out-of-the-box for popular (lombok) + Gradle-native plugins:

rarkins commented 2 years ago

Thanks @Churro. In this case let's support common plugin cases like lombok natively in the gradle manager.

renovate-release commented 1 year ago

:tada: This issue has been resolved in version 34.54.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: