diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 7b63df374..74d852787 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -114,13 +114,6 @@ dependencies { "rewriteDependencies"("org.openrewrite:rewrite-polyglot:$latest") "rewriteDependencies"("org.openrewrite.gradle.tooling:model:$latest") "rewriteDependencies"("org.openrewrite:rewrite-maven") - // Newer versions of checkstyle are compiled with a newer version of Java than is supported with gradle 4.x - @Suppress("VulnerableLibrariesLocal", "RedundantSuppression") - "rewriteDependencies"("com.puppycrawl.tools:checkstyle:9.3") { - because("Latest version supporting gradle 4.x") - // We only use checkstyle to load its configuration files, and it turns out this alone is sufficient - isTransitive = false - } "rewriteDependencies"("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.2") "rewriteDependencies"("com.google.guava:guava:latest.release") implementation(platform("org.openrewrite:rewrite-bom:$latest")) diff --git a/plugin/src/main/java/org/openrewrite/gradle/RewriteExtension.java b/plugin/src/main/java/org/openrewrite/gradle/RewriteExtension.java index 797512822..05d75d373 100755 --- a/plugin/src/main/java/org/openrewrite/gradle/RewriteExtension.java +++ b/plugin/src/main/java/org/openrewrite/gradle/RewriteExtension.java @@ -38,8 +38,13 @@ public class RewriteExtension { protected final Project project; private File configFile; + @Nullable private Provider checkstyleConfigProvider; + + @Nullable private Provider> checkstylePropertiesProvider; + + @Nullable private File checkstyleConfigFile; private String metricsUri = magicalMetricsLogString; private boolean enableExperimentalGradleBuildScriptParsing = true; @@ -198,6 +203,7 @@ public String getRewriteVersion() { return rewriteVersion; } + @Nullable private String rewritePolyglotVersion; public String getRewritePolyglotVersion() { if (rewritePolyglotVersion == null) { @@ -206,6 +212,7 @@ public String getRewritePolyglotVersion() { return rewritePolyglotVersion; } + @Nullable private String rewriteGradleModelVersion; public String getRewriteGradleModelVersion() { if (rewriteGradleModelVersion == null) { @@ -214,6 +221,7 @@ public String getRewriteGradleModelVersion() { return rewriteGradleModelVersion; } + @Nullable private String rewriteKotlinVersion; public String getRewriteKotlinVersion() { if (rewriteKotlinVersion == null) { @@ -222,10 +230,6 @@ public String getRewriteKotlinVersion() { return rewriteKotlinVersion; } - public String getCheckstyleToolsVersion() { - return getVersionProps().getProperty("com.puppycrawl.tools:checkstyle"); - } - public void setRewriteVersion(String value) { rewriteVersion = value; } diff --git a/plugin/src/main/java/org/openrewrite/gradle/RewritePlugin.java b/plugin/src/main/java/org/openrewrite/gradle/RewritePlugin.java index a0308ca51..94e6a7c8f 100644 --- a/plugin/src/main/java/org/openrewrite/gradle/RewritePlugin.java +++ b/plugin/src/main/java/org/openrewrite/gradle/RewritePlugin.java @@ -212,24 +212,6 @@ private static Stream knownRewriteDependencies(RewriteExtension exte deps.create("org.openrewrite:rewrite-yaml:" + rewriteVersion), deps.create("org.openrewrite:rewrite-polyglot:" + extension.getRewritePolyglotVersion()), deps.create("org.openrewrite.gradle.tooling:model:" + extension.getRewriteGradleModelVersion()), - - // This is an optional dependency of rewrite-java needed when projects also apply the checkstyle plugin - deps.create("com.puppycrawl.tools:checkstyle:" + extension.getCheckstyleToolsVersion(), new Closure(deps) { - @Override - public Dependency call(Object arguments) { - if (arguments instanceof ExternalModuleDependency) { - ExternalModuleDependency dep = (ExternalModuleDependency) arguments; - dep.setTransitive(false); - return dep; - } - return super.call(arguments); - } - - @Override - public int getMaximumNumberOfParameters() { - return 1; - } - }), deps.create("com.fasterxml.jackson.module:jackson-module-kotlin:" + extension.getJacksonModuleKotlinVersion()), deps.create("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:" + extension.getJacksonModuleKotlinVersion()) );