Search in sources :

Example 1 with Publisher

use of org.eclipse.equinox.p2.publisher.Publisher 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 2 with Publisher

use of org.eclipse.equinox.p2.publisher.Publisher 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 3 with Publisher

use of org.eclipse.equinox.p2.publisher.Publisher in project tycho by eclipse.

the class AbstractMetadataGenerator method publish.

private DependencyMetadata publish(PublisherInfo publisherInfo, List<IPublisherAction> actions) {
    PublisherResult result = new PublisherResult();
    Publisher publisher = new Publisher(publisherInfo, result);
    IStatus status = publisher.publish(actions.toArray(new IPublisherAction[actions.size()]), monitor);
    if (!status.isOK()) {
        throw new RuntimeException(StatusTool.collectProblems(status), status.getException());
    }
    DependencyMetadata metadata = new DependencyMetadata();
    metadata.setMetadata(true, result.getIUs(null, PublisherResult.ROOT));
    metadata.setMetadata(false, result.getIUs(null, PublisherResult.NON_ROOT));
    IArtifactRepository artifactRepository = publisherInfo.getArtifactRepository();
    if (artifactRepository instanceof TransientArtifactRepository) {
        metadata.setArtifacts(((TransientArtifactRepository) artifactRepository).getArtifactDescriptors());
    }
    return metadata;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IPublisherAction(org.eclipse.equinox.p2.publisher.IPublisherAction) PublisherResult(org.eclipse.equinox.p2.publisher.PublisherResult) IArtifactRepository(org.eclipse.equinox.p2.repository.artifact.IArtifactRepository) Publisher(org.eclipse.equinox.p2.publisher.Publisher) TransientArtifactRepository(org.eclipse.tycho.p2.impl.publisher.repo.TransientArtifactRepository)

Example 4 with Publisher

use of org.eclipse.equinox.p2.publisher.Publisher in project tycho by eclipse.

the class PublisherActionRunner method executeAction.

public Collection<IInstallableUnit> executeAction(IPublisherAction action, IMetadataRepository metadataOutput, IArtifactRepository artifactOutput, IPublisherAdvice... advice) {
    ResultSpyAction resultSpy = new ResultSpyAction();
    IPublisherAction[] actions = new IPublisherAction[] { action, resultSpy };
    /**
     * The PublisherInfo must not be cached, or results may leak between publishing actions (see
     * bug 346532).
     */
    IPublisherInfo publisherInfo = newPublisherInfo(metadataOutput, artifactOutput);
    for (IPublisherAdvice adviceItem : advice) {
        publisherInfo.addAdvice(adviceItem);
    }
    Publisher publisher = new Publisher(publisherInfo);
    IStatus result = publisher.publish(actions, null);
    handlePublisherStatus(result);
    return resultSpy.getAllIUs();
}
Also used : IPublisherAdvice(org.eclipse.equinox.p2.publisher.IPublisherAdvice) IStatus(org.eclipse.core.runtime.IStatus) IPublisherAction(org.eclipse.equinox.p2.publisher.IPublisherAction) Publisher(org.eclipse.equinox.p2.publisher.Publisher) IPublisherInfo(org.eclipse.equinox.p2.publisher.IPublisherInfo)

Aggregations

IStatus (org.eclipse.core.runtime.IStatus)2 IPublisherAction (org.eclipse.equinox.p2.publisher.IPublisherAction)2 IPublisherInfo (org.eclipse.equinox.p2.publisher.IPublisherInfo)2 Publisher (org.eclipse.equinox.p2.publisher.Publisher)2 CategoryXMLAction (org.eclipse.equinox.internal.p2.updatesite.CategoryXMLAction)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 IPublisherAdvice (org.eclipse.equinox.p2.publisher.IPublisherAdvice)1 PublisherInfo (org.eclipse.equinox.p2.publisher.PublisherInfo)1 PublisherResult (org.eclipse.equinox.p2.publisher.PublisherResult)1 IArtifactRepository (org.eclipse.equinox.p2.repository.artifact.IArtifactRepository)1 TransientArtifactRepository (org.eclipse.tycho.p2.impl.publisher.repo.TransientArtifactRepository)1