Search in sources :

Example 1 with AnalyzerPlugin

use of aQute.bnd.service.AnalyzerPlugin in project bnd by bndtools.

the class VerifierPluginTest method testNoVerifierPluginExecution.

public static void testNoVerifierPluginExecution() throws Exception {
    final AtomicBoolean executedCheck = new AtomicBoolean(false);
    AnalyzerPlugin analyzerPlugin = new AnalyzerPlugin() {

        @Override
        public boolean analyzeJar(Analyzer analyzer) throws Exception {
            // The following is null when AnalyzerPlugins execute
            Packages exports = analyzer.getExports();
            if (exports == null) {
                executedCheck.set(true);
            }
            return false;
        }
    };
    try (Builder b = new Builder()) {
        b.setProperty("Bundle-SymbolicName", "p1");
        b.setProperty("Bundle-Version", "1.2.3");
        b.setExportPackage("test.activator");
        b.addClasspath(new File("bin"));
        b.getPlugins().add(analyzerPlugin);
        Jar jar = b.build();
    }
    assertTrue(executedCheck.get());
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Packages(aQute.bnd.osgi.Packages) Builder(aQute.bnd.osgi.Builder) Jar(aQute.bnd.osgi.Jar) Analyzer(aQute.bnd.osgi.Analyzer) AnalyzerPlugin(aQute.bnd.service.AnalyzerPlugin) File(java.io.File)

Example 2 with AnalyzerPlugin

use of aQute.bnd.service.AnalyzerPlugin in project bnd by bndtools.

the class Analyzer method doPlugins.

/**
	 *
	 */
void doPlugins() {
    for (AnalyzerPlugin plugin : getPlugins(AnalyzerPlugin.class)) {
        try {
            boolean reanalyze;
            Processor previous = beginHandleErrors(plugin.toString());
            try {
                reanalyze = plugin.analyzeJar(this);
            } finally {
                endHandleErrors(previous);
            }
            if (reanalyze) {
                classspace.clear();
                analyzeBundleClasspath();
            }
        } catch (Exception e) {
            exception(e, "Analyzer Plugin %s failed %s", plugin, e);
        }
    }
}
Also used : AnalyzerPlugin(aQute.bnd.service.AnalyzerPlugin) ParseException(java.text.ParseException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException)

Aggregations

AnalyzerPlugin (aQute.bnd.service.AnalyzerPlugin)2 Analyzer (aQute.bnd.osgi.Analyzer)1 Builder (aQute.bnd.osgi.Builder)1 Jar (aQute.bnd.osgi.Jar)1 Packages (aQute.bnd.osgi.Packages)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1