Search in sources :

Example 1 with ProjectorResolutionStrategy

use of org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy in project tycho by eclipse.

the class P2ResolverImpl method resolveMetadata.

@Override
public P2ResolutionResult resolveMetadata(TargetPlatformConfigurationStub tpConfiguration, String eeName) {
    P2TargetPlatform contextImpl = targetPlatformFactory.createTargetPlatform(tpConfiguration, new ExecutionEnvironmentConfigurationStub(eeName), null, null);
    ResolutionDataImpl data = new ResolutionDataImpl(contextImpl.getEEResolutionHints());
    data.setAvailableIUs(contextImpl.getInstallableUnits());
    data.setRootIUs(new HashSet<IInstallableUnit>());
    data.setAdditionalRequirements(additionalRequirements);
    ProjectorResolutionStrategy strategy = new ProjectorResolutionStrategy(logger);
    strategy.setData(data);
    MetadataOnlyP2ResolutionResult result = new MetadataOnlyP2ResolutionResult();
    try {
        for (IInstallableUnit iu : strategy.multiPlatformResolve(environments, monitor)) {
            result.addArtifact(ArtifactType.TYPE_INSTALLABLE_UNIT, iu.getId(), iu.getVersion().toString(), iu);
        }
    } catch (ResolverException e) {
        logger.error("Resolution failed:");
        new MultiLineLogger(logger).error(e.getDetails(), "  ");
        throw new RuntimeException(e);
    }
    return result;
}
Also used : ExecutionEnvironmentConfigurationStub(org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub) ResolverException(org.eclipse.tycho.p2.util.resolution.ResolverException) ResolutionDataImpl(org.eclipse.tycho.p2.util.resolution.ResolutionDataImpl) P2TargetPlatform(org.eclipse.tycho.p2.target.P2TargetPlatform) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ProjectorResolutionStrategy(org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy) MultiLineLogger(org.eclipse.tycho.core.shared.MultiLineLogger)

Example 2 with ProjectorResolutionStrategy

use of org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy in project tycho by eclipse.

the class P2ResolverImpl method resolveDependencies.

@Override
public List<P2ResolutionResult> resolveDependencies(TargetPlatform targetPlatform, ReactorProject project) {
    setContext(targetPlatform, project);
    if (project != null && PackagingType.TYPE_ECLIPSE_TEST_PLUGIN.equals(project.getPackaging())) {
        addDependenciesForTests();
    }
    ArrayList<P2ResolutionResult> results = new ArrayList<>();
    usedTargetPlatformUnits = new LinkedHashSet<>();
    for (TargetEnvironment environment : environments) {
        results.add(resolveDependencies(project, new ProjectorResolutionStrategy(logger), environment));
    }
    context.reportUsedLocalIUs(usedTargetPlatformUnits);
    usedTargetPlatformUnits = null;
    return results;
}
Also used : ArrayList(java.util.ArrayList) P2ResolutionResult(org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) ProjectorResolutionStrategy(org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy)

Aggregations

ProjectorResolutionStrategy (org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy)2 ArrayList (java.util.ArrayList)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 ExecutionEnvironmentConfigurationStub (org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub)1 MultiLineLogger (org.eclipse.tycho.core.shared.MultiLineLogger)1 TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)1 P2ResolutionResult (org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult)1 P2TargetPlatform (org.eclipse.tycho.p2.target.P2TargetPlatform)1 ResolutionDataImpl (org.eclipse.tycho.p2.util.resolution.ResolutionDataImpl)1 ResolverException (org.eclipse.tycho.p2.util.resolution.ResolverException)1