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;
}
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);
}
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;
}
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();
}
Aggregations