Search in sources :

Example 1 with Differ

use of aQute.bnd.service.diff.Differ in project bnd by bndtools.

the class DiffCommand method showTree.

/**
	 * Just show the single tree
	 * 
	 * @param bnd
	 * @param options
	 * @throws Exception
	 */
private static void showTree(bnd bnd, diffOptions options) throws Exception {
    File fout = options.output();
    PrintWriter pw;
    if (fout == null)
        pw = IO.writer(bnd.out);
    else
        pw = IO.writer(fout, UTF_8);
    Instructions packageFilters = new Instructions(options.pack());
    try (Jar newer = new Jar(bnd.getFile(options._arguments().get(0)))) {
        Differ di = new DiffPluginImpl();
        Tree n = di.tree(newer);
        boolean all = options.api() == false && options.resources() == false && options.manifest() == false;
        if (all || options.api())
            for (Tree packageDiff : n.get("<api>").getChildren()) {
                if (packageFilters.matches(packageDiff.getName()))
                    show(pw, packageDiff, 0);
            }
        if (all || options.manifest())
            show(pw, n.get("<manifest>"), 0);
        if (all || options.resources())
            show(pw, n.get("<resources>"), 0);
    } finally {
        pw.close();
    }
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) Differ(aQute.bnd.service.diff.Differ) Tree(aQute.bnd.service.diff.Tree) Instructions(aQute.bnd.osgi.Instructions) Jar(aQute.bnd.osgi.Jar) File(java.io.File) PrintWriter(java.io.PrintWriter)

Aggregations

DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)1 Instructions (aQute.bnd.osgi.Instructions)1 Jar (aQute.bnd.osgi.Jar)1 Differ (aQute.bnd.service.diff.Differ)1 Tree (aQute.bnd.service.diff.Tree)1 File (java.io.File)1 PrintWriter (java.io.PrintWriter)1