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

Replace groovy script with FreeMarker template engine #2669

Merged
merged 17 commits into from
Jan 27, 2023
Merged

Conversation

mlvandijk
Copy link
Member

@mlvandijk mlvandijk commented Dec 24, 2022

🤔 What's changed?

Replace groovy scripts with FreeMarker templates to generate code.

⚡️ What's your motivation?

Fixes #2648

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, documentation etc. without changing behaviour)

♻️ Anything particular you want feedback on?

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@codecov
Copy link

codecov bot commented Dec 24, 2022

Codecov Report

Merging #2669 (3aea8ab) into main (5567a43) will increase coverage by 0.00%.
The diff coverage is n/a.

❗ Current head 3aea8ab differs from pull request most recent head 16bf7f5. Consider uploading reports for the commit 16bf7f5 to get more accurate results

@@            Coverage Diff            @@
##               main    #2669   +/-   ##
=========================================
  Coverage     84.68%   84.68%           
+ Complexity     2682     2680    -2     
=========================================
  Files           322      322           
  Lines          9449     9450    +1     
  Branches        899      899           
=========================================
+ Hits           8002     8003    +1     
  Misses         1120     1120           
  Partials        327      327           
Impacted Files Coverage Δ
...in/java/io/cucumber/spring/TestContextAdaptor.java 93.80% <0.00%> (ø)
...rc/main/java/io/cucumber/spring/SpringFactory.java 87.50% <0.00%> (+0.40%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mpkorstanje mpkorstanje self-assigned this Dec 27, 2022
@mpkorstanje mpkorstanje self-requested a review December 27, 2022 16:18
@mpkorstanje mpkorstanje removed their assignment Dec 27, 2022
Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

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

Nice! But it didn't work on my machine because of relative paths. I guess. I've pushed some fixes for that to the cucumber-java part.

Also put the code gen code into src/codegen/java instead. This is then compiled to target/codegen-classes to avoid packaging the code gen code in the jar build with mvn package.

For now lets polish cucumber-java that before we copy it over to cucumber-java8. It would be good to keep in mind that this will be copied over. You can do this by extracting all the configuration constants to the top of the file and/or program arguments.

cucumber-java/pom.xml Outdated Show resolved Hide resolved
cucumber-java/src/codegen/java/CodeGenerationJava.java Outdated Show resolved Hide resolved
cucumber-java/src/codegen/java/CodeGenerationJava.java Outdated Show resolved Hide resolved
cucumber-java/src/codegen/java/CodeGenerationJava.java Outdated Show resolved Hide resolved
cucumber-java/src/codegen/java/CodeGenerationJava.java Outdated Show resolved Hide resolved
@mlvandijk mlvandijk marked this pull request as draft January 5, 2023 09:23
@mlvandijk mlvandijk self-assigned this Jan 6, 2023
@mpkorstanje mpkorstanje marked this pull request as ready for review January 27, 2023 11:02
@mpkorstanje mpkorstanje merged commit 477acb4 into main Jan 27, 2023
@mpkorstanje mpkorstanje deleted the codegen branch January 27, 2023 11:03
@mlvandijk mlvandijk restored the codegen branch February 24, 2023 08:11
@mlvandijk mlvandijk deleted the codegen branch February 24, 2023 08:11
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.

Rewrite Groovy code generation to Java
2 participants