diff --git a/pom.xml b/pom.xml index 415bdb25..64645b57 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,7 @@ 8.8.0-SNAPSHOT 1.2.0-SNAPSHOT + 1.5.0-SNAPSHOT scm:git:ssh://git@github.com/openrewrite/rewrite-maven-plugin.git @@ -208,7 +209,11 @@ rewrite-python ${rewrite.python.version} - + + org.openrewrite + rewrite-kotlin + ${rewrite.kotlin.version} + com.puppycrawl.tools checkstyle diff --git a/src/main/java/org/openrewrite/maven/ResourceParser.java b/src/main/java/org/openrewrite/maven/ResourceParser.java index 8bdc4214..37a81333 100644 --- a/src/main/java/org/openrewrite/maven/ResourceParser.java +++ b/src/main/java/org/openrewrite/maven/ResourceParser.java @@ -22,6 +22,7 @@ import org.openrewrite.hcl.HclParser; import org.openrewrite.java.JavaParser; import org.openrewrite.json.JsonParser; +import org.openrewrite.kotlin.KotlinParser; import org.openrewrite.properties.PropertiesParser; import org.openrewrite.protobuf.ProtoParser; import org.openrewrite.python.PythonParser; @@ -148,6 +149,9 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { PythonParser pythonParser = PythonParser.builder().build(); List pythonPaths = new ArrayList<>(); + KotlinParser kotlinParser = KotlinParser.builder().build(); + List kotlinPaths = new ArrayList<>(); + HclParser hclParser = HclParser.builder().build(); List hclPaths = new ArrayList<>(); @@ -172,6 +176,8 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { protoPaths.add(path); } else if (pythonParser.accept(path)) { pythonPaths.add(path); + } else if (kotlinParser.accept(path)) { + kotlinPaths.add(path); } else if (hclParser.accept(path)) { hclPaths.add(path); } else if (quarkParser.accept(path)) { @@ -214,6 +220,11 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { alreadyParsed.addAll(pythonPaths); } + if (!kotlinPaths.isEmpty()) { + sourceFiles = Stream.concat(sourceFiles, (Stream) kotlinParser.parse(kotlinPaths, baseDir, ctx)); + alreadyParsed.addAll(kotlinPaths); + } + if (!hclPaths.isEmpty()) { sourceFiles = Stream.concat(sourceFiles, (Stream) hclParser.parse(hclPaths, baseDir, ctx)); alreadyParsed.addAll(hclPaths);