Search in sources :

Example 1 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class PublishProductToolImpl method addRootFeatures.

private static void addRootFeatures(ExpandedProduct product, List<DependencySeed> seeds) {
    final String productId = product.getId();
    // add root features as special dependency seed which are marked as "add-on" for the product
    DependencySeed.Filter filter = new DependencySeed.Filter() {

        @Override
        public boolean isAddOnFor(String type, String id) {
            return ArtifactType.TYPE_ECLIPSE_PRODUCT.equals(type) && productId.equals(id);
        }
    };
    for (IInstallableUnit featureIU : product.getRootFeatures()) {
        ArtifactKey featureArtifact = ArtifactTypeHelper.toTychoArtifact(featureIU);
        seeds.add(new DependencySeed(featureArtifact.getType(), featureArtifact.getId(), featureIU, filter));
    }
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) ArtifactKey(org.eclipse.tycho.ArtifactKey) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit)

Example 2 with ArtifactKey

use of org.eclipse.tycho.ArtifactKey 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 ArtifactKey

use of org.eclipse.tycho.ArtifactKey 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 ArtifactKey

use of org.eclipse.tycho.ArtifactKey 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 ArtifactKey

use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.

the class DefaultDependencyArtifactsTest method addArtifact.

private void addArtifact(DefaultDependencyArtifacts tp, String type, String id, String version) {
    ArtifactKey key = new DefaultArtifactKey(type, id, version);
    tp.addArtifactFile(key, new File(version), null);
}
Also used : DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) ArtifactKey(org.eclipse.tycho.ArtifactKey) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey) File(java.io.File)

Aggregations

ArtifactKey (org.eclipse.tycho.ArtifactKey)41 File (java.io.File)19 DefaultArtifactKey (org.eclipse.tycho.DefaultArtifactKey)15 Test (org.junit.Test)14 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)13 ReactorProject (org.eclipse.tycho.ReactorProject)8 DefaultArtifactDescriptor (org.eclipse.tycho.core.osgitools.DefaultArtifactDescriptor)6 DefaultDependencyArtifacts (org.eclipse.tycho.core.osgitools.targetplatform.DefaultDependencyArtifacts)6 DefaultReactorProject (org.eclipse.tycho.core.osgitools.DefaultReactorProject)5 LinkedHashMap (java.util.LinkedHashMap)3 MavenProject (org.apache.maven.project.MavenProject)3 BundleStartLevel (org.eclipse.sisu.equinox.launching.BundleStartLevel)3 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)3 FeatureRef (org.eclipse.tycho.model.FeatureRef)3 PluginRef (org.eclipse.tycho.model.PluginRef)3 Version (org.osgi.framework.Version)3 Element (de.pdark.decentxml.Element)2 Map (java.util.Map)2 Artifact (org.apache.maven.artifact.Artifact)2 Dependency (org.apache.maven.model.Dependency)2