Search in sources :

Example 1 with SlicingOptions

use of org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions in project tycho by eclipse.

the class MirrorApplicationServiceImpl method createSlicingOptions.

private static SlicingOptions createSlicingOptions(MirrorOptions mirrorOptions) {
    SlicingOptions slicingOptions = new SlicingOptions();
    slicingOptions.considerStrictDependencyOnly(mirrorOptions.isFollowStrictOnly());
    slicingOptions.everythingGreedy(mirrorOptions.isIncludeNonGreedy());
    slicingOptions.followOnlyFilteredRequirements(mirrorOptions.isFollowOnlyFilteredRequirements());
    slicingOptions.includeOptionalDependencies(mirrorOptions.isIncludeOptional());
    slicingOptions.latestVersionOnly(mirrorOptions.isLatestVersionOnly());
    slicingOptions.setFilter(mirrorOptions.getFilter());
    return slicingOptions;
}
Also used : SlicingOptions(org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions)

Example 2 with SlicingOptions

use of org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions 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)

Aggregations

SlicingOptions (org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions)2 IStatus (org.eclipse.core.runtime.IStatus)1 IProvisioningAgent (org.eclipse.equinox.p2.core.IProvisioningAgent)1 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)1 TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)1 FacadeException (org.eclipse.tycho.p2.tools.FacadeException)1