Search in sources :

Example 1 with Location

use of com.sun.tools.classfile.Dependency.Location in project ceylon-compiler by ceylon.

the class GetDeps method run.

void run(PrintWriter out, String... args) throws IOException, ClassFileNotFoundException {
    decodeArgs(args);
    final StandardJavaFileManager fm = new JavacFileManager(new Context(), false, null);
    if (classpath != null)
        fm.setLocation(StandardLocation.CLASS_PATH, classpath);
    ClassFileReader reader = new ClassFileReader(fm);
    Dependencies d = new Dependencies();
    if (regex != null)
        d.setFilter(Dependencies.getRegexFilter(Pattern.compile(regex)));
    if (packageNames.size() > 0)
        d.setFilter(Dependencies.getPackageFilter(packageNames, false));
    SortedRecorder r = new SortedRecorder(reverse);
    d.findAllDependencies(reader, rootClassNames, transitiveClosure, r);
    SortedMap<Location, SortedSet<Dependency>> deps = r.getMap();
    for (Map.Entry<Location, SortedSet<Dependency>> e : deps.entrySet()) {
        out.println(e.getKey());
        for (Dependency dep : e.getValue()) {
            out.println("    " + dep.getTarget());
        }
    }
}
Also used : JavacFileManager(com.sun.tools.javac.file.JavacFileManager) Context(com.sun.tools.javac.util.Context) Dependencies(com.sun.tools.classfile.Dependencies) Location(com.sun.tools.classfile.Dependency.Location)

Aggregations

Dependencies (com.sun.tools.classfile.Dependencies)1 Location (com.sun.tools.classfile.Dependency.Location)1 JavacFileManager (com.sun.tools.javac.file.JavacFileManager)1 Context (com.sun.tools.javac.util.Context)1