Search in sources :

Example 1 with ExecutionEnvironment

use of org.eclipse.tycho.core.ee.shared.ExecutionEnvironment in project tycho by eclipse.

the class AbstractOsgiCompilerMojo method configureSourceAndTargetLevel.

private void configureSourceAndTargetLevel(CompilerConfiguration compilerConfiguration) throws MojoExecutionException {
    ExecutionEnvironment ee = getTargetExecutionEnvironment();
    compilerConfiguration.setSourceVersion(getSourceLevel(ee));
    compilerConfiguration.setTargetVersion(getTargetLevel(ee));
}
Also used : StandardExecutionEnvironment(org.eclipse.tycho.core.ee.StandardExecutionEnvironment) ExecutionEnvironment(org.eclipse.tycho.core.ee.shared.ExecutionEnvironment)

Example 2 with ExecutionEnvironment

use of org.eclipse.tycho.core.ee.shared.ExecutionEnvironment in project tycho by eclipse.

the class EquinoxResolverTest method test_bundleRuntimeExecutionEnvironment.

public void test_bundleRuntimeExecutionEnvironment() throws Exception {
    File basedir = getBasedir("projects/bree");
    Properties properties = new Properties();
    properties.put("tycho-version", TychoVersion.getTychoVersion());
    List<MavenProject> projects = getSortedProjects(basedir, properties, null);
    assertEquals(6, projects.size());
    assertEquals("executionenvironment.manifest-minimal", projects.get(2).getArtifactId());
    ExecutionEnvironment ee = TychoProjectUtils.getExecutionEnvironmentConfiguration(projects.get(2)).getFullSpecification();
    assertEquals("CDC-1.0/Foundation-1.0", ee.getProfileName());
    Properties platformProperties = subject.getPlatformProperties(projects.get(2), ee);
    assertEquals("javax.microedition.io", platformProperties.get(Constants.FRAMEWORK_SYSTEMPACKAGES));
}
Also used : ExecutionEnvironment(org.eclipse.tycho.core.ee.shared.ExecutionEnvironment) MavenProject(org.apache.maven.project.MavenProject) Properties(java.util.Properties) File(java.io.File)

Example 3 with ExecutionEnvironment

use of org.eclipse.tycho.core.ee.shared.ExecutionEnvironment in project tycho by eclipse.

the class DependencyComputerTest method testExportPackage.

@Test
public void testExportPackage() throws Exception {
    File basedir = getBasedir("projects/exportpackage");
    Map<File, MavenProject> basedirMap = MavenSessionUtils.getBasedirMap(getSortedProjects(basedir, null));
    MavenProject project = basedirMap.get(new File(basedir, "bundle"));
    DependencyArtifacts platform = (DependencyArtifacts) project.getContextValue(TychoConstants.CTX_DEPENDENCY_ARTIFACTS);
    ExecutionEnvironment executionEnvironment = TychoProjectUtils.getExecutionEnvironmentConfiguration(project).getFullSpecification();
    State state = resolver.newResolvedState(project, executionEnvironment, false, platform);
    BundleDescription bundle = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
    List<DependencyEntry> dependencies = dependencyComputer.computeDependencies(state.getStateHelper(), bundle);
    Assert.assertEquals(3, dependencies.size());
    Assert.assertEquals("dep", dependencies.get(0).desc.getSymbolicName());
    Assert.assertEquals("dep2", dependencies.get(1).desc.getSymbolicName());
    Assert.assertEquals("dep3", dependencies.get(2).desc.getSymbolicName());
    Assert.assertTrue(dependencies.get(2).rules.isEmpty());
}
Also used : DependencyArtifacts(org.eclipse.tycho.artifacts.DependencyArtifacts) CustomExecutionEnvironment(org.eclipse.tycho.core.ee.CustomExecutionEnvironment) ExecutionEnvironment(org.eclipse.tycho.core.ee.shared.ExecutionEnvironment) MavenProject(org.apache.maven.project.MavenProject) State(org.eclipse.osgi.service.resolver.State) BundleDescription(org.eclipse.osgi.service.resolver.BundleDescription) DependencyEntry(org.eclipse.tycho.core.osgitools.DependencyComputer.DependencyEntry) File(java.io.File) Test(org.junit.Test)

Example 4 with ExecutionEnvironment

use of org.eclipse.tycho.core.ee.shared.ExecutionEnvironment in project tycho by eclipse.

the class OsgiBundleProject method readExecutionEnvironmentConfiguration.

@Override
public void readExecutionEnvironmentConfiguration(MavenProject project, ExecutionEnvironmentConfiguration sink) {
    // read packaging-type independent configuration
    super.readExecutionEnvironmentConfiguration(project, sink);
    // only in plugin projects, the profile may also be ...
    // ... specified in build.properties (for PDE compatibility)
    String pdeProfile = getEclipsePluginProject(DefaultReactorProject.adapt(project)).getBuildProperties().getJreCompilationProfile();
    if (pdeProfile != null) {
        sink.setProfileConfiguration(pdeProfile.trim(), "build.properties");
    } else {
        // ... derived from BREE in bundle manifest
        StandardExecutionEnvironment[] manifestBREEs = getManifest(project).getExecutionEnvironments();
        if (manifestBREEs.length > 0) {
            TargetPlatformConfiguration tpConfiguration = TychoProjectUtils.getTargetPlatformConfiguration(project);
            switch(tpConfiguration.getBREEHeaderSelectionPolicy()) {
                case first:
                    sink.setProfileConfiguration(manifestBREEs[0].getProfileName(), "Bundle-RequiredExecutionEnvironment (first entry)");
                    break;
                case minimal:
                    ExecutionEnvironment manifestMinimalEE = Collections.min(Arrays.asList(manifestBREEs));
                    sink.setProfileConfiguration(manifestMinimalEE.getProfileName(), "Bundle-RequiredExecutionEnvironment (minimal entry)");
            }
        }
    }
}
Also used : StandardExecutionEnvironment(org.eclipse.tycho.core.ee.StandardExecutionEnvironment) StandardExecutionEnvironment(org.eclipse.tycho.core.ee.StandardExecutionEnvironment) ExecutionEnvironment(org.eclipse.tycho.core.ee.shared.ExecutionEnvironment) TargetPlatformConfiguration(org.eclipse.tycho.core.TargetPlatformConfiguration)

Example 5 with ExecutionEnvironment

use of org.eclipse.tycho.core.ee.shared.ExecutionEnvironment in project tycho by eclipse.

the class OsgiBundleProject method getResolverState.

private State getResolverState(MavenProject project, DependencyArtifacts artifacts) {
    try {
        ExecutionEnvironmentConfiguration eeConfiguration = TychoProjectUtils.getExecutionEnvironmentConfiguration(project);
        ExecutionEnvironment executionEnvironment = eeConfiguration.getFullSpecification();
        return resolver.newResolvedState(project, executionEnvironment, eeConfiguration.isIgnoredByResolver(), artifacts);
    } catch (BundleException e) {
        throw new RuntimeException(e);
    }
}
Also used : StandardExecutionEnvironment(org.eclipse.tycho.core.ee.StandardExecutionEnvironment) ExecutionEnvironment(org.eclipse.tycho.core.ee.shared.ExecutionEnvironment) ExecutionEnvironmentConfiguration(org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration) BundleException(org.osgi.framework.BundleException)

Aggregations

ExecutionEnvironment (org.eclipse.tycho.core.ee.shared.ExecutionEnvironment)5 StandardExecutionEnvironment (org.eclipse.tycho.core.ee.StandardExecutionEnvironment)3 File (java.io.File)2 MavenProject (org.apache.maven.project.MavenProject)2 Properties (java.util.Properties)1 BundleDescription (org.eclipse.osgi.service.resolver.BundleDescription)1 State (org.eclipse.osgi.service.resolver.State)1 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)1 TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)1 CustomExecutionEnvironment (org.eclipse.tycho.core.ee.CustomExecutionEnvironment)1 ExecutionEnvironmentConfiguration (org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfiguration)1 DependencyEntry (org.eclipse.tycho.core.osgitools.DependencyComputer.DependencyEntry)1 Test (org.junit.Test)1 BundleException (org.osgi.framework.BundleException)1