Search in sources :

Example 11 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class VerifierServiceImpl method verify.

@Override
public boolean verify(URI metadataRepositoryUri, URI artifactRepositoryUri, BuildOutputDirectory tempDirectory) throws FacadeException {
    MavenLogger logger = mavenContext.getLogger();
    logger.debug("Checking metadata from '" + metadataRepositoryUri + "' and artifacts from '" + artifactRepositoryUri + "'");
    IProvisioningAgent agent = Activator.createProvisioningAgent(tempDirectory);
    try {
        try {
            final IMetadataRepository metadata = loadMetadataRepository(metadataRepositoryUri, agent);
            final IArtifactRepository artifactRepository = loadArtifactRepository(artifactRepositoryUri, agent);
            boolean valid = true;
            valid &= verifyReferencedArtifactsExist(metadata, artifactRepository, logger);
            valid &= verifyAllArtifactContent(artifactRepository, logger);
            if (valid) {
                logger.info("The integrity of the metadata repository '" + metadataRepositoryUri + "' and artifact repository '" + artifactRepositoryUri + "' has been verified successfully");
            }
            return valid;
        } catch (ProvisionException e) {
            throw new FacadeException(e);
        }
    } finally {
        agent.stop();
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) MavenLogger(org.eclipse.tycho.core.shared.MavenLogger) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) IProvisioningAgent(org.eclipse.equinox.p2.core.IProvisioningAgent) IArtifactRepository(org.eclipse.equinox.p2.repository.artifact.IArtifactRepository) IMetadataRepository(org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)

Example 12 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class PublishCategoriesMojo method publishContent.

@Override
protected Collection<DependencySeed> publishContent(PublisherServiceFactory publisherServiceFactory) throws MojoExecutionException, MojoFailureException {
    PublisherService publisherService = publisherServiceFactory.createPublisher(getReactorProject(), getEnvironments());
    try {
        List<DependencySeed> categoryIUs = new ArrayList<>();
        for (Category category : getCategories()) {
            final File buildCategoryFile = prepareBuildCategory(category, getBuildDirectory());
            Collection<DependencySeed> ius = publisherService.publishCategories(buildCategoryFile);
            categoryIUs.addAll(ius);
        }
        return categoryIUs;
    } catch (FacadeException e) {
        throw new MojoExecutionException("Exception while publishing categories: " + e.getMessage(), e);
    }
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) FacadeException(org.eclipse.tycho.p2.tools.FacadeException) Category(org.eclipse.tycho.model.Category) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) PublisherService(org.eclipse.tycho.p2.tools.publisher.facade.PublisherService) ArrayList(java.util.ArrayList) File(java.io.File)

Example 13 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class PublishEEProfileMojo method publishContent.

@Override
protected Collection<DependencySeed> publishContent(PublisherServiceFactory publisherServiceFactory) throws MojoExecutionException, MojoFailureException {
    PublisherService publisherService = publisherServiceFactory.createPublisher(getReactorProject(), getEnvironments());
    try {
        Collection<DependencySeed> ius = publisherService.publishEEProfile(profileFile);
        getLog().info("Published profile IUs: " + ius);
        return ius;
    } catch (FacadeException e) {
        throw new MojoExecutionException("Exception while publishing execution environment profile " + profileFile + ": " + e.getMessage(), e);
    }
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) FacadeException(org.eclipse.tycho.p2.tools.FacadeException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) PublisherService(org.eclipse.tycho.p2.tools.publisher.facade.PublisherService)

Example 14 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class AssembleRepositoryMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    try {
        File destination = getAssemblyRepositoryLocation();
        destination.mkdirs();
        copyResources(destination);
        Collection<DependencySeed> projectSeeds = TychoProjectUtils.getDependencySeeds(getProject());
        if (projectSeeds.size() == 0) {
            throw new MojoFailureException("No content specified for p2 repository");
        }
        RepositoryReferences sources = getVisibleRepositories();
        TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(getProject());
        MirrorApplicationService mirrorApp = p2.getService(MirrorApplicationService.class);
        DestinationRepositoryDescriptor destinationRepoDescriptor = new DestinationRepositoryDescriptor(destination, repositoryName, compress, xzCompress, keepNonXzIndexFiles, !createArtifactRepository, true);
        mirrorApp.mirrorReactor(sources, destinationRepoDescriptor, projectSeeds, getBuildContext(), includeAllDependencies, configuration.isIncludePackedArtifacts(), profileProperties);
    } catch (FacadeException e) {
        throw new MojoExecutionException("Could not assemble p2 repository", e);
    }
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) FacadeException(org.eclipse.tycho.p2.tools.FacadeException) RepositoryReferences(org.eclipse.tycho.p2.tools.RepositoryReferences) MirrorApplicationService(org.eclipse.tycho.p2.tools.mirroring.facade.MirrorApplicationService) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException) File(java.io.File) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) DestinationRepositoryDescriptor(org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor)

Aggregations

FacadeException (org.eclipse.tycho.p2.tools.FacadeException)12 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)5 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)4 DependencySeed (org.eclipse.tycho.core.resolver.shared.DependencySeed)4 File (java.io.File)3 ArrayList (java.util.ArrayList)3 IProvisioningAgent (org.eclipse.equinox.p2.core.IProvisioningAgent)3 IUDescription (org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription)3 IOException (java.io.IOException)2 MojoFailureException (org.apache.maven.plugin.MojoFailureException)2 IStatus (org.eclipse.core.runtime.IStatus)2 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 DestinationRepositoryDescriptor (org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor)2 PublisherService (org.eclipse.tycho.p2.tools.publisher.facade.PublisherService)2 FileInputStream (java.io.FileInputStream)1 URI (java.net.URI)1 Properties (java.util.Properties)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IProvisioningAgentProvider (org.eclipse.equinox.p2.core.IProvisioningAgentProvider)1 RecreateRepositoryApplication (org.eclipse.equinox.p2.internal.repository.tools.RecreateRepositoryApplication)1