Search in sources :

Example 16 with InstallableUnitDescription

use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.

the class StandardEEResolutionHints method newIU.

private static IInstallableUnit newIU(String id, Version version) {
    InstallableUnitDescription iud = new InstallableUnitDescription();
    iud.setId(id);
    iud.setVersion(version);
    iud.addProvidedCapabilities(Collections.singleton(MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, id, version)));
    return MetadataFactory.createInstallableUnit(iud);
}
Also used : InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)

Example 17 with InstallableUnitDescription

use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.

the class AbstractSlicerResolutionStrategy method createUnitRequiring.

protected static IInstallableUnit createUnitRequiring(String name, Collection<IInstallableUnit> units, Collection<IRequirement> additionalRequirements) {
    InstallableUnitDescription result = new MetadataFactory.InstallableUnitDescription();
    String time = Long.toString(System.currentTimeMillis());
    result.setId(name + "-" + time);
    result.setVersion(Version.createOSGi(0, 0, 0, time));
    ArrayList<IRequirement> requirements = new ArrayList<>();
    if (units != null) {
        for (IInstallableUnit unit : units) {
            requirements.add(createStrictRequirementTo(unit));
        }
    }
    if (additionalRequirements != null) {
        requirements.addAll(additionalRequirements);
    }
    result.addRequirements(requirements);
    return MetadataFactory.createInstallableUnit(result);
}
Also used : IRequirement(org.eclipse.equinox.p2.metadata.IRequirement) InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription) ArrayList(java.util.ArrayList) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ResolverDebugUtils.toDebugString(org.eclipse.tycho.p2.util.resolution.ResolverDebugUtils.toDebugString)

Example 18 with InstallableUnitDescription

use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.

the class InstallableUnitUtil method createIUArtifact.

public static IInstallableUnit createIUArtifact(String id, String version, String artifactId, String artifactVersion) {
    InstallableUnitDescription description = createIuDescription(id, version);
    description.setArtifacts(new IArtifactKey[] { new ArtifactKey("type", artifactId, Version.create(artifactVersion)) });
    return MetadataFactory.createInstallableUnit(description);
}
Also used : InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription) ArtifactKey(org.eclipse.equinox.internal.p2.metadata.ArtifactKey) IArtifactKey(org.eclipse.equinox.p2.metadata.IArtifactKey)

Example 19 with InstallableUnitDescription

use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription 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);
}
Also used : InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)

Example 20 with InstallableUnitDescription

use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.

the class InstallableUnitUtil method createIuDescription.

private static InstallableUnitDescription createIuDescription(String id, String version) {
    InstallableUnitDescription description = new InstallableUnitDescription();
    description.setId(id);
    description.setVersion(Version.create(version));
    description.addProvidedCapabilities(createProvidedCapability(IU_CAPABILITY_NS, id, version));
    return description;
}
Also used : InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)

Aggregations

InstallableUnitDescription (org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)19 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)9 ArrayList (java.util.ArrayList)6 File (java.io.File)4 IProvidedCapability (org.eclipse.equinox.p2.metadata.IProvidedCapability)4 IRequirement (org.eclipse.equinox.p2.metadata.IRequirement)4 Test (org.junit.Test)3 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 LinkedHashSet (java.util.LinkedHashSet)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 ArtifactKey (org.eclipse.equinox.internal.p2.metadata.ArtifactKey)2 IArtifactKey (org.eclipse.equinox.p2.metadata.IArtifactKey)2 Version (org.eclipse.equinox.p2.metadata.Version)2 VersionRange (org.eclipse.equinox.p2.metadata.VersionRange)2 BufferedInputStream (java.io.BufferedInputStream)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1