use of org.eclipse.equinox.p2.metadata.IProvidedCapability in project tycho by eclipse.
the class AbstractDependenciesAction method perform.
@Override
public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) {
InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
iud.setId(getId());
iud.setVersion(getVersion());
Set<IProvidedCapability> provided = new LinkedHashSet<>();
addProvidedCapabilities(provided);
provided.add(MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, iud.getId(), iud.getVersion()));
iud.addProvidedCapabilities(provided);
iud.addRequirements(getRequiredCapabilities());
addProperties(iud);
addPublisherAdvice(publisherInfo);
processCapabilityAdvice(iud, publisherInfo);
processInstallableUnitPropertiesAdvice(iud, publisherInfo);
IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud);
results.addIU(iu, PublisherResult.ROOT);
InstallableUnitDescription[] others = processAdditionalInstallableUnitsAdvice(iu, publisherInfo);
if (others != null) {
for (InstallableUnitDescription other : others) {
// using PublisherResult.NON_ROOT results in these IUs appear after the primary
// see org.eclipse.equinox.p2.publisher.PublisherResult.getIUs(String, String)
// see org.eclipse.tycho.p2.metadata.IReactorArtifactFacade.getDependencyMetadata()
results.addIU(MetadataFactory.createInstallableUnit(other), PublisherResult.NON_ROOT);
}
}
return Status.OK_STATUS;
}
use of org.eclipse.equinox.p2.metadata.IProvidedCapability in project tycho by eclipse.
the class P2ResolverAdditionalRequirementsTest method createIU.
private static IInstallableUnit createIU(String version) {
InstallableUnitDescription iud = new InstallableUnitDescription();
iud.setId(TARGET_UNIT_ID);
Version osgiVersion = Version.create(version);
iud.setVersion(osgiVersion);
List<IProvidedCapability> list = new ArrayList<>();
list.add(MetadataFactory.createProvidedCapability(IU_NAMESPACE, TARGET_UNIT_ID, osgiVersion));
list.add(MetadataFactory.createProvidedCapability(BUNDLE_NAMESPACE, TARGET_UNIT_ID, osgiVersion));
iud.addProvidedCapabilities(list);
IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud);
return iu;
}
use of org.eclipse.equinox.p2.metadata.IProvidedCapability in project tycho by eclipse.
the class PublisherServiceTest method testProfilePublishing.
@Test
public void testProfilePublishing() throws Exception {
File customProfile = resourceFile("publishers/virgo-1.6.profile");
Collection<DependencySeed> seeds = subject.publishEEProfile(customProfile);
assertThat(seeds.size(), is(2));
IInstallableUnit virgoProfileIU = unitsById(seeds).get("a.jre.virgo");
assertThat(virgoProfileIU, not(nullValue()));
Collection<IProvidedCapability> provided = virgoProfileIU.getProvidedCapabilities();
boolean customJavaxActivationVersionFound = false;
Version version_1_1_1 = Version.create("1.1.1");
for (IProvidedCapability capability : provided) {
if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(capability.getNamespace())) {
if ("javax.activation".equals(capability.getName())) {
if (version_1_1_1.equals(capability.getVersion())) {
customJavaxActivationVersionFound = true;
break;
}
}
}
}
assertTrue("did not find capability for package javax.activation with custom version " + version_1_1_1, customJavaxActivationVersionFound);
assertThat(unitsById(seeds).keySet(), hasItem("config.a.jre.virgo"));
}
use of org.eclipse.equinox.p2.metadata.IProvidedCapability in project tycho by eclipse.
the class InstallableUnitMatchers method hasSelfCapability.
public static Matcher<IInstallableUnit> hasSelfCapability() {
return new TypeSafeMatcher<IInstallableUnit>() {
@Override
public void describeTo(Description description) {
description.appendText("an installable unit providing the self-capability");
}
@Override
protected boolean matchesSafely(IInstallableUnit unit) {
String name = unit.getId();
Version version = unit.getVersion();
for (IProvidedCapability capability : unit.getProvidedCapabilities()) {
if (IU_CAPABILITY_NS.equals(capability.getNamespace()) && name.equals(capability.getName()) && version.equals(capability.getVersion())) {
return true;
}
}
return false;
}
@Override
protected void describeMismatchSafely(IInstallableUnit item, Description mismatchDescription) {
mismatchDescription.appendValue(item).appendText(" has the provided capabilities ").appendValue(item.getProvidedCapabilities());
}
};
}
use of org.eclipse.equinox.p2.metadata.IProvidedCapability in project tycho by eclipse.
the class InstallableUnitUtil method createIUWithCapabilitiesAndFilter.
public static IInstallableUnit createIUWithCapabilitiesAndFilter(String id, String version, Collection<IProvidedCapability> capabilities, String filter) {
InstallableUnitDescription description = createIuDescription(id, version);
description.addProvidedCapabilities(capabilities);
description.setFilter(filter);
return MetadataFactory.createInstallableUnit(description);
}
Aggregations