use of org.eclipse.equinox.internal.p2.director.Slicer in project tycho by eclipse.
the class AbstractSlicerResolutionStrategy method slice.
protected final IQueryable<IInstallableUnit> slice(Map<String, String> properties, IProgressMonitor monitor) throws ResolverException {
if (logger.isExtendedDebugEnabled()) {
logger.debug("Properties: " + properties.toString());
logger.debug("Available IUs:\n" + toDebugString(data.getAvailableIUs(), false));
logger.debug("JRE IUs:\n" + toDebugString(data.getEEResolutionHints().getMandatoryUnits(), false));
logger.debug("Root IUs:\n" + toDebugString(data.getRootIUs(), true));
if (data.getAdditionalRequirements() != null && !data.getAdditionalRequirements().isEmpty()) {
StringBuilder sb = new StringBuilder();
for (IRequirement req : data.getAdditionalRequirements()) {
sb.append(" ").append(req.toString()).append("\n");
}
logger.debug("Extra Requirements:\n" + sb.toString());
}
}
Set<IInstallableUnit> availableIUs = new LinkedHashSet<>(data.getAvailableIUs());
availableIUs.addAll(data.getEEResolutionHints().getTemporaryAdditions());
availableIUs.addAll(data.getEEResolutionHints().getMandatoryUnits());
Set<IInstallableUnit> seedIUs = new LinkedHashSet<>(data.getRootIUs());
if (data.getAdditionalRequirements() != null && !data.getAdditionalRequirements().isEmpty()) {
seedIUs.add(createUnitRequiring("tycho-extra", null, data.getAdditionalRequirements()));
}
// make sure profile UIs are part of the slice
seedIUs.addAll(data.getEEResolutionHints().getMandatoryUnits());
if (!data.getEEResolutionHints().getMandatoryRequires().isEmpty()) {
seedIUs.add(createUnitRequiring("tycho-ee", null, data.getEEResolutionHints().getMandatoryRequires()));
}
Slicer slicer = newSlicer(new QueryableCollection(availableIUs), properties);
IQueryable<IInstallableUnit> slice = slicer.slice(seedIUs.toArray(EMPTY_IU_ARRAY), monitor);
MultiStatus slicerStatus = slicer.getStatus();
if (slice == null || isSlicerError(slicerStatus)) {
throw new ResolverException(StatusTool.toLogMessage(slicerStatus), properties.toString(), StatusTool.findException(slicerStatus));
}
if (logger.isExtendedDebugEnabled()) {
logger.debug("Slice:\n" + ResolverDebugUtils.toDebugString(slice, false, monitor));
}
return slice;
}
Aggregations