Set BREE to at least JavaSE-1.6 when building OSGi bundles.

Since Fedora 17, we need an Execution Environment of at least JavaSE-1.6
for Eclipse bundles. Eclipse Juno platform bundles depend on
javax.annotation. In Fedora this is provided by geronimo-annotation, but
has a dependency on javax.lang.model (since 1.6).
This commit is contained in:
Roland Grunberg 2012-05-22 15:22:54 -04:00
parent 9ff3cfa8c5
commit 34928e3a9f
2 changed files with 61 additions and 2 deletions

View File

@ -82,3 +82,59 @@ index 15b3fff..c8f14df 100644
List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>(); List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>();
for (MavenProject project : session.getProjects()) { for (MavenProject project : session.getProjects()) {
repositories.addAll(project.getPluginArtifactRepositories()); repositories.addAll(project.getPluginArtifactRepositories());
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
index 8d18453..051913e 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiBundleProject.java
@@ -505,6 +505,28 @@ public class OsgiBundleProject extends AbstractTychoProject implements BundlePro
}
ExecutionEnvironment manifestMinimalEE = Collections.min(envs);
+ ExecutionEnvironment tmp;
+
+ if (System.getProperty("maven.local.mode") != null) {
+ try {
+ // EE must be at least JavaSE-1.6
+ final ExecutionEnvironment javaSE16 = ExecutionEnvironmentUtils.getExecutionEnvironment("JavaSE-1.6");
+ while (!envs.isEmpty()) {
+ tmp = Collections.min(envs);
+ if (tmp.compareTo(javaSE16) >= 0) {
+ manifestMinimalEE = tmp;
+ break;
+ }
+ envs.remove(tmp);
+ }
+
+ if (envs.isEmpty()) {
+ return javaSE16;
+ }
+ } catch (UnknownEnvironmentException e) {
+ // Continue
+ }
+ }
if (buildMinimalEE == null) {
return manifestMinimalEE;
@@ -515,7 +537,21 @@ public class OsgiBundleProject extends AbstractTychoProject implements BundlePro
protected ExecutionEnvironment getExecutionEnvironment(MavenProject project, String profile) {
try {
- return ExecutionEnvironmentUtils.getExecutionEnvironment(profile);
+ ExecutionEnvironment ee = ExecutionEnvironmentUtils.getExecutionEnvironment(profile);
+
+ if (System.getProperty("maven.local.mode") != null && ee != null) {
+ try {
+ // EE must be at least JavaSE-1.6
+ final ExecutionEnvironment javaSE16 = ExecutionEnvironmentUtils.getExecutionEnvironment("JavaSE-1.6");
+ if (ee.compareTo(javaSE16) < 0) {
+ ee = javaSE16;
+ }
+ } catch (UnknownEnvironmentException e) {
+ // Continue
+ }
+ }
+
+ return ee;
} catch (UnknownEnvironmentException e) {
throw new RuntimeException("Unknown execution environment specified in build.properties of project "
+ project, e);

View File

@ -1,4 +1,4 @@
%global bootstrap 0 %global bootstrap 1
%if %{bootstrap} %if %{bootstrap}
%global snap -SNAPSHOT %global snap -SNAPSHOT
@ -8,7 +8,7 @@
Name: tycho Name: tycho
Version: 0.14.1 Version: 0.14.1
Release: 3%{?dist} Release: 3.1%{?dist}
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
Group: Development/Libraries Group: Development/Libraries
@ -193,6 +193,9 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}
%{_javadocdir}/%{name} %{_javadocdir}/%{name}
%changelog %changelog
* Thu May 17 2012 Roland Grunberg <rgrunber@redhat.com> 0.14.1-3.1
- Set BREE to be at least JavaSE-1.6 for Eclipse OSGi bundles.
* Wed May 16 2012 Roland Grunberg <rgrunber@redhat.com> 0.14.1-3 * Wed May 16 2012 Roland Grunberg <rgrunber@redhat.com> 0.14.1-3
- Non-bootstrap build. - Non-bootstrap build.