From a61057d66c415ebc73f35556c883a5d59634a5cc Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Tue, 6 Jul 2021 15:28:58 -0500 Subject: [PATCH] Add openrewrite --- build.gradle | 11 +++++++++++ buildSrc/build.gradle | 1 + rewrite.yml | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 rewrite.yml diff --git a/build.gradle b/build.gradle index 36caef2faf..f4d6959142 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,17 @@ apply plugin: 'org.springframework.security.sagan' apply plugin: 'org.springframework.github.milestone' apply plugin: 'org.springframework.github.changelog' +apply plugin: 'org.openrewrite.rewrite' + +rewrite { + activeRecipe("org.openrewrite.java.spring.boot2.SpringBoot2JUnit4to5Migration") + activeStyle("io.moderne.spring.style") +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-spring:4.6.1") +} + group = 'org.springframework.security' description = 'Spring Security' diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 604cfd11a0..d63919588d 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -71,6 +71,7 @@ dependencies { implementation 'net.sourceforge.saxon:saxon:9.1.0.8' implementation localGroovy() + implementation 'org.openrewrite:plugin:5.2.1' implementation 'io.github.gradle-nexus:publish-plugin:1.1.0' implementation 'io.projectreactor:reactor-core:3.4.6' implementation 'gradle.plugin.org.gretty:gretty:3.0.1' diff --git a/rewrite.yml b/rewrite.yml new file mode 100644 index 0000000000..49ef3342a0 --- /dev/null +++ b/rewrite.yml @@ -0,0 +1,23 @@ +--- +type: specs.openrewrite.org/v1beta/style +name: io.moderne.spring.style +styleConfigs: + - org.openrewrite.java.style.ImportLayoutStyle: + classCountToUseStarImport: 999 + nameCountToUseStarImport: 999 + layout: + - import java.* + - + - import javax.* + - + - import all other imports + - + - import org.springframework.* + - + - import static all other imports + - org.openrewrite.java.style.TabsAndIndentsStyle: + useTabCharacter: true + tabSize: 1 + indentSize: 1 + continuationIndent: 2 + indentsRelativeToExpressionStart: false