Table of Contents

Basic Groovy and Gradle support

Moderne
|
October 4, 2021
Basic Groovy and Gradle support

Key Takeaways

Rewrite 7.15.0 adds basic support for parsing and transforming Groovy and Gradle scripts. Groovy support extends the Java model that already exists, allowing us to reuse many of the Java base building blocks we already have in Groovy without any modification (!!).

We also reuse some components built originally for Maven refactoring like advanced Semver selectors. As applied to Gradle plugin versions for example, we can write a recipe that keeps us moving forward on the latest 1.8.x release of a particular plugin. Every time this recipe is ran, OpenRewrite checks the Gradle plugin portal to see if there are any new versions that can be upgraded to.

A unit test for the UpgradePluginVersion recipe.

Surprisingly, even Groovy written dynamically has a rich type attribution model to it, because OpenRewrite takes information produced by both the Groovy static compiler and the data inferred by the Groovy compiler through its canonicalization phase before mapping the AST, the phase right before bytecode generation.

Colorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzle

Back to Blog

Colorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzleColorful, semi-transparent Moderne symbol breaking apart like a puzzle

Back to Engineering Blog