Search in sources :

Example 26 with Baseline

use of aQute.bnd.differ.Baseline in project bndtools by bndtools.

the class InfoLabelProvider method getImage.

@Override
public Image getImage(Object element) {
    if (element instanceof Baseline) {
        //$NON-NLS-1$
        Diff apiDiff = ((Baseline) element).getDiff() != null ? ((Baseline) element).getDiff().get("<api>") : null;
        if (apiDiff == null) {
            apiDiff = ((Baseline) element).getDiff();
        }
        //$NON-NLS-1$
        return BundleTreeImages.resolveImage("bundle", apiDiff.getDelta().toString().toLowerCase(), null, null);
    }
    if (element instanceof Info) {
        Info tree = (Info) element;
        //$NON-NLS-1$
        String type = "package";
        //$NON-NLS-1$
        String delta = "changed" + '_' + tree.packageDiff.getDelta().toString().toLowerCase();
        //$NON-NLS-1$
        String impExp = "export";
        return BundleTreeImages.resolveImage(type, delta, impExp, null);
    }
    return null;
}
Also used : Diff(aQute.bnd.service.diff.Diff) Baseline(aQute.bnd.differ.Baseline) Info(aQute.bnd.differ.Baseline.Info)

Example 27 with Baseline

use of aQute.bnd.differ.Baseline in project bndtools by bndtools.

the class DiffHelper method createBaseline.

public static Baseline createBaseline(Builder builder) {
    try {
        if (builder instanceof ProjectBuilder) {
            ProjectBuilder projectBuilder = (ProjectBuilder) builder;
            Jar jar = null;
            Jar currentJar = null;
            try {
                jar = builder.build();
                currentJar = projectBuilder.getBaselineJar();
                if (currentJar == null) {
                    currentJar = projectBuilder.getLastRevision();
                }
                if (currentJar == null) {
                    //$NON-NLS-1$
                    currentJar = new Jar(".");
                }
                DiffPluginImpl differ = new DiffPluginImpl();
                String diffignore = builder.getProperty(Constants.DIFFIGNORE);
                if (diffignore != null)
                    differ.setIgnore(diffignore);
                Baseline baseline = new Baseline(builder, differ);
                baseline.baseline(jar, currentJar, null);
                return baseline;
            } finally {
                if (jar != null)
                    jar.close();
                if (currentJar != null)
                    currentJar.close();
            }
        }
    } catch (Exception e1) {
        e1.printStackTrace();
    }
    return null;
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) ProjectBuilder(aQute.bnd.build.ProjectBuilder) Jar(aQute.bnd.osgi.Jar) Baseline(aQute.bnd.differ.Baseline)

Aggregations

Baseline (aQute.bnd.differ.Baseline)27 Info (aQute.bnd.differ.Baseline.Info)15 DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)15 Jar (aQute.bnd.osgi.Jar)15 BundleInfo (aQute.bnd.differ.Baseline.BundleInfo)13 Processor (aQute.bnd.osgi.Processor)11 Builder (aQute.bnd.osgi.Builder)9 Diff (aQute.bnd.service.diff.Diff)6 ArrayList (java.util.ArrayList)5 ProjectBuilder (aQute.bnd.build.ProjectBuilder)4 RepositoryPlugin (aQute.bnd.service.RepositoryPlugin)2 Tree (aQute.bnd.service.diff.Tree)2 Version (aQute.bnd.version.Version)2 ReporterAdapter (aQute.libg.reporter.ReporterAdapter)2 WorkspaceReleaseDialog (bndtools.release.ui.WorkspaceReleaseDialog)2 IOException (java.io.IOException)2 List (java.util.List)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 Project (aQute.bnd.build.Project)1