Skip to content

Commit

Permalink
Remove checkstyle dependency as it has been shaded into rewrite-java
Browse files Browse the repository at this point in the history
  • Loading branch information
sambsnyd committed Oct 11, 2024
1 parent af099e6 commit 459570d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
7 changes: 0 additions & 7 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ public class RewriteExtension {
protected final Project project;
private File configFile;

@Nullable
private Provider<File> checkstyleConfigProvider;

@Nullable
private Provider<Map<String, Object>> checkstylePropertiesProvider;

@Nullable
private File checkstyleConfigFile;
private String metricsUri = magicalMetricsLogString;
private boolean enableExperimentalGradleBuildScriptParsing = true;
Expand Down Expand Up @@ -198,6 +203,7 @@ public String getRewriteVersion() {
return rewriteVersion;
}

@Nullable
private String rewritePolyglotVersion;
public String getRewritePolyglotVersion() {
if (rewritePolyglotVersion == null) {
Expand All @@ -206,6 +212,7 @@ public String getRewritePolyglotVersion() {
return rewritePolyglotVersion;
}

@Nullable
private String rewriteGradleModelVersion;
public String getRewriteGradleModelVersion() {
if (rewriteGradleModelVersion == null) {
Expand All @@ -214,6 +221,7 @@ public String getRewriteGradleModelVersion() {
return rewriteGradleModelVersion;
}

@Nullable
private String rewriteKotlinVersion;
public String getRewriteKotlinVersion() {
if (rewriteKotlinVersion == null) {
Expand All @@ -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;
}
Expand Down
18 changes: 0 additions & 18 deletions plugin/src/main/java/org/openrewrite/gradle/RewritePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,6 @@ private static Stream<Dependency> 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<Dependency>(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())
);
Expand Down

0 comments on commit 459570d

Please sign in to comment.