Search in sources :

Example 1 with DestinationRepositoryDescriptor

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

the class MirrorApplicationServiceImpl method mirrorStandalone.

@Override
public void mirrorStandalone(RepositoryReferences sources, DestinationRepositoryDescriptor destination, Collection<IUDescription> seedIUs, MirrorOptions mirrorOptions, BuildOutputDirectory tempDirectory) throws FacadeException {
    IProvisioningAgent agent = Activator.createProvisioningAgent(tempDirectory);
    try {
        final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, agent, mirrorOptions.isIncludePacked());
        mirrorApp.setSlicingOptions(createSlicingOptions(mirrorOptions));
        mirrorApp.setIgnoreErrors(mirrorOptions.isIgnoreErrors());
        try {
            // we want to see mirror progress as this is a possibly long-running operation
            mirrorApp.setVerbose(true);
            mirrorApp.setLog(new LogListener(mavenContext.getLogger()));
            mirrorApp.setSourceIUs(querySourceIus(seedIUs, mirrorApp.getCompositeMetadataRepository(), sources));
            IStatus returnStatus = mirrorApp.run(null);
            checkStatus(returnStatus, mirrorOptions.isIgnoreErrors());
        } catch (ProvisionException e) {
            throw new FacadeException(MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e);
        }
    } finally {
        agent.stop();
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) IStatus(org.eclipse.core.runtime.IStatus) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) IProvisioningAgent(org.eclipse.equinox.p2.core.IProvisioningAgent)

Example 2 with DestinationRepositoryDescriptor

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

the class MirrorApplicationServiceImpl method createMirrorApplication.

private static MirrorApplication createMirrorApplication(RepositoryReferences sources, DestinationRepositoryDescriptor destination, IProvisioningAgent agent, boolean includePacked) {
    final MirrorApplication mirrorApp = new MirrorApplication(agent, includePacked);
    List<RepositoryDescriptor> sourceDescriptors = createSourceDescriptors(sources);
    for (RepositoryDescriptor sourceDescriptor : sourceDescriptors) {
        mirrorApp.addSource(sourceDescriptor);
    }
    mirrorApp.addDestination(createDestinationDescriptor(destination));
    return mirrorApp;
}
Also used : DestinationRepositoryDescriptor(org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor) RepositoryDescriptor(org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor)

Example 3 with DestinationRepositoryDescriptor

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

the class MirrorApplicationServiceImpl method createDestinationDescriptor.

private static RepositoryDescriptor createDestinationDescriptor(DestinationRepositoryDescriptor destination) {
    final RepositoryDescriptor destinationDescriptor = new RepositoryDescriptor();
    destinationDescriptor.setLocation(destination.getLocation().toURI());
    destinationDescriptor.setAppend(destination.isAppend());
    destinationDescriptor.setName(destination.getName());
    destinationDescriptor.setCompressed(destination.isCompress());
    if (destination.isMetaDataOnly()) {
        // only mirror metadata
        destinationDescriptor.setKind(RepositoryDescriptor.KIND_METADATA);
    } else {
    // metadata and artifacts is the default
    }
    return destinationDescriptor;
}
Also used : DestinationRepositoryDescriptor(org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor) RepositoryDescriptor(org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor)

Example 4 with DestinationRepositoryDescriptor

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

the class MirrorApplicationServiceImpl method recreateArtifactRepository.

private void recreateArtifactRepository(DestinationRepositoryDescriptor destination) throws FacadeException {
    // create the missing md5 checksums
    if (destination.isMetaDataOnly()) {
        return;
    }
    RepositoryDescriptor descriptor = new RepositoryDescriptor();
    descriptor.setAppend(true);
    descriptor.setFormat(null);
    // $NON-NLS-1$
    descriptor.setKind("artifact");
    descriptor.setLocation(destination.getLocation().toURI());
    RecreateRepositoryApplication application = new RecreateRepositoryApplication();
    application.setArtifactRepository(descriptor);
    try {
        application.run(new NullProgressMonitor());
    } catch (ProvisionException e) {
        throw new FacadeException("Recreate artifact repository failed", e);
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) DestinationRepositoryDescriptor(org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor) RepositoryDescriptor(org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) RecreateRepositoryApplication(org.eclipse.equinox.p2.internal.repository.tools.RecreateRepositoryApplication)

Example 5 with DestinationRepositoryDescriptor

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

the class MirrorApplicationServiceImpl method xzCompress.

private void xzCompress(DestinationRepositoryDescriptor destination) throws FacadeException {
    if (!destination.isXZCompress()) {
        return;
    }
    try {
        XZCompressor xzCompressor = new XZCompressor();
        xzCompressor.setPreserveOriginalFile(destination.shouldKeepNonXzIndexFiles());
        xzCompressor.setRepoFolder(destination.getLocation().getAbsolutePath());
        xzCompressor.compressRepo();
    } catch (IOException e) {
        throw new FacadeException("XZ compression failed", e);
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) XZCompressor(org.eclipse.equinox.p2.internal.repository.tools.XZCompressor) IOException(java.io.IOException)

Aggregations

DestinationRepositoryDescriptor (org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor)6 FacadeException (org.eclipse.tycho.p2.tools.FacadeException)5 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)3 RepositoryDescriptor (org.eclipse.equinox.p2.internal.repository.tools.RepositoryDescriptor)3 File (java.io.File)2 IStatus (org.eclipse.core.runtime.IStatus)2 IProvisioningAgent (org.eclipse.equinox.p2.core.IProvisioningAgent)2 MavenContext (org.eclipse.tycho.core.shared.MavenContext)2 MavenContextImpl (org.eclipse.tycho.core.shared.MavenContextImpl)2 Before (org.junit.Before)2 IOException (java.io.IOException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 RecreateRepositoryApplication (org.eclipse.equinox.p2.internal.repository.tools.RecreateRepositoryApplication)1 SlicingOptions (org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions)1 XZCompressor (org.eclipse.equinox.p2.internal.repository.tools.XZCompressor)1 BuildOutputDirectory (org.eclipse.tycho.BuildOutputDirectory)1 ReactorProjectIdentities (org.eclipse.tycho.ReactorProjectIdentities)1 TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)1