Search in sources :

Example 1 with AbstractTychoProject

use of org.eclipse.tycho.core.osgitools.AbstractTychoProject in project tycho by eclipse.

the class DefaultTychoResolver method setupProject.

@Override
public void setupProject(MavenSession session, MavenProject project, ReactorProject reactorProject) {
    AbstractTychoProject dr = (AbstractTychoProject) projectTypes.get(project.getPackaging());
    if (dr == null) {
        return;
    }
    // skip if setup was already done
    if (project.getContextValue(TychoConstants.CTX_MERGED_PROPERTIES) != null) {
        return;
    }
    // generic Eclipse/OSGi metadata
    dr.setupProject(session, project);
    // p2 metadata
    Properties properties = new Properties();
    properties.putAll(project.getProperties());
    // session wins
    properties.putAll(session.getSystemProperties());
    properties.putAll(session.getUserProperties());
    project.setContextValue(TychoConstants.CTX_MERGED_PROPERTIES, properties);
    setTychoEnvironmentProperties(properties, project);
    TargetPlatformConfiguration configuration = configurationReader.getTargetPlatformConfiguration(session, project);
    project.setContextValue(TychoConstants.CTX_TARGET_PLATFORM_CONFIGURATION, configuration);
    ExecutionEnvironmentConfiguration eeConfiguration = new ExecutionEnvironmentConfigurationImpl(logger, !configuration.isResolveWithEEConstraints());
    dr.readExecutionEnvironmentConfiguration(project, eeConfiguration);
    project.setContextValue(TychoConstants.CTX_EXECUTION_ENVIRONMENT_CONFIGURATION, eeConfiguration);
    DependencyResolver resolver = dependencyResolverLocator.lookupDependencyResolver(project);
    resolver.setupProjects(session, project, reactorProject);
}
Also used : ExecutionEnvironmentConfiguration(org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration) AbstractTychoProject(org.eclipse.tycho.core.osgitools.AbstractTychoProject) Properties(java.util.Properties) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) ExecutionEnvironmentConfigurationImpl(org.eclipse.tycho.core.ee.ExecutionEnvironmentConfigurationImpl) DependencyResolver(org.eclipse.tycho.core.DependencyResolver)

Example 2 with AbstractTychoProject

use of org.eclipse.tycho.core.osgitools.AbstractTychoProject in project tycho by eclipse.

the class DefaultTychoResolver method resolveProject.

@Override
public void resolveProject(MavenSession session, MavenProject project, List<ReactorProject> reactorProjects) {
    AbstractTychoProject dr = (AbstractTychoProject) projectTypes.get(project.getPackaging());
    if (dr == null) {
        return;
    }
    DependencyResolver resolver = dependencyResolverLocator.lookupDependencyResolver(project);
    logger.info("Computing target platform for " + project);
    TargetPlatform preliminaryTargetPlatform = resolver.computePreliminaryTargetPlatform(session, project, reactorProjects);
    TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(project);
    DependencyResolverConfiguration resolverConfiguration = configuration.getDependencyResolverConfiguration();
    logger.info("Resolving dependencies of " + project);
    DependencyArtifacts dependencyArtifacts = resolver.resolveDependencies(session, project, preliminaryTargetPlatform, reactorProjects, resolverConfiguration);
    if (logger.isDebugEnabled() && DebugUtils.isDebugEnabled(session, project)) {
        StringBuilder sb = new StringBuilder();
        sb.append("Resolved target platform for ").append(project).append("\n");
        dependencyArtifacts.toDebugString(sb, "  ");
        logger.debug(sb.toString());
    }
    dr.setDependencyArtifacts(session, project, dependencyArtifacts);
    logger.info("Resolving class path of " + project);
    dr.resolveClassPath(session, project);
    resolver.injectDependenciesIntoMavenModel(project, dr, dependencyArtifacts, logger);
    if (logger.isDebugEnabled() && DebugUtils.isDebugEnabled(session, project)) {
        StringBuilder sb = new StringBuilder();
        sb.append("Injected dependencies for ").append(project.toString()).append("\n");
        for (Dependency dependency : project.getDependencies()) {
            sb.append("  ").append(dependency.toString());
        }
        logger.debug(sb.toString());
    }
}
Also used : DependencyArtifacts(org.eclipse.tycho.artifacts.DependencyArtifacts) AbstractTychoProject(org.eclipse.tycho.core.osgitools.AbstractTychoProject) TargetPlatform(org.eclipse.tycho.artifacts.TargetPlatform) Dependency(org.apache.maven.model.Dependency) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration) DependencyResolverConfiguration(org.eclipse.tycho.core.DependencyResolverConfiguration) DependencyResolver(org.eclipse.tycho.core.DependencyResolver)

Aggregations

DependencyResolver (org.eclipse.tycho.core.DependencyResolver)2 TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)2 AbstractTychoProject (org.eclipse.tycho.core.osgitools.AbstractTychoProject)2 Properties (java.util.Properties)1 Dependency (org.apache.maven.model.Dependency)1 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)1 TargetPlatform (org.eclipse.tycho.artifacts.TargetPlatform)1 DependencyResolverConfiguration (org.eclipse.tycho.core.DependencyResolverConfiguration)1 ExecutionEnvironmentConfigurationImpl (org.eclipse.tycho.core.ee.ExecutionEnvironmentConfigurationImpl)1 ExecutionEnvironmentConfiguration (org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration)1