Search in sources :

Example 1 with DefaultDependencyArtifacts

use of org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts in project tycho by eclipse.

the class EquinoxResolverTest method test_noSystemBundle.

public void test_noSystemBundle() throws BundleException {
    Properties properties = subject.getPlatformProperties(new Properties(), null, DUMMY_EE);
    State state = subject.newState(new DefaultDependencyArtifacts(), properties, false);
    BundleDescription[] bundles = state.getBundles("system.bundle");
    assertEquals(1, bundles.length);
}
Also used : DefaultDependencyArtifacts(org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts) State(org.eclipse.osgi.service.resolver.State) BundleDescription(org.eclipse.osgi.service.resolver.BundleDescription) Properties(java.util.Properties)

Example 2 with DefaultDependencyArtifacts

use of org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts in project tycho by eclipse.

the class DefaultDependencyArtifactsTest method testInstallableUnits.

@Test
public void testInstallableUnits() {
    DefaultDependencyArtifacts tp = new DefaultDependencyArtifacts();
    ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
    File location = new File("location");
    tp.addArtifactFile(key, location, asSet("a"));
    tp.addNonReactorUnits(asSet("b"));
    Assert.assertEquals(asSet("a", "b"), tp.getInstallableUnits());
}
Also used : DefaultDependencyArtifacts(org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) File(java.io.File) Test(org.junit.Test)

Example 3 with DefaultDependencyArtifacts

use of org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts in project tycho by eclipse.

the class DefaultDependencyArtifactsTest method testDoNotCacheArtifactsThatRepresentReactorProjects.

@Test
public void testDoNotCacheArtifactsThatRepresentReactorProjects() {
    // IInstallableUnit #hashCode and #equals methods only use (version,id) tuple to determine IU equality
    // Reactor projects are expected to produce different IUs potentially with the same (version,id) during the build
    // This test verifies that different DefaultTargetPlatform can have the same reactor project with different IUs
    // even when IUs (version,id) are the same
    ReactorProject project = new DefaultReactorProject(new MavenProject());
    ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
    File location = new File("location");
    DefaultDependencyArtifacts tp1 = new DefaultDependencyArtifacts();
    tp1.addArtifact(new DefaultArtifactDescriptor(key, location, project, null, asSet(new FunnyEquals("id", "a"))));
    DefaultDependencyArtifacts tp2 = new DefaultDependencyArtifacts();
    tp2.addArtifact(new DefaultArtifactDescriptor(key, location, project, null, asSet(new FunnyEquals("id", "b"))));
    // 
    Assert.assertEquals(// 
    "a", ((FunnyEquals) tp1.getArtifact(location).get(null).getInstallableUnits().iterator().next()).getData());
    // 
    Assert.assertEquals(// 
    "b", ((FunnyEquals) tp2.getArtifact(location).get(null).getInstallableUnits().iterator().next()).getData());
}
Also used : DefaultDependencyArtifacts(org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts) DefaultReactorProject(org.eclipse.tycho.core.osgitools.DefaultReactorProject) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) MavenProject(org.apache.maven.project.MavenProject) ReactorProject(org.eclipse.tycho.ReactorProject) DefaultReactorProject(org.eclipse.tycho.core.osgitools.DefaultReactorProject) DefaultArtifactDescriptor(org.eclipse.tycho.core.osgitools.DefaultArtifactDescriptor) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) File(java.io.File) Test(org.junit.Test)

Example 4 with DefaultDependencyArtifacts

use of org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts 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"));
}
Also used : DefaultDependencyArtifacts(org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) DefaultArtifactDescriptor(org.eclipse.tycho.core.osgitools.DefaultArtifactDescriptor) ArtifactDescriptor(org.eclipse.tycho.ArtifactDescriptor) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) File(java.io.File) MultiEnvironmentDependencyArtifacts(org.eclipse.tycho.core.osgitools.targetplatform.MultiEnvironmentDependencyArtifacts) Test(org.junit.Test)

Example 5 with DefaultDependencyArtifacts

use of org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts in project tycho by eclipse.

the class DefaultDependencyArtifactsTest method testInconsistentArtifacts.

@Test
public void testInconsistentArtifacts() {
    DefaultDependencyArtifacts tp = new DefaultDependencyArtifacts();
    ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
    File location = new File("location");
    tp.addArtifactFile(key, location, asSet("a"));
    try {
        tp.addArtifactFile(key, location, asSet("b"));
    } catch (IllegalStateException e) {
    // expected
    }
}
Also used : DefaultDependencyArtifacts(org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) File(java.io.File) Test(org.junit.Test)

Aggregations

DefaultDependencyArtifacts (org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts)11 File (java.io.File)8 DefaultArtifactKey (org.eclipse.tycho.DefaultArtifactKey)7 Test (org.junit.Test)7 ArtifactKey (org.eclipse.tycho.ArtifactKey)6 ReactorProject (org.eclipse.tycho.ReactorProject)4 DefaultReactorProject (org.eclipse.tycho.core.osgitools.DefaultReactorProject)4 MavenProject (org.apache.maven.project.MavenProject)2 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)2 DefaultArtifactDescriptor (org.eclipse.tycho.core.osgitools.DefaultArtifactDescriptor)2 MultiEnvironmentDependencyArtifacts (org.eclipse.tycho.core.osgitools.targetplatform.MultiEnvironmentDependencyArtifacts)2 TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)2 P2ResolutionResult (org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult)2 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Properties (java.util.Properties)1 MavenSession (org.apache.maven.execution.MavenSession)1 Dependency (org.apache.maven.model.Dependency)1 ComponentDependency (org.codehaus.plexus.component.repository.ComponentDependency)1 BundleDescription (org.eclipse.osgi.service.resolver.BundleDescription)1