Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Tycho/Execution Environments"
(introduction; outline) |
(finished configuration (except default values - pending bug 387796)) |
||
Line 1: | Line 1: | ||
− | An execution environment profile describes the capabilities of a Java runtime environment (JRE). In order to build for | + | An execution environment profile describes the capabilities of a Java runtime environment (JRE). In order to build for certain minimal JRE version, e.g. for Java SE 5 and later, Tycho allows you to select the execution environment profile to be used in the build. |
Background: In OSGi, you can express that you need a certain minimum version of a library by importing a package from the library with a lower bound on the version. For the JRE itself, this approach is not possible: bundles don't specify imports on <tt>java.*</tt> packages, so you can't specify through a package import that, for example, your bundle needs <tt>java.lang</tt> in a version that contains the <tt>Enum</tt> class. Instead, there is the possibility to specify a requirement on the execution environment, e.g. <tt>Bundle-RequiredExecutionEnvironment: J2SE-1.5</tt>. | Background: In OSGi, you can express that you need a certain minimum version of a library by importing a package from the library with a lower bound on the version. For the JRE itself, this approach is not possible: bundles don't specify imports on <tt>java.*</tt> packages, so you can't specify through a package import that, for example, your bundle needs <tt>java.lang</tt> in a version that contains the <tt>Enum</tt> class. Instead, there is the possibility to specify a requirement on the execution environment, e.g. <tt>Bundle-RequiredExecutionEnvironment: J2SE-1.5</tt>. | ||
Line 5: | Line 5: | ||
=== Execution environment configuration === | === Execution environment configuration === | ||
− | ... | + | The execution environment profile for the build is determined through the following configuration parameters, in decreasing order of precedence: |
+ | |||
+ | # The <tt><executionEnvironment></tt> parameter in the <tt>target-platform-configuration</tt> | ||
+ | # The <tt>jre.compilation.profile</tt> property in the build.properties (<tt>eclipse-plugin</tt> and <tt>eclipse-test-plugin</tt> modules only) | ||
+ | # The most restricted profile specified in the <tt>Bundle-RequiredExecutionEnvironment</tt> header (see details below; <tt>eclipse-plugin</tt> and <tt>eclipse-test-plugin</tt> modules only) | ||
+ | # The <tt><executionEnvironmentDefault></tt> parameter in the <tt>target-platform-configuration</tt> | ||
+ | |||
+ | You can specify the commonly known execution environments, for example "<tt>J2SE-1.5</tt>" (!), "<tt>JavaSE-1.6</tt>", "<tt>JavaSE-1.7</tt>", or "<tt>OSGi/Minimum-1.2</tt>". | ||
+ | |||
+ | ==== Configuration via the bundle manifest ==== | ||
+ | |||
+ | Unlike the other parameters, the <tt>Bundle-RequiredExecutionEnvironment</tt> header in the MANIFEST.MF allows to specify multiple execution environments (see [http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Feditors%2Fmanifest_editor%2Foverview.htm here for a motivation]). If this is the case, Tycho picks the most restricted execution environment according to the following heuristic: From the most restrictive class (with OSGi/Minimum < CDC/Foundation < J2SE or JavaSE), the lowest version is selected. | ||
=== Effects of the exectution environment in the build === | === Effects of the exectution environment in the build === |
Revision as of 08:53, 17 October 2012
An execution environment profile describes the capabilities of a Java runtime environment (JRE). In order to build for certain minimal JRE version, e.g. for Java SE 5 and later, Tycho allows you to select the execution environment profile to be used in the build.
Background: In OSGi, you can express that you need a certain minimum version of a library by importing a package from the library with a lower bound on the version. For the JRE itself, this approach is not possible: bundles don't specify imports on java.* packages, so you can't specify through a package import that, for example, your bundle needs java.lang in a version that contains the Enum class. Instead, there is the possibility to specify a requirement on the execution environment, e.g. Bundle-RequiredExecutionEnvironment: J2SE-1.5.
Contents
Execution environment configuration
The execution environment profile for the build is determined through the following configuration parameters, in decreasing order of precedence:
- The <executionEnvironment> parameter in the target-platform-configuration
- The jre.compilation.profile property in the build.properties (eclipse-plugin and eclipse-test-plugin modules only)
- The most restricted profile specified in the Bundle-RequiredExecutionEnvironment header (see details below; eclipse-plugin and eclipse-test-plugin modules only)
- The <executionEnvironmentDefault> parameter in the target-platform-configuration
You can specify the commonly known execution environments, for example "J2SE-1.5" (!), "JavaSE-1.6", "JavaSE-1.7", or "OSGi/Minimum-1.2".
Configuration via the bundle manifest
Unlike the other parameters, the Bundle-RequiredExecutionEnvironment header in the MANIFEST.MF allows to specify multiple execution environments (see here for a motivation). If this is the case, Tycho picks the most restricted execution environment according to the following heuristic: From the most restrictive class (with OSGi/Minimum < CDC/Foundation < J2SE or JavaSE), the lowest version is selected.
Effects of the exectution environment in the build
...
Toolchains
...