tycho/build-against-surefire-2.21...

177 lines
8.9 KiB
Diff

From d4d161e7ccfb21503e906229a37000eb9a821284 Mon Sep 17 00:00:00 2001
From: Jan Sievers <jan.sievers@sap.com>
Date: Tue, 4 Sep 2012 16:02:52 +0200
Subject: [PATCH] Resolve all necessary dependencies for Tycho Surefire.
When running an Eclipse bundle's tests, Tycho Surefire resolves its
runtime dependencies using a class loader, which is in fact just looking
through Bundle-ClassPath. As a result, it must copy over and include
system jars in its Bundle-ClassPath. We use Fedora system jars to
satisfy these dependencies but even these jars differ slightly in terms
of provided classes. This patch addresses this issue.
Basically, the jars added to the Bundle-ClassPath in this patch, provide
the additional classes that are in the original jars used upstream.
Change-Id: I9ef0239eed887fa47c380efcdce968934c788c9f
---
pom.xml | 2 +-
.../META-INF/MANIFEST.MF | 5 ++--
.../org.eclipse.tycho.surefire.junit/pom.xml | 5 ++++
.../META-INF/MANIFEST.MF | 5 +++-
.../org.eclipse.tycho.surefire.junit4/pom.xml | 10 ++++++++
.../META-INF/MANIFEST.MF | 8 ++++---
.../org.eclipse.tycho.surefire.junit47/pom.xml | 10 ++++++++
.../META-INF/MANIFEST.MF | 7 +++---
.../org.eclipse.tycho.surefire.osgibooter/pom.xml | 5 ++++
.../surefire/osgibooter/OsgiSurefireBooter.java | 20 ++++++++++------
tycho-surefire/pom.xml | 2 +-
.../java/org/eclipse/tycho/surefire/TestMojo.java | 27 +++++++++++++++++++---
12 files changed, 85 insertions(+), 21 deletions(-)
diff --git a/pom.xml b/pom.xml
index c43cc8d..6e5fde4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
<pluginToolsVersion>3.3</pluginToolsVersion>
<maven-version>3.0</maven-version>
<!-- NOTE: when updating surefire version, double-check Import-Package statements generated by bnd-maven-plugin and possibly adapt instructions in various bnd.bnd files -->
- <surefire-version>2.19.1</surefire-version>
+ <surefire-version>2.21.0</surefire-version>
<!-- dependencies to Eclipse artifacts deployed by tycho-releng/ -->
<equinoxVersion>3.13.0.v20180226-1711</equinoxVersion>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
index f99c319..0224cc6 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
@@ -36,6 +36,11 @@
<artifactId>surefire-junit3</artifactId>
<version>${surefire-version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit3</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
</artifactItems>
</configuration>
</plugin>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
index 9628b06..2a09e91 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
@@ -36,6 +36,16 @@
<artifactId>surefire-junit4</artifactId>
<version>${surefire-version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit3</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit4</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
</artifactItems>
</configuration>
</plugin>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
index dc49a46..db453ac 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit47/pom.xml
@@ -46,6 +46,16 @@
<artifactId>surefire-grouper</artifactId>
<version>${surefire-version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit4</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>common-junit3</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
</artifactItems>
</configuration>
</plugin>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
index 991edc1..83732d5 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
@@ -5,9 +5,11 @@ Require-Bundle: org.eclipse.osgi;bundle-version="3.2.2",
Eclipse-AutoStart: true
Bundle-Version: 1.2.0
Bundle-ClassPath: .,
- jars/surefire-booter-2.19.1.jar,
- jars/surefire-api-2.19.1.jar,
- jars/maven-surefire-common-2.19.1.jar
+ jars/surefire-booter-2.21.0.jar,
+ jars/surefire-api-2.21.0.jar,
+ jars/surefire-logger-api-2.21.0.jar,
+ jars/maven-surefire-common-2.21.0.jar,
+ jars/maven-shared-utils-3.2.1.jar
Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.tycho.surefire.osgibooter;singleton:=true
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
index 82700eb..3fbc3a3 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
@@ -59,6 +59,11 @@
</artifactItem>
<artifactItem>
<groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-logger-api</artifactId>
+ <version>${surefire-version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-booter</artifactId>
<version>${surefire-version}</version>
</artifactItem>
@@ -67,6 +72,11 @@
<artifactId>maven-surefire-common</artifactId>
<version>${surefire-version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-shared-utils</artifactId>
+ <version>3.2.1</version>
+ </artifactItem>
</artifactItems>
</configuration>
</execution>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
index 033766c4..fe8105b9 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
@@ -28,6 +28,7 @@ import java.util.Properties;
import java.util.Set;
import org.apache.maven.plugin.surefire.StartupReportConfiguration;
+import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
import org.apache.maven.surefire.booter.BooterConstants;
import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
@@ -97,11 +98,11 @@ public class OsgiSurefireBooter {
ProviderConfiguration providerConfiguration = new ProviderConfiguration(dirScannerParams,
new RunOrderParameters(runOrder, null), failIfNoTests, reporterConfig, null, testRequest,
extractProviderProperties(testProps), null, false, Collections.<CommandLineOption> emptyList(),
- skipAfterFailureCount, Shutdown.DEFAULT);
+ skipAfterFailureCount, Shutdown.DEFAULT, 0);
StartupReportConfiguration startupReportConfig = new StartupReportConfiguration(useFile, printSummary,
StartupReportConfiguration.PLAIN_REPORT_FORMAT, redirectTestOutputToFile, disableXmlReport, reportsDir,
- trimStacktrace, null, "TESTHASH", false, rerunFailingTestsCount);
- ReporterFactory reporterFactory = new DefaultReporterFactory(startupReportConfig);
+ trimStacktrace, null, new File(reportsDir, "TESTHASH"), false, rerunFailingTestsCount, null);
+ ReporterFactory reporterFactory = new DefaultReporterFactory(startupReportConfig, new NullConsoleLogger());
// API indicates we should use testClassLoader below but surefire also tries
// to load surefire classes using this classloader
RunResult result = ProviderFactory.invokeProvider(null, createCombinedClassLoader(testPlugin), reporterFactory,