diff --git a/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java b/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java index 0442d6566..2656bd9cf 100644 --- a/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java +++ b/plugin/src/main/java/org/openrewrite/gradle/isolated/DefaultProjectParser.java @@ -268,7 +268,7 @@ private static StringBuilder repeat(int repeat) { public Collection listSources() { // Use a sorted collection so that gradle input detection isn't thrown off by ordering - Set result = new TreeSet<>(omniParser(emptySet()).build().acceptedPaths(baseDir, project.getProjectDir().toPath())); + Set result = new TreeSet<>(omniParser(emptySet()).acceptedPaths(baseDir, project.getProjectDir().toPath())); //noinspection deprecation JavaPluginConvention javaConvention = project.getConvention().findPlugin(JavaPluginConvention.class); if (javaConvention != null) { @@ -806,7 +806,7 @@ public Stream parse(Project subproject, Set alreadyParsed, Exe for (File resourcesDir : sourceSet.getResources().getSourceDirectories()) { if (resourcesDir.exists()) { - OmniParser omniParser = omniParser(alreadyParsed).build(); + OmniParser omniParser = omniParser(alreadyParsed); List accepted = omniParser.acceptedPaths(baseDir, resourcesDir.toPath()); sourceSetSourceFiles = Stream.concat( sourceSetSourceFiles, @@ -939,14 +939,13 @@ private SourceFileStream parseGradleFiles( protected SourceFileStream parseNonProjectResources(Project subproject, Set alreadyParsed, ExecutionContext ctx, List projectProvenance, Stream sourceFiles) { //Collect any additional yaml/properties/xml files that are NOT already in a source set. - OmniParser omniParser = omniParser(alreadyParsed) - .build(); + OmniParser omniParser = omniParser(alreadyParsed); List accepted = omniParser.acceptedPaths(baseDir, subproject.getProjectDir().toPath()); return SourceFileStream.build("", s -> {}) .concat(omniParser.parse(accepted, baseDir, ctx), accepted.size()); } - private OmniParser.Builder omniParser(Set alreadyParsed) { + private OmniParser omniParser(Set alreadyParsed) { return OmniParser.builder( OmniParser.RESOURCE_PARSERS, PlainTextParser.builder() @@ -956,7 +955,8 @@ private OmniParser.Builder omniParser(Set alreadyParsed) { ) .exclusionMatchers(pathMatchers(baseDir, mergeExclusions(project, baseDir, extension))) .exclusions(alreadyParsed) - .sizeThresholdMb(extension.getSizeThresholdMb()); + .sizeThresholdMb(extension.getSizeThresholdMb()) + .build(); } private static Collection mergeExclusions(Project project, Path baseDir, RewriteExtension extension) {