Search in sources :

Example 1 with DependencyResolutionException

use of org.eclipse.tycho.artifacts.DependencyResolutionException in project tycho by eclipse.

the class P2ResolverImpl method resolveDependencies.

@SuppressWarnings("unchecked")
protected P2ResolutionResult resolveDependencies(ReactorProject project, AbstractResolutionStrategy strategy, TargetEnvironment environment) {
    ResolutionDataImpl data = new ResolutionDataImpl(context.getEEResolutionHints());
    Set<IInstallableUnit> availableUnits = context.getInstallableUnits();
    if (project != null) {
        data.setRootIUs((Set<IInstallableUnit>) project.getDependencyMetadata(true));
        Collection<IInstallableUnit> projectSecondaryIUs = (Collection<IInstallableUnit>) project.getDependencyMetadata(false);
        if (!projectSecondaryIUs.isEmpty()) {
            availableUnits = new LinkedHashSet<>(availableUnits);
            availableUnits.addAll(projectSecondaryIUs);
        }
    } else {
        data.setRootIUs(Collections.<IInstallableUnit>emptySet());
    }
    data.setAdditionalRequirements(additionalRequirements);
    data.setAvailableIUs(availableUnits);
    data.setAdditionalFilterProperties(additionalFilterProperties);
    strategy.setData(data);
    Collection<IInstallableUnit> newState;
    try {
        newState = strategy.resolve(environment, monitor);
    } catch (ResolverException e) {
        logger.info(e.getSelectionContext());
        logger.error("Cannot resolve project dependencies:");
        new MultiLineLogger(logger).error(e.getDetails(), "  ");
        logger.error("");
        logger.error("See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.");
        throw new DependencyResolutionException("Cannot resolve dependencies of " + project, e);
    }
    if (usedTargetPlatformUnits != null) {
        usedTargetPlatformUnits.addAll(newState);
    }
    return toResolutionResult(newState, project);
}
Also used : ResolverException(org.eclipse.tycho.p2.util.resolution.ResolverException) ResolutionDataImpl(org.eclipse.tycho.p2.util.resolution.ResolutionDataImpl) Collection(java.util.Collection) QueryableCollection(org.eclipse.tycho.repository.p2base.metadata.QueryableCollection) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) DependencyResolutionException(org.eclipse.tycho.artifacts.DependencyResolutionException) MultiLineLogger(org.eclipse.tycho.core.shared.MultiLineLogger)

Aggregations

Collection (java.util.Collection)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 DependencyResolutionException (org.eclipse.tycho.artifacts.DependencyResolutionException)1 MultiLineLogger (org.eclipse.tycho.core.shared.MultiLineLogger)1 ResolutionDataImpl (org.eclipse.tycho.p2.util.resolution.ResolutionDataImpl)1 ResolverException (org.eclipse.tycho.p2.util.resolution.ResolverException)1 QueryableCollection (org.eclipse.tycho.repository.p2base.metadata.QueryableCollection)1