Search in sources :

Example 26 with Repository

use of org.eclipse.tycho.p2.resolver.TargetDefinitionFile.Repository in project tycho by eclipse.

the class TargetDefinitionResolver method resolveContentWithExceptions.

TargetDefinitionContent resolveContentWithExceptions(TargetDefinition definition) throws TargetDefinitionSyntaxException, TargetDefinitionResolutionException, ResolverException {
    List<URI> artifactRepositories = new ArrayList<>();
    ResolverRun resolverRun = new ResolverRun();
    for (Location locationDefinition : definition.getLocations()) {
        if (locationDefinition instanceof InstallableUnitLocation) {
            resolverRun.addLocation((InstallableUnitLocation) locationDefinition);
            for (Repository repository : ((InstallableUnitLocation) locationDefinition).getRepositories()) {
                artifactRepositories.add(repository.getLocation());
            }
        } else {
            logger.warn("Target location type '" + locationDefinition.getTypeDescription() + "' is not supported");
        }
    }
    if (definition.hasIncludedBundles()) {
        // the bundle selection list is currently not taken into account (see bug 373776)
        logger.warn("De-selecting bundles in a target definition file is not supported. See http://wiki.eclipse.org/Tycho_Messages_Explained#Target_File_Include_Bundles for alternatives.");
    }
    return new TargetDefinitionContent(resolverRun.resolve(), artifactRepositories);
}
Also used : IMetadataRepository(org.eclipse.equinox.p2.repository.metadata.IMetadataRepository) Repository(org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository) InstallableUnitLocation(org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation) ArrayList(java.util.ArrayList) URI(java.net.URI) InstallableUnitLocation(org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation) Location(org.eclipse.tycho.p2.target.facade.TargetDefinition.Location)

Example 27 with Repository

use of org.eclipse.tycho.p2.resolver.TargetDefinitionFile.Repository 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 28 with Repository

use of org.eclipse.tycho.p2.resolver.TargetDefinitionFile.Repository 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

File (java.io.File)11 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)10 IOException (java.io.IOException)5 URI (java.net.URI)5 ArrayList (java.util.ArrayList)5 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)5 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)5 FacadeException (org.eclipse.tycho.p2.tools.FacadeException)5 Test (org.junit.Test)5 GAV (org.eclipse.tycho.p2.repository.GAV)4 TychoRepositoryIndex (org.eclipse.tycho.p2.repository.TychoRepositoryIndex)4 TargetDefinition (org.eclipse.tycho.p2.target.facade.TargetDefinition)4 FileInputStream (java.io.FileInputStream)3 IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)3 MavenRepositoryLocation (org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)3 DestinationRepositoryDescriptor (org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor)3 RepositoryReferences (org.eclipse.tycho.p2.tools.RepositoryReferences)3 InputStream (java.io.InputStream)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2