Search in sources :

Example 1 with AntPathMatcher

use of org.robovm.compiler.util.AntPathMatcher in project robovm by robovm.

the class Resource method walk.

public void walk(Walker walker, File destDir) throws IOException {
    if (targetPath != null && targetPath.trim().length() > 0) {
        destDir = new File(destDir, targetPath);
    }
    if (path != null) {
        // Walk path and all its descendants (if a directory) including
        // everything except the default excludes.
        walk(walker, path.getParentFile(), path.getName(), destDir, Collections.singletonList(MATCH_ALL_MATCHER), DEFAULTEXCLUDESMATCHERS);
    } else {
        List<AntPathMatcher> inc = toAntPathMatchers(includes);
        if (inc.isEmpty()) {
            inc.add(MATCH_ALL_MATCHER);
        }
        List<AntPathMatcher> exc = toAntPathMatchers(excludes);
        if (!isIgnoreDefaultExcludes()) {
            exc.addAll(DEFAULTEXCLUDESMATCHERS);
        }
        File dir = null;
        if (directory != null) {
            dir = directory.getCanonicalFile();
        } else {
            dir = new File("").getCanonicalFile();
        }
        if (dir.exists() && dir.isDirectory()) {
            for (File f : dir.listFiles()) {
                walk(walker, dir, f.getName(), destDir, inc, exc);
            }
        }
    }
}
Also used : File(java.io.File) AntPathMatcher(org.robovm.compiler.util.AntPathMatcher)

Example 2 with AntPathMatcher

use of org.robovm.compiler.util.AntPathMatcher in project robovm by robovm.

the class AppCompiler method getMatchingClasses.

/**
     * Returns all {@link Clazz}es in all {@link Path}s matching the specified
     * ANT-style pattern.
     */
private Collection<Clazz> getMatchingClasses(String pattern) {
    AntPathMatcher matcher = new AntPathMatcher(pattern, ".");
    Map<String, Clazz> matches = new HashMap<String, Clazz>();
    for (Path path : config.getClazzes().getPaths()) {
        for (Clazz clazz : path.listClasses()) {
            if (!matches.containsKey(clazz.getClassName()) && matcher.matches(clazz.getClassName())) {
                matches.put(clazz.getClassName(), clazz);
            }
        }
    }
    return matches.values();
}
Also used : Path(org.robovm.compiler.clazz.Path) HashMap(java.util.HashMap) Clazz(org.robovm.compiler.clazz.Clazz) AntPathMatcher(org.robovm.compiler.util.AntPathMatcher)

Aggregations

AntPathMatcher (org.robovm.compiler.util.AntPathMatcher)2 File (java.io.File)1 HashMap (java.util.HashMap)1 Clazz (org.robovm.compiler.clazz.Clazz)1 Path (org.robovm.compiler.clazz.Path)1