Search in sources :

Example 6 with ProjectBuilder

use of aQute.bnd.build.ProjectBuilder 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

ProjectBuilder (aQute.bnd.build.ProjectBuilder)6 Project (aQute.bnd.build.Project)5 Jar (aQute.bnd.osgi.Jar)4 DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)2 Builder (aQute.bnd.osgi.Builder)2 File (java.io.File)2 Workspace (aQute.bnd.build.Workspace)1 Baseline (aQute.bnd.differ.Baseline)1 Attrs (aQute.bnd.header.Attrs)1 RepositoryPlugin (aQute.bnd.service.RepositoryPlugin)1 Version (aQute.bnd.version.Version)1 Description (aQute.lib.getopt.Description)1 JarFile (java.util.jar.JarFile)1 Matchers.anyString (org.mockito.Matchers.anyString)1