Bootstrap mode improvements

Patch to use Java 8 as the default target EE, prevents unnecessary dep
  on Java 9
This commit is contained in:
Mat Booth 2018-08-17 15:03:33 +01:00
parent 293ff1e97f
commit c8f7145fe1
2 changed files with 211 additions and 4 deletions

View File

@ -9,7 +9,7 @@
# Tycho such that it can build a bootstrap mode Eclipse and subsequently
# fully rebuild itself. In this mode, there may be reduced functionality,
# so a full non-bootstrap mode build should always be done afterwards.
%bcond_with bootstrap
%bcond_without bootstrap
# Release tags or git SHAs
%global git_tag tycho-%{version}
@ -22,7 +22,7 @@
Name: tycho
Version: 1.2.0
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
# license file is missing but all files having some licensing information are ASL 2.0
@ -57,10 +57,15 @@ Patch1: tycho-maven-archiver-3.0.1.patch
Patch2: %{name}-use-custom-resolver.patch
Patch3: %{name}-maven-delegation.patch
# Changes needed for building against latest surefire
# Submitted upstream: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537419
%if 0%{?fedora} >= 28
Patch4: build-against-surefire-2.21.patch
%endif
%if 0%{?fedora} >= 29
Patch5: build-against-surefire-2.22.patch
%endif
#Submitted upstream: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537963
Patch6: use-java8-for-default-ee.patch
BuildArch: noarch
@ -79,7 +84,6 @@ BuildRequires: mvn(org.apache.maven:maven-core)
BuildRequires: mvn(org.apache.maven:maven-plugin-api)
BuildRequires: mvn(org.apache.maven.plugins:maven-clean-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-deploy-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-install-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
@ -119,9 +123,12 @@ BuildRequires: eclipse-platform >= 1:4.8.0
BuildRequires: osgi(com.ibm.icu)
BuildRequires: osgi(org.apache.commons.jxpath)
BuildRequires: osgi(org.apache.felix.scr)
BuildRequires: osgi(org.apache.batik.css)
BuildRequires: osgi(org.sat4j.core)
BuildRequires: osgi(org.sat4j.pb)
BuildRequires: osgi(org.w3c.css.sac)
BuildRequires: osgi(javax.servlet-api)
BuildRequires: osgi(javax.servlet.jsp)
%endif
Requires: maven-local
@ -175,10 +182,13 @@ mv fedoraproject-p2-%{fp_p2_git_tag} fedoraproject-p2
%patch1
%patch2 -p1
%patch3 -p1
%if 0%{?fedora} >= 28
%patch4 -p1
%endif
%if 0%{?fedora} >= 29
%patch5
%endif
%patch6 -p1
# Unneeded for RPM builds
%pom_remove_plugin :maven-site-plugin
@ -320,8 +330,8 @@ cp %{SOURCE3} %{SOURCE5} .
./tycho-debundle.sh $(pwd)/tycho-bundles/tycho-standalone-p2-director
%endif
# Install our own copy of OSGi runtime when bootstrapping to avoid external dep on Eclipse
%if %{with bootstrap}
# Install our own copy of OSGi runtime when bootstrapping to avoid external dep on Eclipse
for b in org.eclipse.osgi \
org.eclipse.osgi.compatibility.state ; do
osgiJarPath=$(find .m2/org/eclipse/tycho/$b/*/ -name "*.jar")
@ -338,6 +348,27 @@ install -pm 644 tycho-bundles/tycho-bundles-external/target/tycho-bundles-extern
%add_maven_depmap org.eclipse.tycho:tycho-bundles-external:txt:manifest:%{version} tycho/tycho-bundles-external-manifest.txt
%endif
%if %{with bootstrap}
# Misc other bundles needed for bootstrapping
for bnd in \
core.contenttype \
core.expressions \
core.filesystem \
core.jobs \
core.net \
core.resources \
core.runtime \
equinox.app \
equinox.common \
equinox.concurrent \
equinox.preferences \
equinox.registry \
equinox.security ; do
bndJarPath=$(find bootstrap -name "org.eclipse.${bnd}_*.jar")
install -m 644 -T $bndJarPath $RPM_BUILD_ROOT%{_javadir}/tycho/$bnd.jar
done
%endif
# For some reason fp-p2 is treated as a compat version, this prevents that
# TODO: figure out why
sed -i '/<resolvedVersion>/d' %{buildroot}%{_datadir}/maven-metadata/tycho.xml
@ -360,11 +391,20 @@ ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}${xmvn_libdir}/inst
%files -f .mfiles
%{_datadir}/xmvn/lib/installer/*
%{_javadir}-utils/p2-install.sh
%if %{with bootstrap}
%{_javadir}/tycho/core.*.jar
%{_javadir}/tycho/equinox.*.jar
%endif
%doc README.md
%files javadoc -f .mfiles-javadoc
%changelog
* Fri Aug 17 2018 Mat Booth <mat.booth@redhat.com> - 1.2.0-5
- Bootstrap mode improvements
- Patch to use Java 8 as the default target EE, prevents unnecessary dep
on Java 9
* Wed Jul 25 2018 Mat Booth <mat.booth@redhat.com> - 1.2.0-4
- Fix build against new surefire

View File

@ -0,0 +1,167 @@
From d113fc877033b24305584d0157a79b7a54be4188 Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Wed, 15 Aug 2018 15:58:10 +0100
Subject: [PATCH] Bug 537963 - Make the default EE Java 1.8
This allows bundles that don't otherwise specify an EE (for example
if the bundle contains only a plugin.xml, or is a documentation only
bundle, or otherwise does not contain any bytecode) to continue
working in environments that are supported by the latest release
of Eclipse.
Change-Id: Ic6e41c3000c85e2e4222e8153e84b7701ab0e750
Signed-off-by: Mat Booth <mat.booth@redhat.com>
---
diff --git a/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java b/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java
index 7451d97..a0dae08 100644
--- a/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java
+++ b/tycho-compiler-plugin/src/test/java/org/eclipse/tycho/osgicompiler/test/OsgiCompilerTest.java
@@ -37,7 +37,7 @@
public class OsgiCompilerTest extends AbstractTychoMojoTestCase {
private static final int TARGET_1_4 = 48;
- private static final int TARGET_9 = 53;
+ private static final int TARGET_8 = 52;
protected File storage;
@@ -235,10 +235,10 @@
List<MavenProject> projects = getSortedProjects(basedir, null);
MavenProject project;
// project with neither POM nor MANIFEST configuration => must fallback to
- // source/target level == 9
+ // source/target level == 8
project = projects.get(1);
getMojo(projects, project).execute();
- assertBytecodeMajorLevel(TARGET_9, new File(project.getBasedir(), "target/classes/Generic.class"));
+ assertBytecodeMajorLevel(TARGET_8, new File(project.getBasedir(), "target/classes/Generic.class"));
// project with multiple execution envs.
// Minimum source and target level must be taken
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
index 11f0ccf..ea67379 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 SAP SE and others.
+ * Copyright (c) 2012, 2018 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,8 +19,8 @@
import org.eclipse.tycho.core.shared.BuildFailureException;
public class ExecutionEnvironmentConfigurationImpl implements ExecutionEnvironmentConfiguration {
- // Most likely best to always be the latest known supported EE
- private static final String DEFAULT_EXECUTION_ENVIRONMENT = "JavaSE-9";
+ // Most likely best to always be the latest known supported long-term supported EE
+ private static final String DEFAULT_EXECUTION_ENVIRONMENT = "JavaSE-1.8";
private static final int PRIMARY = 0;
private static final int SECONDARY = 1;
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
index 5391eb2..f04fa21 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/ee/ExecutionEnvironmentConfigurationTest.java
@@ -45,9 +45,9 @@
@Test
public void testDefaults() {
- assertThat(subject.getProfileName(), is("JavaSE-9"));
+ assertThat(subject.getProfileName(), is("JavaSE-1.8"));
assertThat(subject.isCustomProfile(), is(false));
- assertThat(subject.getFullSpecification().getProfileName(), is("JavaSE-9"));
+ assertThat(subject.getFullSpecification().getProfileName(), is("JavaSE-1.8"));
}
@Test
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
index 54f1134..fa2ce8d 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/osgitools/EquinoxResolverTest.java
@@ -61,7 +61,7 @@
properties.put("tycho-version", TychoVersion.getTychoVersion());
List<MavenProject> projects = getSortedProjects(basedir, properties, null);
- assertEquals(6, projects.size());
+ assertEquals(7, projects.size());
assertEquals("executionenvironment.manifest-minimal", projects.get(2).getArtifactId());
ExecutionEnvironment ee = TychoProjectUtils.getExecutionEnvironmentConfiguration(projects.get(2))
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java b/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java
index e8eb7ad..a88e2e4 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/core/test/TychoTest.java
@@ -360,7 +360,7 @@
properties.put("tycho-version", TychoVersion.getTychoVersion());
List<MavenProject> projects = getSortedProjects(basedir, properties, null);
- assertEquals(6, projects.size());
+ assertEquals(7, projects.size());
int i = 0;
assertEquals("executionenvironment.manifest", projects.get(++i).getArtifactId());
@@ -377,6 +377,9 @@
assertEquals("executionenvironment.pom-default", projects.get(++i).getArtifactId());
assertEquals("OSGi/Minimum-1.2", getActiveEEProfile(projects.get(i)));
+
+ assertEquals("executionenvironment.tycho-default", projects.get(++i).getArtifactId());
+ assertEquals("JavaSE-1.8", getActiveEEProfile(projects.get(i)));
}
public void testWithProjectReferencesItself() throws Exception {
diff --git a/tycho-core/src/test/resources/projects/bree/pom.xml b/tycho-core/src/test/resources/projects/bree/pom.xml
index 1ddff1d..18c5885 100644
--- a/tycho-core/src/test/resources/projects/bree/pom.xml
+++ b/tycho-core/src/test/resources/projects/bree/pom.xml
@@ -14,6 +14,7 @@
<module>pom-hard</module>
<module>buildproperties</module>
<module>pom-default</module>
+ <module>tycho-default</module>
</modules>
</project>
diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF b/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e6d85c6
--- /dev/null
+++ b/tycho-core/src/test/resources/projects/bree/tycho-default/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: A bundle that specifies no EE at all and relies on Tycho to set one.
+Bundle-SymbolicName: executionenvironment.tycho-default
+Bundle-Version: 1.0.0
diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties b/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties
new file mode 100644
index 0000000..7b02ed4
--- /dev/null
+++ b/tycho-core/src/test/resources/projects/bree/tycho-default/build.properties
@@ -0,0 +1,2 @@
+bin.includes = META-INF/
+
diff --git a/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml b/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml
new file mode 100644
index 0000000..f538f5e
--- /dev/null
+++ b/tycho-core/src/test/resources/projects/bree/tycho-default/pom.xml
@@ -0,0 +1,15 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>executionenvironment</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <artifactId>executionenvironment.tycho-default</artifactId>
+ <version>1.0.0</version>
+ <packaging>eclipse-plugin</packaging>
+
+</project>