Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
duschata opened this issue May 19, 2023 · 3 comments
Open

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

duschata opened this issue May 19, 2023 · 3 comments

Comments

@duschata
Copy link
Contributor

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,

  • using a kind of closureOf function in the kotlin script?
  • fix the (!(value instanceof Closure))?

what do you think?

kind regards, Tom

@bgalek
Copy link
Member

bgalek commented May 22, 2023

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
Copy link
Contributor Author

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

bgalek pushed a commit that referenced this issue May 24, 2023
…r to run in right condition if dsl is kotlin (#626)

Test & Documentation
@duschata
Copy link
Contributor Author

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

bgalek pushed a commit that referenced this issue May 26, 2023
* #622 fix: evaluate also instance VersionVersionProperties.Incrementer to run in right condition if dsl is kotlin
 Test & Documentation

* #622 fix: evaluate also instance VersionVersionProperties.Creator to run in right condition if dsl is kotlin
 Test & Documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants