diff --git a/cli/src/main/java/net/neoforged/jst/cli/Main.java b/cli/src/main/java/net/neoforged/jst/cli/Main.java index 613d2e1..2415666 100644 --- a/cli/src/main/java/net/neoforged/jst/cli/Main.java +++ b/cli/src/main/java/net/neoforged/jst/cli/Main.java @@ -35,6 +35,9 @@ public class Main implements Callable { @CommandLine.Option(names = "--ignore-prefix", description = "Do not apply transformations to paths that start with any of these prefixes.") List ignoredPrefixes = new ArrayList<>(); + @CommandLine.Option(names = "--hidden-prefix", description = "Do not process or emit paths that start with any of these prefixes.") + List hiddenPrefixes = new ArrayList<>(); + @CommandLine.Option(names = "--classpath", description = "Additional classpath entries to use. Is combined with --libraries-list.", converter = ClasspathConverter.class) List addToClasspath = new ArrayList<>(); @@ -79,6 +82,10 @@ public Integer call() throws Exception { for (String ignoredPrefix : ignoredPrefixes) { processor.addIgnoredPrefix(ignoredPrefix); } + for (String hiddenPrefix : hiddenPrefixes) { + processor.addIgnoredPrefix(hiddenPrefix); + processor.addHiddenPrefix(hiddenPrefix); + } processor.setMaxQueueDepth(maxQueueDepth); diff --git a/cli/src/main/java/net/neoforged/jst/cli/SourceFileProcessor.java b/cli/src/main/java/net/neoforged/jst/cli/SourceFileProcessor.java index 5e7dd06..a20fc92 100644 --- a/cli/src/main/java/net/neoforged/jst/cli/SourceFileProcessor.java +++ b/cli/src/main/java/net/neoforged/jst/cli/SourceFileProcessor.java @@ -34,6 +34,7 @@ class SourceFileProcessor implements AutoCloseable { private final Logger logger; private final List ignoredPrefixes = new ArrayList<>(); + private final List hiddenPrefixes = new ArrayList<>(); public SourceFileProcessor(Logger logger) throws IOException { this.logger = logger; @@ -114,13 +115,21 @@ private boolean processEntry(FileEntry entry, VirtualFile sourceRoot, List prefixes) { + for (String ignoredPrefix : prefixes) { if (relativePath.startsWith(ignoredPrefix)) { return true; } @@ -187,6 +196,12 @@ public void addIgnoredPrefix(String ignoredPrefix) { this.ignoredPrefixes.add(ignoredPrefix); } + public void addHiddenPrefix(String hiddenPrefix) { + System.out.println("Not reading entries starting with " + hiddenPrefix); + this.ignoredPrefixes.add(hiddenPrefix); + this.hiddenPrefixes.add(hiddenPrefix); + } + @Override public void close() throws IOException { ijEnv.close();