diff --git a/pom.xml b/pom.xml index 7325d1c1..30e7490f 100644 --- a/pom.xml +++ b/pom.xml @@ -197,6 +197,10 @@ org.openrewrite rewrite-protobuf + + org.openrewrite + rewrite-toml + org.openrewrite rewrite-yaml diff --git a/src/main/java/org/openrewrite/maven/ResourceParser.java b/src/main/java/org/openrewrite/maven/ResourceParser.java index 4fcf4ed0..b5496f68 100644 --- a/src/main/java/org/openrewrite/maven/ResourceParser.java +++ b/src/main/java/org/openrewrite/maven/ResourceParser.java @@ -27,6 +27,7 @@ import org.openrewrite.protobuf.ProtoParser; import org.openrewrite.quark.QuarkParser; import org.openrewrite.text.PlainTextParser; +import org.openrewrite.toml.TomlParser; import org.openrewrite.xml.XmlParser; import org.openrewrite.yaml.YamlParser; @@ -152,6 +153,9 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { ProtoParser protoParser = new ProtoParser(); List protoPaths = new ArrayList<>(); + TomlParser tomlParser = new TomlParser(); + List tomlPaths = new ArrayList<>(); + KotlinParser kotlinParser = kotlinParserBuilder.build(); List kotlinPaths = new ArrayList<>(); @@ -180,6 +184,8 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { propertiesPaths.add(path); } else if (protoParser.accept(path)) { protoPaths.add(path); + } else if (tomlParser.accept(path)) { + tomlPaths.add(path); } else if (kotlinParser.accept(path)) { kotlinPaths.add(path); } else if (groovyParser.accept(path)) { @@ -221,6 +227,11 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { alreadyParsed.addAll(protoPaths); } + if (!tomlPaths.isEmpty()) { + sourceFiles = Stream.concat(sourceFiles, (Stream) tomlParser.parse(tomlPaths, baseDir, ctx)); + alreadyParsed.addAll(tomlPaths); + } + if (!kotlinPaths.isEmpty()) { sourceFiles = Stream.concat(sourceFiles, (Stream) kotlinParser.parse(kotlinPaths, baseDir, ctx)); alreadyParsed.addAll(kotlinPaths);