Search in sources :

Example 1 with DefaultTargetPlatformConfigurationReader

use of org.eclipse.tycho.core.resolver.DefaultTargetPlatformConfigurationReader 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 2 with DefaultTargetPlatformConfigurationReader

use of org.eclipse.tycho.core.resolver.DefaultTargetPlatformConfigurationReader in project tycho by eclipse.

the class TychoTest method testImplicitTargetEnvironment.

public void testImplicitTargetEnvironment() throws Exception {
    File basedir = getBasedir("projects/implicitenvironment/simple");
    List<MavenProject> projects = getSortedProjects(basedir);
    assertEquals(1, projects.size());
    // assertEquals("ambiguous", projects.get(0).getArtifactId());
    // assertEquals("none", projects.get(0).getArtifactId());
    assertEquals("simple", projects.get(0).getArtifactId());
    DefaultTargetPlatformConfigurationReader resolver = lookup(DefaultTargetPlatformConfigurationReader.class);
    MavenSession session;
    TargetPlatformConfiguration configuration;
    List<TargetEnvironment> environments;
    // ambiguous
    // session = newMavenSession(projects.get(0), projects);
    // configuration = resolver.getTargetPlatformConfiguration(session, session.getCurrentProject());
    // environments = configuration.getEnvironments();
    // assertEquals(0, environments.size());
    // none
    // session = newMavenSession(projects.get(0), projects);
    // configuration = resolver.getTargetPlatformConfiguration(session, session.getCurrentProject());
    // environments = configuration.getEnvironments();
    // assertEquals(0, environments.size());
    // simple
    session = newMavenSession(projects.get(0), projects);
    configuration = resolver.getTargetPlatformConfiguration(session, session.getCurrentProject());
    environments = configuration.getEnvironments();
    assertEquals(1, environments.size());
    TargetEnvironment env = environments.get(0);
    assertEquals("foo", env.getOs());
    assertEquals("bar", env.getWs());
    assertEquals("munchy", 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)

Aggregations

File (java.io.File)2 MavenSession (org.apache.maven.execution.MavenSession)2 MavenProject (org.apache.maven.project.MavenProject)2 TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)2 DefaultTargetPlatformConfigurationReader (org.eclipse.tycho.core.resolver.DefaultTargetPlatformConfigurationReader)2 TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)2