allegro / axion-release-plugin

Gradle release & version management plugin.
https://axion-release-plugin.readthedocs.io/
Apache License 2.0
562 stars 155 forks source link

VersionProperties.Incrementer in Kotlin != groovy.lang.Closure #622

Open duschata opened 1 year ago

duschata commented 1 year ago

Hallo All,

working with the just fixed #590 issue. I run into the next problem using kotlin dsl.

Have a look at the failing test here:

https://github.com/duschata/axion-release-plugin/blob/mcve_kotlin_closure/src/integration/groovy/pl/allegro/tech/build/axion/release/KotlinDslCompatibilityTests.groovy#L89

Kotlin needs a strong typed VersionProperties.Incrementer here, but the condition in the VersionPropertiesFactory

https://github.com/duschata/axion-release-plugin/blob/mcve_kotlin_closure/src/main/groovy/pl/allegro/tech/build/axion/release/infrastructure/config/VersionPropertiesFactory.groovy#L68-L74

evaluates a (!)Closure and the kotlin lambda runs always into the wrong condition.

What can we do there,

what do you think?

kind regards, Tom

bgalek commented 1 year ago

Hi @duschata, nice work finding the issue. I would aim for fixing the instanceof but dunno if it won't be a big rewrite, wanna try to fix it?

duschata commented 1 year ago

Hi @bgalek , I fixed it, wrote test & docs and it seems to work now. I've sent a PR, greetings Tom

duschata commented 1 year ago

Hi All, ups, there is nearly the same issue with VersionProperties.Creator. I'll try to fix this soon...