Search in sources :

Example 1 with IPublisherAdvice

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

the class P2GeneratorImpl method getPublisherAdvice.

@Override
protected List<IPublisherAdvice> getPublisherAdvice(IArtifactFacade artifact) {
    ArrayList<IPublisherAdvice> advice = new ArrayList<>();
    advice.add(new MavenPropertiesAdvice(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getClassifier()));
    advice.add(getExtraEntriesAdvice(artifact));
    IFeatureRootAdvice featureRootAdvice = FeatureRootAdvice.createRootFileAdvice(artifact, getBuildPropertiesParser());
    if (featureRootAdvice != null) {
        advice.add(featureRootAdvice);
    }
    return advice;
}
Also used : IPublisherAdvice(org.eclipse.equinox.p2.publisher.IPublisherAdvice) ArrayList(java.util.ArrayList) IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice)

Example 2 with IPublisherAdvice

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

the class PublishProductToolImpl method publishProduct.

@Override
public List<DependencySeed> publishProduct(File productFile, File launcherBinaries, String flavor) throws IllegalArgumentException {
    IProductDescriptor originalProduct = loadProductFile(productFile);
    ExpandedProduct expandedProduct = new ExpandedProduct(originalProduct, buildQualifier, targetPlatform, interpolator, logger);
    IPublisherAdvice[] advice = getProductSpecificAdviceFileAdvice(productFile, expandedProduct);
    ProductAction action = new ProductAction(null, expandedProduct, flavor, launcherBinaries);
    IMetadataRepository metadataRepository = publishingRepository.getMetadataRepository();
    IArtifactRepository artifactRepository = publishingRepository.getArtifactRepositoryForWriting(new ProductBinariesWriteSession(expandedProduct.getId()));
    Collection<IInstallableUnit> allIUs = publisherRunner.executeAction(action, metadataRepository, artifactRepository, advice);
    List<DependencySeed> seeds = new ArrayList<>();
    seeds.add(createSeed(ArtifactType.TYPE_ECLIPSE_PRODUCT, selectUnit(allIUs, expandedProduct.getId())));
    addRootFeatures(expandedProduct, seeds);
    return seeds;
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) IProductDescriptor(org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor) ArrayList(java.util.ArrayList) IArtifactRepository(org.eclipse.equinox.p2.repository.artifact.IArtifactRepository) ProductAction(org.eclipse.equinox.p2.publisher.eclipse.ProductAction) IPublisherAdvice(org.eclipse.equinox.p2.publisher.IPublisherAdvice) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) IMetadataRepository(org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)

Example 3 with IPublisherAdvice

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

IPublisherAdvice (org.eclipse.equinox.p2.publisher.IPublisherAdvice)3 ArrayList (java.util.ArrayList)2 IStatus (org.eclipse.core.runtime.IStatus)1 IProductDescriptor (org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 IPublisherAction (org.eclipse.equinox.p2.publisher.IPublisherAction)1 IPublisherInfo (org.eclipse.equinox.p2.publisher.IPublisherInfo)1 Publisher (org.eclipse.equinox.p2.publisher.Publisher)1 IFeatureRootAdvice (org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice)1 ProductAction (org.eclipse.equinox.p2.publisher.eclipse.ProductAction)1 IArtifactRepository (org.eclipse.equinox.p2.repository.artifact.IArtifactRepository)1 IMetadataRepository (org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)1 DependencySeed (org.eclipse.tycho.core.resolver.shared.DependencySeed)1