Search in sources :

Example 11 with TargetPlatformConfiguration

use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.

the class P2DependencyResolver method computePreliminaryTargetPlatform.

@Override
public TargetPlatform computePreliminaryTargetPlatform(MavenSession session, MavenProject project, List<ReactorProject> reactorProjects) {
    TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(project);
    ExecutionEnvironmentConfiguration ee = TychoProjectUtils.getExecutionEnvironmentConfiguration(project);
    TargetPlatformConfigurationStub tpConfiguration = new TargetPlatformConfigurationStub();
    tpConfiguration.setIncludePackedArtifacts(configuration.isIncludePackedArtifacts());
    PomDependencyCollector pomDependencies = null;
    if (TargetPlatformConfiguration.POM_DEPENDENCIES_CONSIDER.equals(configuration.getPomDependencies())) {
        pomDependencies = collectPomDependencies(project, reactorProjects, session);
    } else {
        // TODO 412416 remove this when the setProjectLocation is no longer needed
        pomDependencies = resolverFactory.newPomDependencyCollector();
        pomDependencies.setProjectLocation(project.getBasedir());
    }
    for (ArtifactRepository repository : project.getRemoteArtifactRepositories()) {
        addEntireP2RepositoryToTargetPlatform(repository, tpConfiguration);
    }
    tpConfiguration.setEnvironments(configuration.getEnvironments());
    for (File file : configuration.getTargets()) {
        addTargetFileContentToTargetPlatform(file, configuration.getTargetDefinitionIncludeSourceMode(), tpConfiguration);
    }
    tpConfiguration.addFilters(configuration.getFilters());
    return reactorRepositoryManager.computePreliminaryTargetPlatform(DefaultReactorProject.adapt(project), tpConfiguration, ee, reactorProjects, pomDependencies);
}
Also used : TargetPlatformConfigurationStub(org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub) ExecutionEnvironmentConfiguration(org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration) PomDependencyCollector(org.eclipse.tycho.p2.target.facade.PomDependencyCollector) ArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) File(java.io.File)

Example 12 with TargetPlatformConfiguration

use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.

the class DefaultTargetPlatformConfigurationReaderTest method testExtraRequirementMissingVersionRange.

@Test
public void testExtraRequirementMissingVersionRange() throws Exception {
    Xpp3Dom dom = createConfigurationDom("type", "id");
    try {
        configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom);
        fail();
    } catch (BuildFailureException e) {
        assertTrue(e.getMessage().contains("Element <versionRange> is missing in <extraRequirements><requirement> section."));
    }
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) BuildFailureException(org.eclipse.tycho.core.shared.BuildFailureException) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) Test(org.junit.Test)

Example 13 with TargetPlatformConfiguration

use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.

the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithValidTargetDefinition.

@Test
public void testAddTargetWithValidTargetDefinition() {
    Xpp3Dom dom = createGavConfiguration("myGroupId", "myArtifactId", "myVersion");
    MavenSession session = setupMockSession();
    TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
    configurationReader.addTargetArtifact(configuration, session, null, dom);
    assertEquals(1, configuration.getTargets().size());
    assertEquals(new File("/basedir/myArtifactId.target").getPath(), configuration.getTargets().get(0).getPath());
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) File(java.io.File) Test(org.junit.Test)

Example 14 with TargetPlatformConfiguration

use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.

the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingVersionInTargetDefinition.

@Test
public void testAddTargetWithMissingVersionInTargetDefinition() {
    Xpp3Dom dom = createGavConfiguration("myGroupId", "myArtifactId", null);
    MavenSession session = setupMockSession();
    TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
    try {
        configurationReader.addTargetArtifact(configuration, session, null, dom);
        fail();
    } catch (BuildFailureException e) {
        assertTrue(e.getMessage().contains("The target artifact configuration is invalid"));
    }
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) BuildFailureException(org.eclipse.tycho.core.shared.BuildFailureException) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) Test(org.junit.Test)

Example 15 with TargetPlatformConfiguration

use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.

the class DefaultTargetPlatformConfigurationReaderTest method testExtraRequirementMissingType.

@Test
public void testExtraRequirementMissingType() throws Exception {
    Xpp3Dom dom = createConfigurationDom("id", "versionRange");
    try {
        configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom);
        fail();
    } catch (BuildFailureException e) {
        assertTrue(e.getMessage().contains("Element <type> is missing in <extraRequirements><requirement> section."));
    }
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) BuildFailureException(org.eclipse.tycho.core.shared.BuildFailureException) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) Test(org.junit.Test)

Aggregations

TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)25 File (java.io.File)8 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)8 Test (org.junit.Test)7 MavenSession (org.apache.maven.execution.MavenSession)6 BuildFailureException (org.eclipse.tycho.core.shared.BuildFailureException)6 TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)6 Properties (java.util.Properties)4 DependencyResolver (org.eclipse.tycho.core.DependencyResolver)4 Dependency (org.apache.maven.model.Dependency)3 MavenProject (org.apache.maven.project.MavenProject)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 ReactorProject (org.eclipse.tycho.ReactorProject)2 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)2 TargetPlatform (org.eclipse.tycho.artifacts.TargetPlatform)2 DependencyResolverConfiguration (org.eclipse.tycho.core.DependencyResolverConfiguration)2 ExecutionEnvironmentConfiguration (org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration)2