[BUILD-1004] Introduce automated code changes with OpenRewrite Created: 27/Jan/23  Updated: 08/May/23  Resolved: 08/May/23

Status: Closed
Project: Build
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Story Priority: Neutral
Reporter: Maxime Michel Assignee: Michael Duerig
Resolution: Done Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Relates
Sub-Tasks:
Key
Summary
Type
Status
Assignee
BUILD-1007 Manage the rewrite-maven-plugin versi... Sub-task Completed Maxime Michel  
BUILD-1008 Create a repository for recipes Sub-task Closed Michael Duerig  
BUILD-1009 Create a task that can take a list of... Sub-task Closed Michael Duerig  
BUILD-1010 Implement more simple tasks to get a ... Sub-task Closed Federico Grilli  
BUILD-1014 Add plugin dependencies for the rewri... Sub-task Closed Michael Duerig  
BUILD-1035 Add a tab to the magnolia-mgmt-ui for... Sub-task Closed Roberto Gomez  
BUILD-1046 Create Jira tickets for refactorings ... Sub-task Closed Michael Duerig  
BUILD-1057 Empty list of tags should run all ref... Sub-task Closed Michael Duerig  
Template:
Acceptance criteria:
Empty
Epic Link: automated-refactoring
Team: Foundation
Approved:
Yes

 Description   

OpenRewrite is a standard tool that we should incorporate in our processes as it will help us work with our code base with more ease. Indeed, it can work on Java code with powerful recipes. With the transition to EE9 (among other tasks), this is likely something that will come in really helpful.

Discarded scope after initial discovery

  • use it in current pipelines working on pom files so that it can make the code more readable & streamlined
    • use it in dep-bot-validate-pr-job where the current sed-based approach is brittle (as the parameter values for org.openrewrite.maven.ChangePropertyValue need to be in the YAML or pom file anyway, there is no benefit in porting)
    • files-site-update-job (no Maven context to run the plugin in)
    • release-job (mostly inplace editing of Maven)
    • update-trials-job (Maven already performs the inplace edit with newer version)
  • investigate if possible to completely replace the permanent-snapshot-maven-plugin with recipes
    • no because OpenRewrite isn't meant to return values like we need in snapshot-property-resolve
    • also the logic in resolve-current-version requires a couple of sub-steps that forward information to one another (1. validate that we have a permanent SNAPSHOT, 2. run a Maven plugin to figure out the latest version, 3. update the current version) - doesn't appear doable with OpenRewrite

Resources


Generated at Sun Feb 11 23:47:15 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.