Links

Add @DelegatesTo to the Gradle API

org.openrewrite.gradle.AddDelegatesToGradleApi
The Gradle API has methods which accept groovy.lang.Closure. Typically, there is an overload which accepts an org.gradle.api.Action.This recipe takes the type declared as the receiver of the Action overload and adds an appropriate @groovy.lang.DelegatesTo annotation to the Closure overload.

Source

  • groupId: org.openrewrite
  • artifactId: rewrite-gradle
  • version: 7.40.6

Example

  • Example 1:

Contributors

Usage

This recipe has no required configuration parameters and comes from a rewrite core library. It can be activated directly without adding any dependencies.
Gradle
build.gradle
plugins {
id("org.openrewrite.rewrite") version("5.40.4")
}
rewrite {
activeRecipe("org.openrewrite.gradle.AddDelegatesToGradleApi")
}
repositories {
mavenCentral()
}

See how this recipe works across multiple open-source repositories

Moderne Link Image
The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.
Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.