Search in sources :

Example 1 with PathVisitor

use of io.quarkus.paths.PathVisitor in project quarkus by quarkusio.

the class ApplicationArchiveBuildStep method indexPathTree.

private static Index indexPathTree(PathTree tree, Set<String> removed) throws IOException {
    Indexer indexer = new Indexer();
    tree.walk(new PathVisitor() {

        @Override
        public void visitPath(PathVisit visit) {
            final Path path = visit.getPath();
            final Path fileName = path.getFileName();
            if (fileName == null || !fileName.toString().endsWith(".class") || Files.isDirectory(path) || removed != null && removed.contains(visit.getRelativePath("/"))) {
                return;
            }
            try (InputStream in = Files.newInputStream(path)) {
                indexer.index(in);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    });
    return indexer.complete();
}
Also used : Path(java.nio.file.Path) Indexer(org.jboss.jandex.Indexer) InputStream(java.io.InputStream) PathVisitor(io.quarkus.paths.PathVisitor) PathVisit(io.quarkus.paths.PathVisit) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException)

Aggregations

PathVisit (io.quarkus.paths.PathVisit)1 PathVisitor (io.quarkus.paths.PathVisitor)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 UncheckedIOException (java.io.UncheckedIOException)1 Path (java.nio.file.Path)1 Indexer (org.jboss.jandex.Indexer)1