use of org.eclipse.tycho.p2.util.resolution.ResolverException 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;
}
use of org.eclipse.tycho.p2.util.resolution.ResolverException 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);
}
use of org.eclipse.tycho.p2.util.resolution.ResolverException in project tycho by eclipse.
the class TargetDefinitionResolver method resolveContentWithExceptions.
TargetDefinitionContent resolveContentWithExceptions(TargetDefinition definition) throws TargetDefinitionSyntaxException, TargetDefinitionResolutionException, ResolverException {
List<URI> artifactRepositories = new ArrayList<>();
ResolverRun resolverRun = new ResolverRun();
for (Location locationDefinition : definition.getLocations()) {
if (locationDefinition instanceof InstallableUnitLocation) {
resolverRun.addLocation((InstallableUnitLocation) locationDefinition);
for (Repository repository : ((InstallableUnitLocation) locationDefinition).getRepositories()) {
artifactRepositories.add(repository.getLocation());
}
} else {
logger.warn("Target location type '" + locationDefinition.getTypeDescription() + "' is not supported");
}
}
if (definition.hasIncludedBundles()) {
// the bundle selection list is currently not taken into account (see bug 373776)
logger.warn("De-selecting bundles in a target definition file is not supported. See http://wiki.eclipse.org/Tycho_Messages_Explained#Target_File_Include_Bundles for alternatives.");
}
return new TargetDefinitionContent(resolverRun.resolve(), artifactRepositories);
}
Aggregations