Search in sources :

Example 6 with DestinationRepositoryDescriptor

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

the class MirrorApplicationServiceImpl method mirrorReactor.

@Override
public void mirrorReactor(RepositoryReferences sources, DestinationRepositoryDescriptor destination, Collection<DependencySeed> projectSeeds, BuildContext context, boolean includeAllDependencies, boolean includePacked, Map<String, String> filterProperties) throws FacadeException {
    IProvisioningAgent agent = Activator.createProvisioningAgent(context.getTargetDirectory());
    try {
        final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, agent, includePacked);
        // mirror scope: seed units...
        mirrorApp.setSourceIUs(toInstallableUnitList(projectSeeds, mirrorApp.getCompositeMetadataRepository(), sources));
        // TODO the p2 mirror tool should support mirroring multiple environments at once
        for (TargetEnvironment environment : context.getEnvironments()) {
            SlicingOptions options = new SlicingOptions();
            options.considerStrictDependencyOnly(!includeAllDependencies);
            Map<String, String> filter = options.getFilter();
            addFilterForFeatureJARs(filter);
            if (filterProperties != null) {
                filter.putAll(filterProperties);
            }
            filter.putAll(environment.toFilterProperties());
            mirrorApp.setSlicingOptions(options);
            try {
                LogListener logListener = new LogListener(mavenContext.getLogger());
                mirrorApp.setLog(logListener);
                IStatus returnStatus = mirrorApp.run(null);
                checkStatus(returnStatus, false);
                logListener.showHelpForLoggedMessages();
            } catch (ProvisionException e) {
                throw new FacadeException(MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e);
            }
        }
        recreateArtifactRepository(destination);
        xzCompress(destination);
    } 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) SlicingOptions(org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions) IProvisioningAgent(org.eclipse.equinox.p2.core.IProvisioningAgent) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment)

Example 7 with DestinationRepositoryDescriptor

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

the class MirrorApplicationServiceTest method initTestContext.

@Before
public void initTestContext() throws Exception {
    destinationRepo = new DestinationRepositoryDescriptor(tempFolder.newFolder("dest"), DEFAULT_NAME);
    File projectFolder = tempFolder.getRoot();
    ReactorProjectIdentities currentProject = new ReactorProjectIdentitiesStub(projectFolder);
    context = new BuildContext(currentProject, DEFAULT_QUALIFIER, DEFAULT_ENVIRONMENTS);
    subject = new MirrorApplicationServiceImpl();
    MavenContext mavenContext = new MavenContextImpl(null, logVerifier.getLogger());
    subject.setMavenContext(mavenContext);
}
Also used : MavenContextImpl(org.eclipse.tycho.core.shared.MavenContextImpl) BuildContext(org.eclipse.tycho.p2.tools.BuildContext) MavenContext(org.eclipse.tycho.core.shared.MavenContext) ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) File(java.io.File) DestinationRepositoryDescriptor(org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor) Before(org.junit.Before)

Example 8 with DestinationRepositoryDescriptor

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

the class MirrorStandaloneTest method initTestContext.

@Before
public void initTestContext() throws Exception {
    destinationRepo = new DestinationRepositoryDescriptor(tempFolder.newFolder("dest"), DEFAULT_NAME);
    subject = new MirrorApplicationServiceImpl();
    MavenContext mavenContext = new MavenContextImpl(null, logVerifier.getLogger());
    subject.setMavenContext(mavenContext);
    targetFolder = new BuildOutputDirectory(tempFolder.getRoot());
}
Also used : MavenContextImpl(org.eclipse.tycho.core.shared.MavenContextImpl) MavenContext(org.eclipse.tycho.core.shared.MavenContext) BuildOutputDirectory(org.eclipse.tycho.BuildOutputDirectory) DestinationRepositoryDescriptor(org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor) Before(org.junit.Before)

Example 9 with DestinationRepositoryDescriptor

use of org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor 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

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