Search in sources :

Example 31 with IInstallableUnit

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

the class PublisherActionRunner method newPublisherInfo.

private IPublisherInfo newPublisherInfo(IMetadataRepository metadataOutput, IArtifactRepository artifactsOutput) {
    final PublisherInfo publisherInfo = new PublisherInfo();
    publisherInfo.setMetadataRepository(metadataOutput);
    publisherInfo.setArtifactRepository(artifactsOutput);
    publisherInfo.setArtifactOptions(IPublisherInfo.A_INDEX | IPublisherInfo.A_PUBLISH);
    // TODO publishers only need an IQueryable<IInstallableUnit> -> changing this in p2 would simplify things for us
    publisherInfo.setContextMetadataRepository(contextIUs);
    // no (known) publisher action needs context artifact repositories
    setTargetEnvironments(publisherInfo);
    return publisherInfo;
}
Also used : PublisherInfo(org.eclipse.equinox.p2.publisher.PublisherInfo) IPublisherInfo(org.eclipse.equinox.p2.publisher.IPublisherInfo)

Example 32 with IInstallableUnit

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

the class PublisherServiceImpl method publishCategories.

@Override
public Collection<DependencySeed> publishCategories(File categoryDefinition) throws FacadeException, IllegalStateException {
    /*
         * At this point, we expect that the category.xml file does no longer contain any
         * "qualifier" literals; it is expected that they have been replaced before. Nevertheless we
         * pass the build qualifier to the CategoryXMLAction because this positively affects the IDs
         * of the category IUs (see {@link
         * org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction#buildCategoryId(String)}).
         */
    CategoryXMLAction categoryXMLAction = new CategoryXMLAction(categoryDefinition.toURI(), qualifier);
    /*
         * TODO Fix in Eclipse: category publisher should produce root IUs; workaround: the category
         * publisher produces no "inner" IUs, so just return all IUs
         */
    Collection<IInstallableUnit> allIUs = publisherRunner.executeAction(categoryXMLAction, publishingRepository.getMetadataRepository(), publishingRepository.getArtifactRepository());
    // TODO introduce type "eclipse-category"?
    return toSeeds(null, allIUs);
}
Also used : IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) CategoryXMLAction(org.eclipse.equinox.internal.p2.updatesite.CategoryXMLAction)

Example 33 with IInstallableUnit

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

the class PublisherServiceImpl method publishEEProfile.

@Override
public Collection<DependencySeed> publishEEProfile(File profileFile) throws FacadeException {
    validateProfile(profileFile);
    IPublisherAction jreAction = new JREAction(profileFile);
    Collection<IInstallableUnit> allIUs = publisherRunner.executeAction(jreAction, publishingRepository.getMetadataRepository(), publishingRepository.getArtifactRepository());
    return toSeeds(null, allIUs);
}
Also used : IPublisherAction(org.eclipse.equinox.p2.publisher.IPublisherAction) JREAction(org.eclipse.equinox.p2.publisher.actions.JREAction) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit)

Example 34 with IInstallableUnit

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

the class InstallableUnitUtil method createProductIU.

public static IInstallableUnit createProductIU(String productId, String version) {
    InstallableUnitDescription description = createIuDescription(productId, version);
    description.setProperty(PRODUCT_TYPE_PROPERTY, Boolean.toString(true));
    return MetadataFactory.createInstallableUnit(description);
}
Also used : InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)

Example 35 with IInstallableUnit

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

the class InstallableUnitUtil method createIURequirement.

public static IInstallableUnit createIURequirement(String id, String version, String requiredId, String requiredVersionRange) {
    InstallableUnitDescription description = createIuDescription(id, version);
    final IRequirement requiredCapability = createRequirement(requiredId, requiredVersionRange);
    description.addRequirements(Arrays.asList(requiredCapability));
    return MetadataFactory.createInstallableUnit(description);
}
Also used : IRequirement(org.eclipse.equinox.p2.metadata.IRequirement) InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)

Aggregations

IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)153 Test (org.junit.Test)58 ArrayList (java.util.ArrayList)44 File (java.io.File)38 IRequirement (org.eclipse.equinox.p2.metadata.IRequirement)25 HashSet (java.util.HashSet)18 IStatus (org.eclipse.core.runtime.IStatus)18 InstallableUnitDescription (org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)16 IMetadataRepository (org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)15 HashMap (java.util.HashMap)13 LinkedHashSet (java.util.LinkedHashSet)11 CoreException (org.eclipse.core.runtime.CoreException)11 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)11 ResourceUtil.resourceFile (org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile)11 URI (java.net.URI)10 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)9 SubMonitor (org.eclipse.core.runtime.SubMonitor)9 ArtifactMock (org.eclipse.tycho.p2.impl.test.ArtifactMock)9 Status (org.eclipse.core.runtime.Status)8 IRequiredCapability (org.eclipse.equinox.internal.p2.metadata.IRequiredCapability)8