use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.
the class P2ResolverTest method testProductMultienvP2Inf.
@Test
public void testProductMultienvP2Inf() throws Exception {
List<TargetEnvironment> environments = new ArrayList<>();
environments.add(new TargetEnvironment("linux", "gtk", "x86_64"));
environments.add(new TargetEnvironment("macosx", "cocoa", "x86_64"));
impl.setEnvironments(environments);
String artifactId = "product.multienv.p2-inf";
projectToResolve = createReactorProject(resourceFile("resolver/product.multienv.p2-inf"), TYPE_ECLIPSE_REPOSITORY, artifactId);
List<P2ResolutionResult> results = impl.resolveDependencies(getTargetPlatform(), projectToResolve);
assertEquals(2, results.size());
P2ResolutionResult linux = results.get(0);
List<Entry> linuxEntries = new ArrayList<>(linux.getArtifacts());
assertEquals(1, linuxEntries.size());
assertEquals(1, linuxEntries.get(0).getInstallableUnits().size());
assertEquals(0, linux.getNonReactorUnits().size());
P2ResolutionResult macosx = results.get(1);
List<Entry> macosxEntries = new ArrayList<>(macosx.getArtifacts());
assertEquals(1, macosxEntries.size());
assertEquals(2, macosxEntries.get(0).getInstallableUnits().size());
assertEquals(0, macosx.getNonReactorUnits().size());
}
use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.
the class P2ResolverTest method testFeatureMultienvP2Inf.
@Test
public void testFeatureMultienvP2Inf() throws Exception {
List<TargetEnvironment> environments = new ArrayList<>();
environments.add(new TargetEnvironment("linux", "gtk", "x86_64"));
environments.add(new TargetEnvironment("macosx", "cocoa", "x86_64"));
impl.setEnvironments(environments);
String artifactId = "feature.multienv.p2-inf";
projectToResolve = createReactorProject(resourceFile("resolver/feature.multienv.p2-inf"), TYPE_ECLIPSE_FEATURE, artifactId);
List<P2ResolutionResult> results = impl.resolveDependencies(getTargetPlatform(), projectToResolve);
assertEquals(2, results.size());
P2ResolutionResult linux = results.get(0);
List<Entry> linuxEntries = new ArrayList<>(linux.getArtifacts());
assertEquals(1, linuxEntries.size());
assertEquals(1, linuxEntries.get(0).getInstallableUnits().size());
assertEquals(0, linux.getNonReactorUnits().size());
P2ResolutionResult macosx = results.get(1);
List<Entry> macosxEntries = new ArrayList<>(macosx.getArtifacts());
assertEquals(1, macosxEntries.size());
assertEquals(2, macosxEntries.get(0).getInstallableUnits().size());
assertEquals(0, macosx.getNonReactorUnits().size());
}
use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.
the class P2ResolverTestBase method getEnvironments.
protected static List<TargetEnvironment> getEnvironments() {
List<TargetEnvironment> environments = new ArrayList<>();
environments.add(new TargetEnvironment("linux", "gtk", "x86_64"));
return environments;
}
use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.
the class DefaultDependencyArtifactsTest method testMultiEnvironmentMetadataMerge.
@Test
public void testMultiEnvironmentMetadataMerge() {
ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
File location = new File("location");
DefaultDependencyArtifacts tpA = new DefaultDependencyArtifacts();
tpA.addArtifactFile(key, location, asSet("a"));
DefaultDependencyArtifacts tpB = new DefaultDependencyArtifacts();
tpB.addArtifactFile(key, location, asSet("a", "b"));
MultiEnvironmentDependencyArtifacts tp = new MultiEnvironmentDependencyArtifacts();
tp.addPlatform(new TargetEnvironment("a", "a", "a"), tpA);
tp.addPlatform(new TargetEnvironment("b", "b", "b"), tpB);
List<ArtifactDescriptor> artifacts = tp.getArtifacts();
Assert.assertEquals(1, artifacts.size());
Set<Object> units = artifacts.get(0).getInstallableUnits();
Assert.assertEquals(2, units.size());
Assert.assertTrue(units.contains("a"));
Assert.assertTrue(units.contains("b"));
}
use of org.eclipse.tycho.core.shared.TargetEnvironment 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());
}
Aggregations