Calculate xmvn/lib path, allow building against older and newer surefire
This commit is contained in:
parent
f134f86115
commit
c7da1d535c
|
@ -12,10 +12,6 @@ checking. We must keep previous build version strings different to avoid
|
||||||
a cyclic dependency, but doing so causes the version checking to fail,
|
a cyclic dependency, but doing so causes the version checking to fail,
|
||||||
so we must provide a way to disable it. Disable by default.
|
so we must provide a way to disable it. Disable by default.
|
||||||
|
|
||||||
Update to using Jetty 9 API.
|
|
||||||
|
|
||||||
Update to using maven-surefire 2.18.
|
|
||||||
|
|
||||||
Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814
|
Change-Id: Ic8c0514c1fa10ee53580d2654ac6a363ccd66814
|
||||||
---
|
---
|
||||||
.../eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java | 2 +-
|
.../eclipse/tycho/p2/target/ee/CustomEEResolutionHandler.java | 2 +-
|
||||||
|
@ -38,32 +34,6 @@ index 7afa13e..82962f9 100644
|
||||||
result.add(new SystemCapability(Type.OSGI_EE, name, version));
|
result.add(new SystemCapability(Type.OSGI_EE, name, version));
|
||||||
} else if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(namespace)) {
|
} else if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(namespace)) {
|
||||||
result.add(new SystemCapability(Type.JAVA_PACKAGE, name, version));
|
result.add(new SystemCapability(Type.JAVA_PACKAGE, name, version));
|
||||||
diff --git a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java
|
|
||||||
index 6e65627..eefc753 100644
|
|
||||||
--- a/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java
|
|
||||||
+++ b/tycho-bundles/org.eclipse.tycho.test.utils/src/main/java/org/eclipse/tycho/test/util/HttpServer.java
|
|
||||||
@@ -17,6 +17,11 @@ import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
+import org.eclipse.jetty.security.ConstraintMapping;
|
|
||||||
+import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
|
||||||
+import org.eclipse.jetty.security.HashLoginService;
|
|
||||||
+import org.eclipse.jetty.server.AbstractNetworkConnector;
|
|
||||||
+import org.eclipse.jetty.server.Connector;
|
|
||||||
import org.eclipse.jetty.server.Server;
|
|
||||||
import org.eclipse.jetty.server.ServerConnector;
|
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
|
||||||
@@ -76,8 +81,7 @@ public class HttpServer extends ExternalResource {
|
|
||||||
|
|
||||||
private static RunningServer startServerOnPort(int port) throws Exception {
|
|
||||||
Server jetty = new Server();
|
|
||||||
- ServerConnector connector = new ServerConnector(jetty);
|
|
||||||
- connector.setHost("localhost");
|
|
||||||
+ AbstractNetworkConnector connector = new ServerConnector(jetty);
|
|
||||||
connector.setPort(port);
|
|
||||||
jetty.addConnector(connector);
|
|
||||||
|
|
||||||
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
|
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
|
||||||
index b00c344..bc05c2d 100644
|
index b00c344..bc05c2d 100644
|
||||||
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
|
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
|
||||||
|
|
|
@ -0,0 +1,389 @@
|
||||||
|
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
|
||||||
|
@@ -390,7 +390,7 @@
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
- <version>2.17</version>
|
||||||
|
+ <version>2.19.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF
|
||||||
|
index da31140..fb5803f 100644
|
||||||
|
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF
|
||||||
|
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF
|
||||||
|
@@ -6,6 +6,7 @@ Bundle-Version: 0.23.0
|
||||||
|
Fragment-Host: org.eclipse.tycho.surefire.osgibooter;bundle-version="0.14.0"
|
||||||
|
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
|
||||||
|
JavaSE-1.6
|
||||||
|
-Require-Bundle: org.junit;bundle-version="[3.8.0,4.0.0)"
|
||||||
|
-Bundle-ClassPath: jars/surefire-junit3-2.17.jar
|
||||||
|
+Require-Bundle: org.junit;bundle-version="[3.8.0,5.0.0)"
|
||||||
|
+Bundle-ClassPath: jars/surefire-junit3-2.19.1.jar,
|
||||||
|
+ jars/common-junit3-2.19.1.jar
|
||||||
|
Bundle-Vendor: %providerName
|
||||||
|
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
|
||||||
|
@@ -44,6 +44,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>
|
||||||
|
</execution>
|
||||||
|
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF
|
||||||
|
index 50be5ea..97760e2 100644
|
||||||
|
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF
|
||||||
|
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/META-INF/MANIFEST.MF
|
||||||
|
@@ -6,9 +6,12 @@ Bundle-Version: 0.23.0
|
||||||
|
Fragment-Host: org.eclipse.tycho.surefire.osgibooter;bundle-version="0.14.0"
|
||||||
|
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
|
||||||
|
JavaSE-1.6
|
||||||
|
-Bundle-ClassPath: jars/surefire-junit4-2.17.jar
|
||||||
|
+Bundle-ClassPath: jars/surefire-junit4-2.19.1.jar,
|
||||||
|
+ jars/common-junit3-2.19.1.jar,
|
||||||
|
+ jars/common-junit4-2.19.1.jar
|
||||||
|
Import-Package: junit.framework;version="3.0.0",
|
||||||
|
org.junit;version="4.0.0",
|
||||||
|
org.junit.runner;version="4.0.0",
|
||||||
|
+ org.junit.runner.manipulation;version="4.0.0",
|
||||||
|
org.junit.runner.notification;version="4.0.0"
|
||||||
|
Bundle-Vendor: %providerName
|
||||||
|
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
|
||||||
|
@@ -44,6 +44,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>
|
||||||
|
</execution>
|
||||||
|
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF
|
||||||
|
index 595265b..1ac6c5d 100644
|
||||||
|
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF
|
||||||
|
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit47/META-INF/MANIFEST.MF
|
||||||
|
@@ -6,9 +6,11 @@ Bundle-Version: 0.23.0
|
||||||
|
Fragment-Host: org.eclipse.tycho.surefire.osgibooter;bundle-version="0.16.0"
|
||||||
|
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||||
|
Bundle-ClassPath: .,
|
||||||
|
- jars/surefire-junit47-2.17.jar,
|
||||||
|
- jars/common-junit48-2.17.jar,
|
||||||
|
- jars/surefire-grouper-2.17.jar
|
||||||
|
+ jars/surefire-junit47-2.19.1.jar,
|
||||||
|
+ jars/common-junit48-2.19.1.jar,
|
||||||
|
+ jars/surefire-grouper-2.19.1.jar,
|
||||||
|
+ jars/common-junit3-2.19.1.jar,
|
||||||
|
+ jars/common-junit4-2.19.1.jar
|
||||||
|
Import-Package: junit.framework;version="3.0.0",
|
||||||
|
org.junit;version="[4.7,5)",
|
||||||
|
org.junit.runner;version="[4.7,5)",
|
||||||
|
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
|
||||||
|
@@ -54,6 +54,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>
|
||||||
|
</execution>
|
||||||
|
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,10 @@ Require-Bundle: org.eclipse.osgi;bundle-version="3.2.2",
|
||||||
|
Eclipse-AutoStart: true
|
||||||
|
Bundle-Version: 1.0.0
|
||||||
|
Bundle-ClassPath: .,
|
||||||
|
- jars/surefire-booter-2.17.jar,
|
||||||
|
- jars/surefire-api-2.17.jar,
|
||||||
|
- jars/maven-surefire-common-2.17.jar
|
||||||
|
+ jars/surefire-booter-2.19.1.jar,
|
||||||
|
+ jars/surefire-api-2.19.1.jar,
|
||||||
|
+ jars/maven-surefire-common-2.19.1.jar,
|
||||||
|
+ jars/plexus-utils-3.0.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
|
||||||
|
@@ -57,6 +57,11 @@
|
||||||
|
<artifactId>maven-surefire-common</artifactId>
|
||||||
|
<version>${surefire-version}</version>
|
||||||
|
</artifactItem>
|
||||||
|
+ <artifactItem>
|
||||||
|
+ <groupId>org.codehaus.plexus</groupId>
|
||||||
|
+ <artifactId>plexus-utils</artifactId>
|
||||||
|
+ <version>3.0</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 19eeab9..31e9d3e 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
|
||||||
|
@@ -21,7 +21,9 @@
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
+import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
+import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
@@ -36,12 +38,15 @@
|
||||||
|
import org.apache.maven.surefire.booter.PropertiesWrapper;
|
||||||
|
import org.apache.maven.surefire.booter.ProviderConfiguration;
|
||||||
|
import org.apache.maven.surefire.booter.ProviderFactory;
|
||||||
|
+import org.apache.maven.surefire.booter.Shutdown;
|
||||||
|
import org.apache.maven.surefire.booter.StartupConfiguration;
|
||||||
|
+import org.apache.maven.surefire.cli.CommandLineOption;
|
||||||
|
import org.apache.maven.surefire.report.ReporterConfiguration;
|
||||||
|
import org.apache.maven.surefire.report.ReporterFactory;
|
||||||
|
import org.apache.maven.surefire.suite.RunResult;
|
||||||
|
import org.apache.maven.surefire.testset.DirectoryScannerParameters;
|
||||||
|
import org.apache.maven.surefire.testset.RunOrderParameters;
|
||||||
|
+import org.apache.maven.surefire.testset.TestListResolver;
|
||||||
|
import org.apache.maven.surefire.testset.TestRequest;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@@ -62,7 +67,11 @@
|
||||||
|
File reportsDir = new File(testProps.getProperty("reportsdirectory"));
|
||||||
|
String provider = testProps.getProperty("testprovider");
|
||||||
|
String runOrder = testProps.getProperty("runOrder");
|
||||||
|
- PropertiesWrapper wrapper = new PropertiesWrapper(testProps);
|
||||||
|
+ Map<String, String> testPropsMap = new HashMap<String, String>();
|
||||||
|
+ for (Map.Entry e : testProps.entrySet()) {
|
||||||
|
+ testPropsMap.put((String) e.getKey(), (String) e.getValue());
|
||||||
|
+ }
|
||||||
|
+ PropertiesWrapper wrapper = new PropertiesWrapper(testPropsMap);
|
||||||
|
List<String> suiteXmlFiles = wrapper.getStringList(BooterConstants.TEST_SUITE_XML_FILES);
|
||||||
|
|
||||||
|
boolean forkRequested = true;
|
||||||
|
@@ -79,16 +88,17 @@
|
||||||
|
new ClassLoaderConfiguration(useSystemClassloader, useManifestOnlyJar), forkRequested, inForkedVM);
|
||||||
|
// TODO dir scanning with no includes done here (done in TestMojo already)
|
||||||
|
// but without dirScannerParams we get an NPE accessing runOrder
|
||||||
|
- DirectoryScannerParameters dirScannerParams = new DirectoryScannerParameters(testClassesDir, emptyList(),
|
||||||
|
- emptyList(), emptyList(), failIfNoTests, runOrder);
|
||||||
|
+ DirectoryScannerParameters dirScannerParams = new DirectoryScannerParameters(testClassesDir, Collections.<String>emptyList(),
|
||||||
|
+ Collections.<String>emptyList(), Collections.<String>emptyList(), failIfNoTests, runOrder);
|
||||||
|
ReporterConfiguration reporterConfig = new ReporterConfiguration(reportsDir, trimStacktrace);
|
||||||
|
- TestRequest testRequest = new TestRequest(suiteXmlFiles, testClassesDir, null);
|
||||||
|
+ TestRequest testRequest = new TestRequest(suiteXmlFiles, testClassesDir, new TestListResolver(Collections.<String> emptyList()));
|
||||||
|
ProviderConfiguration providerConfiguration = new ProviderConfiguration(dirScannerParams,
|
||||||
|
new RunOrderParameters(runOrder, null), failIfNoTests, reporterConfig, null, testRequest,
|
||||||
|
- extractProviderProperties(testProps), null, false);
|
||||||
|
+ extractProviderProperties(testProps), null, false, Collections.<CommandLineOption>emptyList(),
|
||||||
|
+ 0, Shutdown.DEFAULT);
|
||||||
|
StartupReportConfiguration startupReportConfig = new StartupReportConfiguration(useFile, printSummary,
|
||||||
|
StartupReportConfiguration.PLAIN_REPORT_FORMAT, redirectTestOutputToFile, disableXmlReport, reportsDir,
|
||||||
|
- trimStacktrace, null, "TESTHASH", false);
|
||||||
|
+ trimStacktrace, null, "TESTHASH", false, 0);
|
||||||
|
ReporterFactory reporterFactory = new DefaultReporterFactory(startupReportConfig);
|
||||||
|
// API indicates we should use testClassLoader below but surefire also tries
|
||||||
|
// to load surefire classes using this classloader
|
||||||
|
@@ -107,12 +117,12 @@
|
||||||
|
/*
|
||||||
|
* See TestMojo#mergeProviderProperties
|
||||||
|
*/
|
||||||
|
- private static Properties extractProviderProperties(Properties surefireProps) {
|
||||||
|
- Properties providerProps = new Properties();
|
||||||
|
+ private static Map<String, String> extractProviderProperties(Properties surefireProps) {
|
||||||
|
+ Map<String, String> providerProps = new HashMap<String, String>();
|
||||||
|
for (Map.Entry entry : surefireProps.entrySet()) {
|
||||||
|
String key = (String) entry.getKey();
|
||||||
|
if (key.startsWith("__provider.")) {
|
||||||
|
- providerProps.put(key.substring("__provider.".length()), entry.getValue());
|
||||||
|
+ providerProps.put(key.substring("__provider.".length()), (String)entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return providerProps;
|
||||||
|
diff --git a/tycho-surefire/pom.xml b/tycho-surefire/pom.xml
|
||||||
|
index cb2b826..bbe5f29 100644
|
||||||
|
--- a/tycho-surefire/pom.xml
|
||||||
|
+++ b/tycho-surefire/pom.xml
|
||||||
|
@@ -26,7 +26,7 @@
|
||||||
|
<name>Tycho Surefire Parent</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
- <surefire-version>2.17</surefire-version>
|
||||||
|
+ <surefire-version>2.19.1</surefire-version>
|
||||||
|
<!-- NOTE: when updating surefire version above, run BND manually to find Import-Package
|
||||||
|
statements to JUnit packages required for org.eclipse.tycho.surefire.junit* OSGi wrappers.
|
||||||
|
Surefire jars are shaded but not fully self-contained (various package dependencies to org.apache.maven.*
|
||||||
|
diff --git a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
|
||||||
|
index 9f1e332..62a16fb 100644
|
||||||
|
--- a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
|
||||||
|
+++ b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
+import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
@@ -48,6 +49,7 @@
|
||||||
|
import org.apache.maven.surefire.booter.BooterConstants;
|
||||||
|
import org.apache.maven.surefire.booter.PropertiesWrapper;
|
||||||
|
import org.apache.maven.surefire.booter.ProviderParameterNames;
|
||||||
|
+import org.apache.maven.surefire.testset.TestListResolver;
|
||||||
|
import org.apache.maven.surefire.util.DefaultScanResult;
|
||||||
|
import org.apache.maven.surefire.util.ScanResult;
|
||||||
|
import org.apache.maven.toolchain.Toolchain;
|
||||||
|
@@ -865,7 +867,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createSurefireProperties(TestFrameworkProvider provider) throws MojoExecutionException {
|
||||||
|
- PropertiesWrapper wrapper = new PropertiesWrapper(new Properties());
|
||||||
|
+ PropertiesWrapper wrapper = new PropertiesWrapper(new HashMap<String, String>());
|
||||||
|
wrapper.setProperty("testpluginname", getTestBundleSymbolicName());
|
||||||
|
wrapper.setProperty("testclassesdirectory", testClassesDirectory.getAbsolutePath());
|
||||||
|
wrapper.setProperty("reportsdirectory", reportsDirectory.getAbsolutePath());
|
||||||
|
@@ -873,8 +875,10 @@
|
||||||
|
|
||||||
|
wrapper.setProperty("failifnotests", String.valueOf(failIfNoTests));
|
||||||
|
wrapper.setProperty("runOrder", runOrder);
|
||||||
|
- Properties mergedProviderProperties = getMergedProviderProperties();
|
||||||
|
- mergedProviderProperties.putAll(provider.getProviderSpecificProperties());
|
||||||
|
+ Map<String, String> mergedProviderProperties = getMergedProviderPropertiesMap();
|
||||||
|
+ for (Map.Entry<?, ?> entry : provider.getProviderSpecificProperties().entrySet()){
|
||||||
|
+ mergedProviderProperties.put((String)entry.getKey(), (String)entry.getValue().toString());
|
||||||
|
+ }
|
||||||
|
ScanResult scanResult = scanForTests();
|
||||||
|
scanResult.writeTo(mergedProviderProperties);
|
||||||
|
for (Map.Entry<?, ?> entry : mergedProviderProperties.entrySet()) {
|
||||||
|
@@ -911,6 +915,24 @@
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private Map<String, String> getMergedProviderPropertiesMap() {
|
||||||
|
+ Map<String, String> result = new HashMap<String, String>();
|
||||||
|
+ for (Map.Entry e : providerProperties.entrySet()) {
|
||||||
|
+ result.put((String) e.getKey(), (String) e.getValue());
|
||||||
|
+ }
|
||||||
|
+ if (parallel != null) {
|
||||||
|
+ result.put(ProviderParameterNames.PARALLEL_PROP, parallel.name());
|
||||||
|
+ if (threadCount > 0) {
|
||||||
|
+ result.put(ProviderParameterNames.THREADCOUNT_PROP, String.valueOf(threadCount));
|
||||||
|
+ }
|
||||||
|
+ result.put(/* JUnitCoreParameters.PERCORETHREADCOUNT_KEY */"perCoreThreadCount",
|
||||||
|
+ String.valueOf(perCoreThreadCount));
|
||||||
|
+ result.put(/* JUnitCoreParameters.USEUNLIMITEDTHREADS_KEY */"useUnlimitedThreads",
|
||||||
|
+ String.valueOf(useUnlimitedThreads));
|
||||||
|
+ }
|
||||||
|
+ return result;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
protected ScanResult scanForTests() {
|
||||||
|
List<String> defaultIncludes = Arrays.asList("**/Test*.class", "**/*Test.class", "**/*TestCase.class");
|
||||||
|
List<String> defaultExcludes = Arrays.asList("**/*$*");
|
||||||
|
@@ -936,12 +958,20 @@
|
||||||
|
} else {
|
||||||
|
excludeList = defaultExcludes;
|
||||||
|
}
|
||||||
|
- DirectoryScanner scanner = new DirectoryScanner(testClassesDirectory, includeList, excludeList,
|
||||||
|
- Collections.<String> emptyList());
|
||||||
|
+ DirectoryScanner scanner = new DirectoryScanner(testClassesDirectory,
|
||||||
|
+ new TestListResolver(includeList, excludes != null ? excludes : defaultExcludes));
|
||||||
|
DefaultScanResult scanResult = scanner.scan();
|
||||||
|
return scanResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private void storeProperties(Map<String, String> p, File file) throws MojoExecutionException {
|
||||||
|
+ Properties props = new Properties();
|
||||||
|
+ for (Map.Entry<String, String> entry : p.entrySet()) {
|
||||||
|
+ props.setProperty(entry.getKey(), entry.getValue());
|
||||||
|
+ }
|
||||||
|
+ storeProperties(props, file);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private void storeProperties(Properties p, File file) throws MojoExecutionException {
|
||||||
|
try {
|
||||||
|
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
|
||||||
|
--- a/tycho-surefire/org.eclipse.tycho.surefire.testng/META-INF/MANIFEST.MF 2016-11-02 13:58:17.436696677 +0000
|
||||||
|
+++ b/tycho-surefire/org.eclipse.tycho.surefire.testng/META-INF/MANIFEST.MF 2016-11-02 14:00:25.344188489 +0000
|
||||||
|
@@ -6,10 +6,10 @@
|
||||||
|
Fragment-Host: org.eclipse.tycho.surefire.osgibooter
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
|
Bundle-ClassPath: .,
|
||||||
|
- jars/surefire-testng-2.17.jar,
|
||||||
|
- jars/surefire-testng-utils-2.17.jar,
|
||||||
|
- jars/surefire-grouper-2.17.jar,
|
||||||
|
- jars/common-java5-2.17.jar
|
||||||
|
+ jars/surefire-testng-2.19.1.jar,
|
||||||
|
+ jars/surefire-testng-utils-2.19.1.jar,
|
||||||
|
+ jars/surefire-grouper-2.19.1.jar,
|
||||||
|
+ jars/common-java5-2.19.1.jar
|
||||||
|
Import-Package: org.testng,
|
||||||
|
org.testng.xml
|
||||||
|
Bundle-Vendor: %providerName
|
25
tycho.spec
25
tycho.spec
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
Name: tycho
|
Name: tycho
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 9%{?dist}
|
Release: 10%{?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
|
||||||
|
|
||||||
# license file is missing but all files having some licensing information are ASL 2.0
|
# license file is missing but all files having some licensing information are ASL 2.0
|
||||||
|
@ -47,14 +47,15 @@ Source5: eclipse-bootstrap-oxygen.tar.xz
|
||||||
%endif
|
%endif
|
||||||
# Eclipse Plugin Project supporting filesystem as p2 repository
|
# Eclipse Plugin Project supporting filesystem as p2 repository
|
||||||
# https://github.com/rgrunber/fedoraproject-p2
|
# https://github.com/rgrunber/fedoraproject-p2
|
||||||
# Generated using 'git archive --prefix=fedoraproject-p2/ -o fedoraproject-p2-%{fp_p2_sha}.tar %{fp_p2_sha} && xz fedoraproject-p2-%{fp_p2_sha}.tar'
|
# Generated using 'git archive --prefix=fedoraproject-p2/ -o fedoraproject-p2-%%{fp_p2_sha}.tar %%{fp_p2_sha} && xz fedoraproject-p2-%%{fp_p2_sha}.tar'
|
||||||
Source6: fedoraproject-p2-%{fp_p2_sha}.tar.xz
|
Source6: fedoraproject-p2-%{fp_p2_sha}.tar.xz
|
||||||
# Script that can be used to install or simulate installation of P2
|
# Script that can be used to install or simulate installation of P2
|
||||||
# artifacts. It is used in OSGi requires generation.
|
# artifacts. It is used in OSGi requires generation.
|
||||||
Source7: p2-install.sh
|
Source7: p2-install.sh
|
||||||
|
|
||||||
Patch0: %{name}-fix-build.patch
|
Patch0: %{name}-fix-build.patch
|
||||||
Patch2: %{name}-fix-surefire.patch
|
Patch1: tycho-surefire-2.20.patch
|
||||||
|
Patch2: tycho-surefire-2.19.patch
|
||||||
Patch3: %{name}-use-custom-resolver.patch
|
Patch3: %{name}-use-custom-resolver.patch
|
||||||
Patch4: %{name}-maven-delegation.patch
|
Patch4: %{name}-maven-delegation.patch
|
||||||
# Additional changes needed just for bootstrap build
|
# Additional changes needed just for bootstrap build
|
||||||
|
@ -168,7 +169,11 @@ tar -xf %{SOURCE6}
|
||||||
%pom_disable_module org.fedoraproject.p2.tests fedoraproject-p2
|
%pom_disable_module org.fedoraproject.p2.tests fedoraproject-p2
|
||||||
|
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%if 0%{?fedora} >= 28
|
||||||
|
%patch1 -p1
|
||||||
|
%else
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
%endif
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
%patch7 -p0
|
%patch7 -p0
|
||||||
|
@ -344,14 +349,15 @@ install -dm 755 %{buildroot}%{_javadir}-utils/
|
||||||
install -pm 755 %{SOURCE7} %{buildroot}%{_javadir}-utils/
|
install -pm 755 %{SOURCE7} %{buildroot}%{_javadir}-utils/
|
||||||
|
|
||||||
# Symlink XMvn P2 plugin with all dependencies so that it can be loaded by XMvn
|
# Symlink XMvn P2 plugin with all dependencies so that it can be loaded by XMvn
|
||||||
install -dm 755 %{buildroot}%{_datadir}/xmvn/lib/installer/
|
xmvn_libdir=$(realpath $(dirname $(readlink -f $(which xmvn)))/../lib)
|
||||||
|
install -dm 755 %{buildroot}${xmvn_libdir}/installer/
|
||||||
%if %{eclipse_bootstrap}
|
%if %{eclipse_bootstrap}
|
||||||
ln -s %{_javadir}/tycho/org.eclipse.osgi.jar %{buildroot}%{_datadir}/xmvn/lib/installer/
|
ln -s %{_javadir}/tycho/org.eclipse.osgi.jar %{buildroot}${xmvn_libdir}/installer/
|
||||||
%else
|
%else
|
||||||
ln -s %{_javadir}/eclipse/osgi.jar %{buildroot}%{_datadir}/xmvn/lib/installer/
|
ln -s %{_javadir}/eclipse/osgi.jar %{buildroot}${xmvn_libdir}/installer/
|
||||||
%endif
|
%endif
|
||||||
ln -s %{_javadir}/tycho/xmvn-p2-installer-plugin.jar %{buildroot}%{_datadir}/xmvn/lib/installer/
|
ln -s %{_javadir}/tycho/xmvn-p2-installer-plugin.jar %{buildroot}${xmvn_libdir}/installer/
|
||||||
ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}%{_datadir}/xmvn/lib/installer/
|
ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}${xmvn_libdir}/installer/
|
||||||
|
|
||||||
%files -f .mfiles
|
%files -f .mfiles
|
||||||
%{_datadir}/xmvn/lib/installer/*
|
%{_datadir}/xmvn/lib/installer/*
|
||||||
|
@ -361,6 +367,9 @@ ln -s %{_javadir}/tycho/org.fedoraproject.p2.jar %{buildroot}%{_datadir}/xmvn/li
|
||||||
%files javadoc -f .mfiles-javadoc
|
%files javadoc -f .mfiles-javadoc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Dec 08 2017 Mat Booth <mat.booth@redhat.com> - 1.0.0-10
|
||||||
|
- Calculate xmvn/lib path, allow building against older and newer surefire
|
||||||
|
|
||||||
* Wed Oct 11 2017 Mat Booth <mat.booth@redhat.com> - 1.0.0-9
|
* Wed Oct 11 2017 Mat Booth <mat.booth@redhat.com> - 1.0.0-9
|
||||||
- Port to latest surefire
|
- Port to latest surefire
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue