use of com.sun.tools.classfile.Dependencies 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());
}
}
}
Aggregations