Search in sources :

Example 1 with OptionalResolutionAction

use of org.eclipse.tycho.core.resolver.shared.OptionalResolutionAction 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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) DefaultReactorProject(org.eclipse.tycho.core.osgitools.DefaultReactorProject) OptionalResolutionAction(org.eclipse.tycho.core.resolver.shared.OptionalResolutionAction) ReactorProject(org.eclipse.tycho.ReactorProject) DefaultReactorProject(org.eclipse.tycho.core.osgitools.DefaultReactorProject) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) IDependencyMetadata(org.eclipse.tycho.p2.metadata.IDependencyMetadata) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 ReactorProject (org.eclipse.tycho.ReactorProject)1 DefaultReactorProject (org.eclipse.tycho.core.osgitools.DefaultReactorProject)1 OptionalResolutionAction (org.eclipse.tycho.core.resolver.shared.OptionalResolutionAction)1 TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)1 IDependencyMetadata (org.eclipse.tycho.p2.metadata.IDependencyMetadata)1