Search in sources :

Example 6 with ReactorProjectIdentities

use of org.eclipse.tycho.ReactorProjectIdentities in project tycho by eclipse.

the class TargetPlatformFactoryTest method testConfiguredFiltersOnReactorIUsInFinalTP.

@Test
public void testConfiguredFiltersOnReactorIUsInFinalTP() throws Exception {
    TargetPlatformFilter filter = TargetPlatformFilter.removeAllFilter(CapabilityPattern.patternWithoutVersion(CapabilityType.P2_INSTALLABLE_UNIT, "iu.p2.inf"));
    tpConfig.addFilters(Arrays.asList(filter));
    P2TargetPlatform preliminaryTP = subject.createTargetPlatform(tpConfig, NOOP_EE_RESOLUTION_HANDLER, null, null);
    Map<IInstallableUnit, ReactorProjectIdentities> finalUnits = new HashMap<>();
    finalUnits.put(InstallableUnitUtil.createIU("test.feature.feature.group"), DUMMY_PROJECT);
    finalUnits.put(InstallableUnitUtil.createIU("iu.p2.inf"), DUMMY_PROJECT);
    P2TargetPlatform finalTP = subject.createTargetPlatformWithUpdatedReactorUnits(preliminaryTP, finalUnits, REACTOR_ARTIFACTS);
    assertThat(finalTP.getInstallableUnits(), hasItem(unitWithId("test.feature.feature.group")));
    assertThat(finalTP.getInstallableUnits(), not(hasItem(unitWithId("iu.p2.inf"))));
}
Also used : HashMap(java.util.HashMap) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Example 7 with ReactorProjectIdentities

use of org.eclipse.tycho.ReactorProjectIdentities in project tycho by eclipse.

the class TargetPlatformFactoryImpl method extractProjectResultIUs.

private static Map<IInstallableUnit, ReactorProjectIdentities> extractProjectResultIUs(List<PublishingRepository> projectResults) {
    Map<IInstallableUnit, ReactorProjectIdentities> reactorUnits = new LinkedHashMap<>();
    for (PublishingRepository projectResult : projectResults) {
        Set<IInstallableUnit> projectUnits = projectResult.getMetadataRepository().query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet();
        ReactorProjectIdentities project = projectResult.getProjectIdentities();
        for (IInstallableUnit projectUnit : projectUnits) {
            reactorUnits.put(projectUnit, project);
        }
    }
    return reactorUnits;
}
Also used : IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) PublishingRepository(org.eclipse.tycho.repository.publishing.PublishingRepository) LinkedHashMap(java.util.LinkedHashMap)

Example 8 with ReactorProjectIdentities

use of org.eclipse.tycho.ReactorProjectIdentities in project tycho by eclipse.

the class P2ResolverImpl method addUnit.

private void addUnit(DefaultP2ResolutionResult result, IInstallableUnit iu, ReactorProject currentProject, Set<String> missingArtifacts) {
    if (currentProjectUnits.contains(iu)) {
        addReactorProject(result, currentProject.getIdentities(), iu);
        return;
    }
    ReactorProjectIdentities otherProject = context.getOriginalReactorProjectMap().get(iu);
    if (otherProject != null) {
        addReactorProject(result, otherProject, iu);
        return;
    }
    IArtifactFacade mavenArtifact = context.getOriginalMavenArtifactMap().get(iu);
    if (mavenArtifact != null) {
        addExternalMavenArtifact(result, mavenArtifact, iu);
        return;
    }
    for (IArtifactKey key : iu.getArtifacts()) {
        // this downloads artifacts if necessary; TODO parallelize download?
        File artifactLocation = context.getLocalArtifactFile(key);
        if (artifactLocation == null) {
            missingArtifacts.add(key.toString());
        } else {
            addArtifactFile(result, iu, key, artifactLocation);
        }
    }
}
Also used : IArtifactFacade(org.eclipse.tycho.p2.metadata.IArtifactFacade) IArtifactKey(org.eclipse.equinox.p2.metadata.IArtifactKey) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) File(java.io.File)

Example 9 with ReactorProjectIdentities

use of org.eclipse.tycho.ReactorProjectIdentities in project tycho by eclipse.

the class MirrorApplicationServiceTest method initTestContext.

@Before
public void initTestContext() throws Exception {
    destinationRepo = new DestinationRepositoryDescriptor(tempFolder.newFolder("dest"), DEFAULT_NAME);
    File projectFolder = tempFolder.getRoot();
    ReactorProjectIdentities currentProject = new ReactorProjectIdentitiesStub(projectFolder);
    context = new BuildContext(currentProject, DEFAULT_QUALIFIER, DEFAULT_ENVIRONMENTS);
    subject = new MirrorApplicationServiceImpl();
    MavenContext mavenContext = new MavenContextImpl(null, logVerifier.getLogger());
    subject.setMavenContext(mavenContext);
}
Also used : MavenContextImpl(org.eclipse.tycho.core.shared.MavenContextImpl) BuildContext(org.eclipse.tycho.p2.tools.BuildContext) MavenContext(org.eclipse.tycho.core.shared.MavenContext) ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) File(java.io.File) DestinationRepositoryDescriptor(org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor) Before(org.junit.Before)

Aggregations

ReactorProjectIdentities (org.eclipse.tycho.ReactorProjectIdentities)9 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)6 File (java.io.File)3 ReactorProject (org.eclipse.tycho.ReactorProject)3 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 TargetPlatformFilter (org.eclipse.tycho.artifacts.TargetPlatformFilter)2 MavenRepositoryLocation (org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)2 ReactorRepositoryManagerFacade (org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManagerFacade)2 ReactorProjectIdentitiesStub (org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub)2 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 IArtifactKey (org.eclipse.equinox.p2.metadata.IArtifactKey)1 ExecutionEnvironmentConfigurationStub (org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub)1 MavenContext (org.eclipse.tycho.core.shared.MavenContext)1 MavenContextImpl (org.eclipse.tycho.core.shared.MavenContextImpl)1 ReactorProjectStub (org.eclipse.tycho.p2.impl.test.ReactorProjectStub)1 IArtifactFacade (org.eclipse.tycho.p2.metadata.IArtifactFacade)1