use of org.eclipse.tycho.core.osgitools.DefaultReactorProject 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.core.osgitools.DefaultReactorProject in project tycho by eclipse.
the class P2DependencyResolver method getThisReactorProject.
private ReactorProject getThisReactorProject(MavenSession session, MavenProject project, TargetPlatformConfiguration configuration) {
// 'this' project should obey optionalDependencies configuration
final List<TargetEnvironment> environments = configuration.getEnvironments();
final OptionalResolutionAction optionalAction = configuration.getDependencyResolverConfiguration().getOptionalResolutionAction();
Map<String, IDependencyMetadata> dependencyMetadata = getDependencyMetadata(session, project, environments, optionalAction);
final Set<Object> metadata = new LinkedHashSet<>();
final Set<Object> secondaryMetadata = new LinkedHashSet<>();
for (Map.Entry<String, IDependencyMetadata> entry : dependencyMetadata.entrySet()) {
metadata.addAll(entry.getValue().getMetadata(true));
secondaryMetadata.addAll(entry.getValue().getMetadata(false));
}
ReactorProject reactorProjet = new DefaultReactorProject(project) {
@Override
public Set<?> getDependencyMetadata(boolean primary) {
return primary ? metadata : secondaryMetadata;
}
};
return reactorProjet;
}
Aggregations