Search in sources :

Example 31 with TargetDefinition

use of org.eclipse.tycho.p2.target.facade.TargetDefinition in project tycho by eclipse.

the class TargetDefinitionResolverIncludeSourceTest method testIncludeSourceWithPlannerMode.

@Test
public void testIncludeSourceWithPlannerMode() throws Exception {
    TargetDefinition definition = definitionWith(new WithSourceLocationStub(IncludeMode.PLANNER, TestRepositories.SOURCES, BUNDLE_WITH_SOURCES));
    TargetDefinitionContent content = subject.resolveContentWithExceptions(definition);
    assertThat(versionedIdsOf(content), hasItem(BUNDLE_WITH_SOURCES));
    assertThat(versionedIdsOf(content), hasItem(SOURCE_BUNDLE));
    assertThat(content.getUnits().size(), is(2));
}
Also used : TargetDefinition(org.eclipse.tycho.p2.target.facade.TargetDefinition) Test(org.junit.Test)

Example 32 with TargetDefinition

use of org.eclipse.tycho.p2.target.facade.TargetDefinition in project tycho by eclipse.

the class TargetDefinitionResolver method resolveContentWithExceptions.

TargetDefinitionContent resolveContentWithExceptions(TargetDefinition definition) throws TargetDefinitionSyntaxException, TargetDefinitionResolutionException, ResolverException {
    List<URI> artifactRepositories = new ArrayList<>();
    ResolverRun resolverRun = new ResolverRun();
    for (Location locationDefinition : definition.getLocations()) {
        if (locationDefinition instanceof InstallableUnitLocation) {
            resolverRun.addLocation((InstallableUnitLocation) locationDefinition);
            for (Repository repository : ((InstallableUnitLocation) locationDefinition).getRepositories()) {
                artifactRepositories.add(repository.getLocation());
            }
        } else {
            logger.warn("Target location type '" + locationDefinition.getTypeDescription() + "' is not supported");
        }
    }
    if (definition.hasIncludedBundles()) {
        // the bundle selection list is currently not taken into account (see bug 373776)
        logger.warn("De-selecting bundles in a target definition file is not supported. See http://wiki.eclipse.org/Tycho_Messages_Explained#Target_File_Include_Bundles for alternatives.");
    }
    return new TargetDefinitionContent(resolverRun.resolve(), artifactRepositories);
}
Also used : IMetadataRepository(org.eclipse.equinox.p2.repository.metadata.IMetadataRepository) Repository(org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository) InstallableUnitLocation(org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation) ArrayList(java.util.ArrayList) URI(java.net.URI) InstallableUnitLocation(org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation) Location(org.eclipse.tycho.p2.target.facade.TargetDefinition.Location)

Aggregations

TargetDefinition (org.eclipse.tycho.p2.target.facade.TargetDefinition)31 Test (org.junit.Test)30 ArrayList (java.util.ArrayList)2 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 InstallableUnitLocation (org.eclipse.tycho.p2.target.facade.TargetDefinition.InstallableUnitLocation)2 Location (org.eclipse.tycho.p2.target.facade.TargetDefinition.Location)2 URI (java.net.URI)1 IMetadataRepository (org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)1 Repository (org.eclipse.tycho.p2.target.facade.TargetDefinition.Repository)1