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

Generate a Kotlin wrapper with Kotlin Poet #75

Closed
wants to merge 13 commits into from
Closed

Generate a Kotlin wrapper with Kotlin Poet #75

wants to merge 13 commits into from

Conversation

jmfayard
Copy link
Collaborator

@jmfayard jmfayard commented Feb 8, 2022

I am able to generate the file SetupnodeV2.kt with KotlinPoet

Copy link
Member

@krzema12 krzema12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great direction, I like it :)
To make a consistent change, let's make the SetupNodeV2 wrapper fully functional.

return FunSpec.builder("toYamlArguments")
.returns(LinkedHashMap::class.parameterizedBy(String::class, String::class))
.addModifiers(KModifier.OVERRIDE)
.addCode("return TODO(%S)", "You need to implement toYamlArguments()")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a must-have to have MVP :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

wrapper-generator/src/main/kotlin/Generation.kt Outdated Show resolved Hide resolved
wrapper-generator/src/test/kotlin/GenerationTest.kt Outdated Show resolved Hide resolved
@jmfayard
Copy link
Collaborator Author

jmfayard commented Feb 9, 2022

@krzema12

  • The Wrapper now supports Parameters of type boolean and integer - based on the default value of the parameter
  • the function toYamlArguments() is now automatically generated
  • the test class SetupNodeV2Test is now automatically generated
  • polishing
    • properties are now correctly in camelCase
    • class names are now correctly in PascalCase
    • packages should be correct
    • make ktlint happy

@jmfayard
Copy link
Collaborator Author

jmfayard commented Feb 9, 2022

@krzema12 I added a command to generate the wrapper from the command-line

./gradlew :wrapper-generator:run --args https://github.com/peterjgrainger/action-create-branch/releases/tag/v2.1.0

I'm now done feature-wise

@krzema12
Copy link
Member

krzema12 commented Feb 9, 2022

Please don't bother about the merge conflicts, I'm introducing these changes in smaller chunks and with slightly different approach, using you PR as inspiration/reference implementation. I'll mark you as author wherever necessary. Thanks for your effort! 🎉

@krzema12 krzema12 closed this Feb 13, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants