Search in sources :

Example 6 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class UTF8PropertiesTest method testEmptySpace.

public void testEmptySpace() throws IOException {
    UTF8Properties p = new UTF8Properties();
    ReporterAdapter ra = new ReporterAdapter();
    p.load("version 1.1\n ", null, ra);
    assertEquals("1.1", p.get("version"));
    assertEquals(1, p.size());
}
Also used : ReporterAdapter(aQute.libg.reporter.ReporterAdapter)

Example 7 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class UTF8PropertiesTest method testPackageinfo.

public void testPackageinfo() throws IOException {
    UTF8Properties p = new UTF8Properties();
    ReporterAdapter ra = new ReporterAdapter();
    p.load("version 1.0.1", null, ra);
    assertEquals("1.0.1", p.get("version"));
    assertEquals(1, p.size());
}
Also used : ReporterAdapter(aQute.libg.reporter.ReporterAdapter)

Example 8 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class HttpClient method setLog.

public void setLog(File log) throws IOException {
    IO.mkdirs(log.getParentFile());
    reporter = new ReporterAdapter(IO.writer(log));
}
Also used : ReporterAdapter(aQute.libg.reporter.ReporterAdapter)

Example 9 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class FileRepo method init.

/**
	 * Initialize the repository Subclasses should first call this method and
	 * then if it returns true, do their own initialization
	 * 
	 * @return true if initialized, false if already had been initialized.
	 * @throws Exception
	 */
protected boolean init() throws Exception {
    if (inited)
        return false;
    inited = true;
    if (reporter == null) {
        ReporterAdapter reporter = trace ? new ReporterAdapter(System.out) : new ReporterAdapter();
        reporter.setTrace(trace);
        reporter.setExceptions(trace);
        this.reporter = reporter;
    }
    logger.debug("init");
    if (!root.isDirectory()) {
        IO.mkdirs(root);
        if (!root.isDirectory())
            throw new IllegalArgumentException("Location cannot be turned into a directory " + root);
        exec(init, root.getAbsolutePath());
    }
    if (hasIndex)
        index = new PersistentMap<ResourceDescriptor>(new File(root, ".index"), ResourceDescriptor.class);
    open();
    return true;
}
Also used : PersistentMap(aQute.lib.persistentmap.PersistentMap) ReporterAdapter(aQute.libg.reporter.ReporterAdapter) File(java.io.File)

Example 10 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class BaselineMojo method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    if (skip) {
        logger.debug("skip project as configured");
        return;
    }
    Artifact artifact = RepositoryUtils.toArtifact(project.getArtifact());
    List<RemoteRepository> aetherRepos = getRepositories(artifact);
    setupBase(artifact);
    try {
        if (base.getVersion() == null || base.getVersion().isEmpty()) {
            searchForBaseVersion(artifact, aetherRepos);
        }
        if (base.getVersion() != null && !base.getVersion().isEmpty()) {
            ArtifactResult artifactResult = locateBaseJar(aetherRepos);
            Reporter reporter;
            if (fullReport) {
                reporter = new ReporterAdapter(System.out);
                ((ReporterAdapter) reporter).setTrace(true);
            } else {
                reporter = new ReporterAdapter();
            }
            Baseline baseline = new Baseline(reporter, new DiffPluginImpl());
            if (checkFailures(artifact, artifactResult, baseline)) {
                if (continueOnError) {
                    logger.warn("The baselining check failed when checking {} against {} but the bnd-baseline-maven-plugin is configured not to fail the build.", artifact, artifactResult.getArtifact());
                } else {
                    throw new MojoExecutionException("The baselining plugin detected versioning errors");
                }
            } else {
                logger.info("Baselining check succeeded checking {} against {}", artifact, artifactResult.getArtifact());
            }
        } else {
            if (failOnMissing) {
                throw new MojoExecutionException("Unable to locate a previous version of the artifact");
            } else {
                logger.warn("No previous version of {} could be found to baseline against", artifact);
            }
        }
    } catch (RepositoryException re) {
        throw new MojoExecutionException("Unable to locate a previous version of the artifact", re);
    } catch (Exception e) {
        throw new MojoExecutionException("An error occurred while calculating the baseline", e);
    }
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ReporterAdapter(aQute.libg.reporter.ReporterAdapter) Reporter(aQute.service.reporter.Reporter) RemoteRepository(org.eclipse.aether.repository.RemoteRepository) RepositoryException(org.eclipse.aether.RepositoryException) Baseline(aQute.bnd.differ.Baseline) DefaultArtifact(org.eclipse.aether.artifact.DefaultArtifact) Artifact(org.eclipse.aether.artifact.Artifact) VersionRangeResolutionException(org.eclipse.aether.resolution.VersionRangeResolutionException) ArtifactResolutionException(org.eclipse.aether.resolution.ArtifactResolutionException) IOException(java.io.IOException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException) RepositoryException(org.eclipse.aether.RepositoryException) ArtifactResult(org.eclipse.aether.resolution.ArtifactResult)

Aggregations

ReporterAdapter (aQute.libg.reporter.ReporterAdapter)15 File (java.io.File)4 Reporter (aQute.service.reporter.Reporter)3 Baseline (aQute.bnd.differ.Baseline)2 DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)2 CommandLine (aQute.lib.getopt.CommandLine)2 Sed (aQute.libg.sed.Sed)2 Method (java.lang.reflect.Method)2 ProjectBuilder (aQute.bnd.build.ProjectBuilder)1 BundleInfo (aQute.bnd.differ.Baseline.BundleInfo)1 Info (aQute.bnd.differ.Baseline.Info)1 Builder (aQute.bnd.osgi.Builder)1 Jar (aQute.bnd.osgi.Jar)1 JVM (aQute.jpm.lib.JVM)1 JustAnotherPackageManager (aQute.jpm.lib.JustAnotherPackageManager)1 Description (aQute.lib.getopt.Description)1 PersistentMap (aQute.lib.persistentmap.PersistentMap)1 Location (aQute.service.reporter.Report.Location)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1