use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class TargetPlatformBundlePublisherTest method testPomDependencyOnOtherType.
@Test
public void testPomDependencyOnOtherType() throws Exception {
File otherFile = resourceFile("platformbuilder/pom-dependencies/other-type.xml");
IArtifactFacade otherArtifact = new ArtifactMock(otherFile, GROUP_ID, ARTIFACT_ID, VERSION, "pom");
IInstallableUnit unit = subject.attemptToPublishBundle(otherArtifact);
assertNull(unit);
}
use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class TargetPlatformFactoryTest method testOtherVersionsOfReactorIUsAreFilteredFromExternalContent.
@Test
public void testOtherVersionsOfReactorIUsAreFilteredFromExternalContent() throws Exception {
// contains trt.bundle/1.0.0.201108051343
tpConfig.addP2Repository(ResourceUtil.resourceFile("targetresolver/v1_content").toURI());
// reactor artifact produces a unit with same ID
ReactorProject reactorProject = createReactorProject("artifactId", "trt.bundle/1.5.5.qualifier", null);
P2TargetPlatform preliminaryTP = subject.createTargetPlatform(tpConfig, NOOP_EE_RESOLUTION_HANDLER, Collections.singletonList(reactorProject), null);
assertThat(preliminaryTP.getInstallableUnits(), hasItem(unit("trt.bundle", "1.5.5.qualifier")));
assertThat(preliminaryTP.getInstallableUnits(), not(hasItem(unit("trt.bundle", "1.0.0.201108051343"))));
Map<IInstallableUnit, ReactorProjectIdentities> finalUnits = Collections.singletonMap(InstallableUnitUtil.createIU("trt.bundle", "1.5.5.20140216"), reactorProject.getIdentities());
P2TargetPlatform finalTP = subject.createTargetPlatformWithUpdatedReactorUnits(preliminaryTP, finalUnits, REACTOR_ARTIFACTS);
assertThat(finalTP.getInstallableUnits(), hasItem(unit("trt.bundle", "1.5.5.20140216")));
assertThat(finalTP.getInstallableUnits(), not(hasItem(unit("trt.bundle", "1.0.0.201108051343"))));
}
use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class TargetPlatformFilterEvaluator method getPackageCapabilities.
private List<IProvidedCapability> getPackageCapabilities(IInstallableUnit unit) {
Collection<IProvidedCapability> allCapabilities = unit.getProvidedCapabilities();
List<IProvidedCapability> packageCapabilities = new ArrayList<>(allCapabilities.size());
for (IProvidedCapability capability : allCapabilities) {
if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(capability.getNamespace())) {
packageCapabilities.add(capability);
}
}
return packageCapabilities;
}
use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class AbstractSlicerResolutionStrategy method createStrictRequirementTo.
private static IRequirement createStrictRequirementTo(IInstallableUnit unit) {
VersionRange strictRange = new VersionRange(unit.getVersion(), true, unit.getVersion(), true);
int min = 1;
int max = Integer.MAX_VALUE;
boolean greedy = true;
IRequirement requirement = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, unit.getId(), strictRange, unit.getFilter(), min, max, greedy);
return requirement;
}
use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class DependencyCollector method resolve.
@Override
public Collection<IInstallableUnit> resolve(Map<String, String> properties, IProgressMonitor monitor) {
Set<IInstallableUnit> result = new LinkedHashSet<>();
LinkedHashSet<IStatus> errors = new LinkedHashSet<>();
if (logger.isExtendedDebugEnabled()) {
logger.debug("Available IUs:\n" + ResolverDebugUtils.toDebugString(data.getAvailableIUs(), false));
logger.debug("Root IUs:\n" + ResolverDebugUtils.toDebugString(data.getRootIUs(), true));
}
result.addAll(data.getRootIUs());
QueryableCollection availableUIsQueryable = new QueryableCollection(data.getAvailableIUs());
for (IInstallableUnit iu : data.getRootIUs()) {
collectIncludedIUs(availableUIsQueryable, result, errors, iu, true, monitor);
}
if (logger.isExtendedDebugEnabled()) {
logger.debug("Collected IUs:\n" + ResolverDebugUtils.toDebugString(result, false));
}
if (!errors.isEmpty()) {
MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, 0, errors.toArray(new IStatus[errors.size()]), "Missing dependencies", null);
throw new RuntimeException(status.toString(), new ProvisionException(status));
}
return result;
}
Aggregations