Search in sources :

Example 1 with PublishProductTool

use of org.eclipse.tycho.p2.tools.publisher.facade.PublishProductTool in project tycho by eclipse.

the class PublishProductToolTest method initPublisher.

private PublishProductTool initPublisher(IInstallableUnit... tpUnits) {
    LinkedHashSet<IInstallableUnit> contextUnits = new LinkedHashSet<>();
    contextUnits.addAll(Arrays.asList(tpUnits));
    P2TargetPlatform targetPlatform = new FinalTargetPlatformImpl(contextUnits, null, null, null, null, null);
    PublisherActionRunner publisherRunner = new PublisherActionRunner(targetPlatform.getInstallableUnitsAsMetadataRepository(), ENVIRONMENTS, logVerifier.getLogger());
    return new PublishProductToolImpl(publisherRunner, outputRepository, targetPlatform, QUALIFIER, interpolatorMock, logVerifier.getLogger());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) FinalTargetPlatformImpl(org.eclipse.tycho.p2.target.FinalTargetPlatformImpl) P2TargetPlatform(org.eclipse.tycho.p2.target.P2TargetPlatform) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit)

Example 2 with PublishProductTool

use of org.eclipse.tycho.p2.tools.publisher.facade.PublishProductTool in project tycho by eclipse.

the class PublisherServiceFactoryImpl method createProductPublisher.

@Override
public PublishProductTool createProductPublisher(ReactorProject project, List<TargetEnvironment> environments, String buildQualifier, Interpolator interpolator) {
    P2TargetPlatform targetPlatform = (P2TargetPlatform) reactorRepoManager.getFinalTargetPlatform(project);
    PublisherActionRunner publisherRunner = getPublisherRunnerForProject(targetPlatform, environments);
    PublishingRepository publishingRepository = reactorRepoManager.getPublishingRepository(project.getIdentities());
    return new PublishProductToolImpl(publisherRunner, publishingRepository, targetPlatform, buildQualifier, interpolator, mavenContext.getLogger());
}
Also used : P2TargetPlatform(org.eclipse.tycho.p2.target.P2TargetPlatform) PublishingRepository(org.eclipse.tycho.repository.publishing.PublishingRepository)

Example 3 with PublishProductTool

use of org.eclipse.tycho.p2.tools.publisher.facade.PublishProductTool in project tycho by eclipse.

the class PublishProductMojo method publishContent.

@Override
protected Collection<DependencySeed> publishContent(PublisherServiceFactory publisherServiceFactory) throws MojoExecutionException, MojoFailureException {
    Interpolator interpolator = new TychoInterpolator(getSession(), getProject());
    PublishProductTool publisher = publisherServiceFactory.createProductPublisher(getReactorProject(), getEnvironments(), getQualifier(), interpolator);
    List<DependencySeed> seeds = new ArrayList<>();
    for (File productFile : getEclipseRepositoryProject().getProductFiles(getProject())) {
        try {
            ProductConfiguration productConfiguration = ProductConfiguration.read(productFile);
            if (isEmpty(productConfiguration.getId())) {
                throw new MojoExecutionException("The product file " + productFile.getName() + " does not contain the mandatory attribute 'uid'. Please ensure you entered an id in the product file.");
            } else if (isEmpty(productConfiguration.getVersion())) {
                throw new MojoExecutionException("The product file " + productFile.getName() + " does not contain the mandatory attribute 'version'. Please ensure you entered a version in the product file.");
            }
            seeds.addAll(publisher.publishProduct(productFile, productConfiguration.includeLaunchers() ? getExpandedLauncherBinaries() : null, flavor));
        } catch (IOException e) {
            throw new MojoExecutionException("I/O exception while writing product definition or copying launcher icons", e);
        }
    }
    return seeds;
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) PublishProductTool(org.eclipse.tycho.p2.tools.publisher.facade.PublishProductTool) ArrayList(java.util.ArrayList) Interpolator(org.eclipse.tycho.core.shared.Interpolator) TychoInterpolator(org.eclipse.tycho.core.maven.TychoInterpolator) IOException(java.io.IOException) TychoInterpolator(org.eclipse.tycho.core.maven.TychoInterpolator) File(java.io.File)

Aggregations

P2TargetPlatform (org.eclipse.tycho.p2.target.P2TargetPlatform)2 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 TychoInterpolator (org.eclipse.tycho.core.maven.TychoInterpolator)1 DependencySeed (org.eclipse.tycho.core.resolver.shared.DependencySeed)1 Interpolator (org.eclipse.tycho.core.shared.Interpolator)1 ProductConfiguration (org.eclipse.tycho.model.ProductConfiguration)1 FinalTargetPlatformImpl (org.eclipse.tycho.p2.target.FinalTargetPlatformImpl)1 PublishProductTool (org.eclipse.tycho.p2.tools.publisher.facade.PublishProductTool)1 PublishingRepository (org.eclipse.tycho.repository.publishing.PublishingRepository)1