Search in sources :

Example 1 with TargetPlatformConfiguration

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

the class DefaultTargetPlatformConfigurationReaderTest method testExtraRequirementId.

@Test
public void testExtraRequirementId() throws Exception {
    Xpp3Dom dom = createConfigurationDom("type", "versionRange");
    try {
        configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom);
        fail();
    } catch (BuildFailureException e) {
        assertTrue(e.getMessage().contains("Element <id> 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 2 with TargetPlatformConfiguration

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

the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingGroupInTargetDefinition.

@Test
public void testAddTargetWithMissingGroupInTargetDefinition() {
    Xpp3Dom dom = createGavConfiguration(null, "myArtifactId", "myVersion");
    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 3 with TargetPlatformConfiguration

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

the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingArtifactIdInTargetDefinition.

@Test
public void testAddTargetWithMissingArtifactIdInTargetDefinition() {
    Xpp3Dom dom = createGavConfiguration("myGroupId", null, "myVersion");
    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 4 with TargetPlatformConfiguration

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

the class TychoTest method testWithValidExplicitTargetEnvironment.

public void testWithValidExplicitTargetEnvironment() throws Exception {
    File basedir = getBasedir("projects/explicitenvironment/valid");
    List<MavenProject> projects = getSortedProjects(basedir);
    assertEquals(1, projects.size());
    assertEquals("valid", projects.get(0).getArtifactId());
    DefaultTargetPlatformConfigurationReader resolver = lookup(DefaultTargetPlatformConfigurationReader.class);
    MavenSession session = newMavenSession(projects.get(0), projects);
    TargetPlatformConfiguration configuration;
    List<TargetEnvironment> environments;
    configuration = resolver.getTargetPlatformConfiguration(session, session.getCurrentProject());
    environments = configuration.getEnvironments();
    assertEquals(1, environments.size());
    TargetEnvironment env = environments.get(0);
    assertEquals("linux", env.getOs());
    assertEquals("gtk", env.getWs());
    assertEquals("arm", env.getArch());
}
Also used : DefaultTargetPlatformConfigurationReader(org.eclipse.tycho.core.resolver.DefaultTargetPlatformConfigurationReader) MavenSession(org.apache.maven.execution.MavenSession) MavenProject(org.apache.maven.project.MavenProject) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) File(java.io.File) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration)

Example 5 with TargetPlatformConfiguration

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

the class TestMojo method getExtraDependencies.

private List<Dependency> getExtraDependencies() {
    final List<Dependency> dependencies = new ArrayList<>();
    if (this.dependencies != null) {
        dependencies.addAll(Arrays.asList(this.dependencies));
    }
    TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(project);
    dependencies.addAll(configuration.getDependencyResolverConfiguration().getExtraRequirements());
    dependencies.addAll(getTestDependencies());
    return dependencies;
}
Also used : ArrayList(java.util.ArrayList) Dependency(org.apache.maven.model.Dependency) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration)

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