Search in sources :

Example 1 with ExecutionEnvironmentConfigurationStub

use of org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub in project tycho by eclipse.

the class ReactorRepositoryManagerTest method testTargetPlatformComputationInIntegration.

@Test
public void testTargetPlatformComputationInIntegration() throws Exception {
    subject = getService(ReactorRepositoryManagerFacade.class);
    ReactorProject currentProject = new ReactorProjectStub("reactor-artifact");
    TargetPlatformConfigurationStub tpConfig = new TargetPlatformConfigurationStub();
    tpConfig.addP2Repository(new MavenRepositoryLocation(null, ResourceUtil.resourceFile("repositories/launchers").toURI()));
    subject.computePreliminaryTargetPlatform(currentProject, tpConfig, new ExecutionEnvironmentConfigurationStub("JavaSE-1.7"), null, null);
    ReactorProjectIdentities upstreamProject = new ReactorProjectIdentitiesStub(ResourceUtil.resourceFile("projectresult"));
    subject.computeFinalTargetPlatform(currentProject, Arrays.asList(upstreamProject));
    P2TargetPlatform finalTP = (P2TargetPlatform) currentProject.getContextValue("org.eclipse.tycho.core.TychoConstants/targetPlatform");
    Collection<IInstallableUnit> units = finalTP.getInstallableUnits();
    // units from the p2 repository
    assertThat(units, hasItem(unitWithId("org.eclipse.equinox.launcher")));
    // units from the upstream project
    assertThat(units, hasItem(unitWithId("bundle")));
    assertThat(units, hasItem(unitWithId("bundle.source")));
// TODO get artifact
}
Also used : ReactorRepositoryManagerFacade(org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManagerFacade) TargetPlatformConfigurationStub(org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub) ExecutionEnvironmentConfigurationStub(org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub) MavenRepositoryLocation(org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation) ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) ReactorProject(org.eclipse.tycho.ReactorProject) ReactorProjectStub(org.eclipse.tycho.p2.impl.test.ReactorProjectStub) P2TargetPlatform(org.eclipse.tycho.p2.target.P2TargetPlatform) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) Test(org.junit.Test)

Example 2 with ExecutionEnvironmentConfigurationStub

use of org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub in project tycho by eclipse.

the class P2ResolverImpl method resolveMetadata.

@Override
public P2ResolutionResult resolveMetadata(TargetPlatformConfigurationStub tpConfiguration, String eeName) {
    P2TargetPlatform contextImpl = targetPlatformFactory.createTargetPlatform(tpConfiguration, new ExecutionEnvironmentConfigurationStub(eeName), null, null);
    ResolutionDataImpl data = new ResolutionDataImpl(contextImpl.getEEResolutionHints());
    data.setAvailableIUs(contextImpl.getInstallableUnits());
    data.setRootIUs(new HashSet<IInstallableUnit>());
    data.setAdditionalRequirements(additionalRequirements);
    ProjectorResolutionStrategy strategy = new ProjectorResolutionStrategy(logger);
    strategy.setData(data);
    MetadataOnlyP2ResolutionResult result = new MetadataOnlyP2ResolutionResult();
    try {
        for (IInstallableUnit iu : strategy.multiPlatformResolve(environments, monitor)) {
            result.addArtifact(ArtifactType.TYPE_INSTALLABLE_UNIT, iu.getId(), iu.getVersion().toString(), iu);
        }
    } catch (ResolverException e) {
        logger.error("Resolution failed:");
        new MultiLineLogger(logger).error(e.getDetails(), "  ");
        throw new RuntimeException(e);
    }
    return result;
}
Also used : ExecutionEnvironmentConfigurationStub(org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub) ResolverException(org.eclipse.tycho.p2.util.resolution.ResolverException) ResolutionDataImpl(org.eclipse.tycho.p2.util.resolution.ResolutionDataImpl) P2TargetPlatform(org.eclipse.tycho.p2.target.P2TargetPlatform) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ProjectorResolutionStrategy(org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy) MultiLineLogger(org.eclipse.tycho.core.shared.MultiLineLogger)

Example 3 with ExecutionEnvironmentConfigurationStub

use of org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub in project tycho by eclipse.

the class P2ResolverImpl method getTargetPlatformAsResolutionResult.

// TODO 412416 make this obsolete by adding appropriate getters in TargetPlatform interface
@Override
public P2ResolutionResult getTargetPlatformAsResolutionResult(TargetPlatformConfigurationStub tpConfiguration, String eeName) {
    P2TargetPlatform targetPlatform = targetPlatformFactory.createTargetPlatform(tpConfiguration, new ExecutionEnvironmentConfigurationStub(eeName), null, null);
    MetadataOnlyP2ResolutionResult result = new MetadataOnlyP2ResolutionResult();
    for (IInstallableUnit iu : targetPlatform.getInstallableUnits()) {
        result.addArtifact(ArtifactType.TYPE_INSTALLABLE_UNIT, iu.getId(), iu.getVersion().toString(), iu);
    }
    return result;
}
Also used : ExecutionEnvironmentConfigurationStub(org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub) P2TargetPlatform(org.eclipse.tycho.p2.target.P2TargetPlatform) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit)

Aggregations

IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)3 ExecutionEnvironmentConfigurationStub (org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub)3 P2TargetPlatform (org.eclipse.tycho.p2.target.P2TargetPlatform)3 ReactorProject (org.eclipse.tycho.ReactorProject)1 ReactorProjectIdentities (org.eclipse.tycho.ReactorProjectIdentities)1 MavenRepositoryLocation (org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)1 MultiLineLogger (org.eclipse.tycho.core.shared.MultiLineLogger)1 ReactorProjectStub (org.eclipse.tycho.p2.impl.test.ReactorProjectStub)1 TargetPlatformConfigurationStub (org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub)1 ProjectorResolutionStrategy (org.eclipse.tycho.p2.util.resolution.ProjectorResolutionStrategy)1 ResolutionDataImpl (org.eclipse.tycho.p2.util.resolution.ResolutionDataImpl)1 ResolverException (org.eclipse.tycho.p2.util.resolution.ResolverException)1 ReactorRepositoryManagerFacade (org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManagerFacade)1 ReactorProjectIdentitiesStub (org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub)1 Test (org.junit.Test)1