From 97fafbbb95c81cf9297bf710c508b41c3b5ac7f9 Mon Sep 17 00:00:00 2001 From: Marcel Reiter <131314419+marcel-gepardec@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:02:10 +0200 Subject: [PATCH] Accept any directories under `src` in `ResourceParser` (#868) * Added accepted directories to accept all recursive directories within "src" * Flip field order to match usage & natural order --------- Co-authored-by: marcel-gepardec Co-authored-by: Tim te Beek --- src/main/java/org/openrewrite/maven/ResourceParser.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/openrewrite/maven/ResourceParser.java b/src/main/java/org/openrewrite/maven/ResourceParser.java index db9dd597..48be210d 100644 --- a/src/main/java/org/openrewrite/maven/ResourceParser.java +++ b/src/main/java/org/openrewrite/maven/ResourceParser.java @@ -40,6 +40,7 @@ import java.util.stream.Stream; public class ResourceParser { + private static final Set DEFAULT_ACCEPTED_DIRECTORIES = new HashSet<>(Arrays.asList("src")); private static final Set DEFAULT_IGNORED_DIRECTORIES = new HashSet<>(Arrays.asList( "build", "target", "out", ".sonar", ".gradle", ".idea", ".project", "node_modules", ".git", ".metadata", ".DS_Store")); @@ -283,6 +284,9 @@ private boolean isParsedAsPlainText(Path path) { private boolean isIgnoredDirectory(Path searchDir, Path path) { for (Path pathSegment : searchDir.relativize(path)) { + if (DEFAULT_ACCEPTED_DIRECTORIES.contains(pathSegment.toString())){ + return false; + } if (DEFAULT_IGNORED_DIRECTORIES.contains(pathSegment.toString())) { return true; }