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));
}
}
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());
}
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());
}
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"));
}
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);
}
Aggregations