[tycho] Fix Surfire test plugin.

Roland Grunberg rgrunber at fedoraproject.org
Mon Jun 11 18:43:13 UTC 2012


commit 416b07468268dfcc31b26add86b05c4171f63c89
Author: Roland Grunberg <rgrunber at redhat.com>
Date:   Tue May 29 15:04:45 2012 -0400

    Fix Surfire test plugin.
    
    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.

 tycho-bootstrap.patch      |    2 +-
 tycho-fix-build.patch      |   10 ---
 tycho-fix-surefire.patch   |  160 ++++++++++++++++++++++++++++++++++++++++++++
 tycho-maven-surefire.patch |   30 ++++++--
 tycho.spec                 |   21 ++++--
 5 files changed, 196 insertions(+), 27 deletions(-)
---
diff --git a/tycho-bootstrap.patch b/tycho-bootstrap.patch
index 51482cb..0592128 100644
--- a/tycho-bootstrap.patch
+++ b/tycho-bootstrap.patch
@@ -670,8 +670,8 @@ diff -rauN tycho-0.14.x.old/tycho-surefire/org.eclipse.tycho.surefire.osgibooter
 --- tycho-0.14.x.old/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF	2012-02-24 06:40:15.000000000 -0500
 +++ tycho-0.14.x/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF	2012-03-30 14:49:39.000000000 -0400
 @@ -7,7 +7,7 @@
-  jars/surefire-booter-2.10.jar,
   jars/surefire-api-2.10.jar,
+  jars/plexus-utils-3.0.jar,
   jars/maven-surefire-common-2.10.jar
 -Bundle-Version: 0.14.1
 +Bundle-Version: 0.14.1.qualifier
diff --git a/tycho-fix-build.patch b/tycho-fix-build.patch
index f78242c..3265ec3 100644
--- a/tycho-fix-build.patch
+++ b/tycho-fix-build.patch
@@ -97,16 +97,6 @@
          } catch (BundleException e) {
              throw new OsgiManifestParserException(location, e);
          }
---- ./tycho-0.14.0.old/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF	2012-02-06 10:26:59.000000000 -0500
-+++ ./tycho-0.14.0/tycho-surefire/org.eclipse.tycho.surefire.junit/META-INF/MANIFEST.MF	2012-02-14 12:04:02.275017810 -0500
-@@ -6,6 +6,6 @@
- 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)"
-+Require-Bundle: org.junit;bundle-version="[3.8.0,4.9.0)"
- Bundle-ClassPath: jars/surefire-junit3-2.10.jar
- Bundle-Vendor: %providerName
 --- ./tycho-0.14.x.old/tycho-core/src/main/java/org/eclipse/tycho/core/utils/EEVersion.java	2012-02-24 06:40:15.000000000 -0500
 +++ ./tycho-0.14.x/tycho-core/src/main/java/org/eclipse/tycho/core/utils/EEVersion.java	2012-05-03 14:09:09.000000000 -0400
 @@ -18,7 +18,7 @@
diff --git a/tycho-fix-surefire.patch b/tycho-fix-surefire.patch
new file mode 100644
index 0000000..2419e2d
--- /dev/null
+++ b/tycho-fix-surefire.patch
@@ -0,0 +1,160 @@
+From 5ddb88911071664de0e07f7f247aeeaedecc8cab Mon Sep 17 00:00:00 2001
+From: Roland Grunberg <rgrunber at redhat.com>
+Date: Tue, 29 May 2012 14:27:27 -0400
+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.
+---
+ pom.xml                                            |    2 +-
+ .../META-INF/MANIFEST.MF                           |    5 +++--
+ .../build.properties                               |    2 +-
+ .../org.eclipse.tycho.surefire.junit/pom.xml       |    5 +++++
+ .../META-INF/MANIFEST.MF                           |    4 +++-
+ .../build.properties                               |    2 +-
+ .../org.eclipse.tycho.surefire.junit4/pom.xml      |   10 ++++++++++
+ .../META-INF/MANIFEST.MF                           |    3 ++-
+ .../org.eclipse.tycho.surefire.osgibooter/pom.xml  |    5 +++++
+ 9 files changed, 31 insertions(+), 7 deletions(-)
+
+diff --git a/pom.xml b/pom.xml
+index e9d8624..ca20999 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -79,7 +79,7 @@
+ 		<junitVersion>3.8.2</junitVersion>
+ 		<plexusVersion>1.5.5</plexusVersion>
+ 		<plexusInterpolationVersion>1.14</plexusInterpolationVersion>
+-		<plexusUtilsVersion>2.0.4</plexusUtilsVersion>
++		<plexusUtilsVersion>3.0</plexusUtilsVersion>
+ 		<sisuInjectVersion>1.4.2</sisuInjectVersion>
+ 		<wagonVersion>1.0-beta-6</wagonVersion>
+ 		<securityDispatcherVersion>1.3</securityDispatcherVersion>
+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 9264109..a27abe4 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.14.1
+ 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.10.jar
++Require-Bundle: org.junit;bundle-version="[3.8.0,4.9.0)"
++Bundle-ClassPath: jars/surefire-junit3-2.10.jar,
++ jars/common-junit3-2.10.jar
+ Bundle-Vendor: %providerName
+diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/build.properties b/tycho-surefire/org.eclipse.tycho.surefire.junit/build.properties
+index 499ce76..fe88b19 100644
+--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/build.properties
++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/build.properties
+@@ -9,5 +9,5 @@
+ #    Sonatype Inc. - initial API and implementation
+ ###############################################################################
+ bin.includes = META-INF/,\
+-               jars/surefire-junit3-2.10.jar,\
++               jars/,\
+                plugin.properties
+diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
+index 2a4afc8..ae35035 100644
+--- a/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit/pom.xml
+@@ -47,6 +47,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 bbb54a8..82e66d1 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,7 +6,9 @@ Bundle-Version: 0.14.1
+ 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.10.jar
++Bundle-ClassPath: jars/surefire-junit4-2.10.jar,
++ jars/common-junit3-2.10.jar,
++ jars/common-junit4-2.10.jar
+ Import-Package: junit.framework;version="4.0.0",
+  org.junit;version="4.0.0",
+  org.junit.runner;version="4.0.0",
+diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/build.properties b/tycho-surefire/org.eclipse.tycho.surefire.junit4/build.properties
+index b787149..fe88b19 100644
+--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/build.properties
++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/build.properties
+@@ -9,5 +9,5 @@
+ #    Sonatype Inc. - initial API and implementation
+ ###############################################################################
+ bin.includes = META-INF/,\
+-               jars/surefire-junit4-2.10.jar,\
++               jars/,\
+                plugin.properties
+diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
+index 08ab16a..2ed7c3a 100644
+--- a/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
++++ b/tycho-surefire/org.eclipse.tycho.surefire.junit4/pom.xml
+@@ -71,6 +71,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.osgibooter/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
+index fda57c6..ab5de08 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,7 +5,8 @@ Require-Bundle: org.eclipse.osgi;bundle-version="3.2.2",
+ Eclipse-AutoStart: true
+ Bundle-ClassPath: .,
+  jars/surefire-booter-2.10.jar,
+- jars/surefire-api-2.10.jar
++ jars/surefire-api-2.10.jar,
++ jars/plexus-utils-3.0.jar
+ Bundle-Version: 0.14.1
+ Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application (Incubation)
+ Bundle-ManifestVersion: 2
+diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
+index cd5b2d7..d1d24da 100644
+--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
++++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
+@@ -52,6 +52,11 @@
+ 									<artifactId>surefire-booter</artifactId>
+ 									<version>${surefire-version}</version>
+ 								</artifactItem>
++								<artifactItem>
++									<groupId>org.codehaus.plexus</groupId>
++									<artifactId>plexus-utils</artifactId>
++									<version>${plexusUtilsVersion}</version>
++								</artifactItem>
+ 							</artifactItems>
+ 						</configuration>
+ 					</execution>
+-- 
+1.7.7.6
+
diff --git a/tycho-maven-surefire.patch b/tycho-maven-surefire.patch
index bf808cf..e321083 100644
--- a/tycho-maven-surefire.patch
+++ b/tycho-maven-surefire.patch
@@ -11,12 +11,12 @@
                  throw new MojoFailureException(message);
 --- ./tycho-0.14.x.old/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF	2012-02-24 06:40:15.000000000 -0500
 +++ ./tycho-0.14.x/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF	2012-03-09 14:53:53.000000000 -0500
-@@ -5,7 +5,8 @@
- Eclipse-AutoStart: true
+@@ -6,7 +6,8 @@
  Bundle-ClassPath: .,
   jars/surefire-booter-2.10.jar,
-- jars/surefire-api-2.10.jar
-+ jars/surefire-api-2.10.jar,
+  jars/surefire-api-2.10.jar,
+- jars/plexus-utils-3.0.jar
++ jars/plexus-utils-3.0.jar,
 + jars/maven-surefire-common-2.10.jar
  Bundle-Version: 0.14.1
  Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application (Incubation)
@@ -70,10 +70,10 @@
          RunResult result = surefireStarter.runSuitesInProcess();
 --- ./tycho-0.14.x.old/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml	2012-02-24 06:40:15.000000000 -0500
 +++ ./tycho-0.14.x/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml	2012-03-09 14:45:54.987999986 -0500
-@@ -51,6 +51,13 @@
- 									<groupId>org.apache.maven.surefire</groupId>
- 									<artifactId>surefire-booter</artifactId>
- 									<version>${surefire-version}</version>
+@@ -56,6 +56,13 @@
+ 									<groupId>org.codehaus.plexus</groupId>
+ 									<artifactId>plexus-utils</artifactId>
+ 									<version>${plexusUtilsVersion}</version>
 +
 +								</artifactItem>
 +								<artifactItem>
@@ -84,3 +84,17 @@
  								</artifactItem>
  							</artifactItems>
  						</configuration>
+--- ./tycho-0.14.x.old/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/TychoClasspathConfiguration.java	2012-02-24 06:40:15.000000000 -0500
++++ ./tycho-0.14.x/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/TychoClasspathConfiguration.java	2012-05-29 16:45:39.000000000 -0400
+@@ -30,6 +30,11 @@
+     }
+ 
+     @Override
++    public ClassLoader createInprocSurefireClassLoader(ClassLoader parent) throws SurefireExecutionException {
++        return surefireClassLoader;
++    }
++
++    @Override
+     public ClassLoader createTestClassLoader() throws SurefireExecutionException {
+         return testClassLoader;
+     }
diff --git a/tycho.spec b/tycho.spec
index e7faeb9..df3181c 100644
--- a/tycho.spec
+++ b/tycho.spec
@@ -1,4 +1,4 @@
-%global bootstrap 0
+%global bootstrap 1
 
 %if %{bootstrap}
 %global snap -SNAPSHOT
@@ -8,7 +8,7 @@
 
 Name:           tycho
 Version:        0.14.1
-Release:        4%{?dist}
+Release:        4.1%{?dist}
 Summary:        Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
 
 Group:          Development/Libraries
@@ -26,14 +26,15 @@ Source1:        EmptyMojo.java
 Source2:        depmap.xml
 
 Patch0:	%{name}-fix-build.patch
+Patch1:	%{name}-fix-surefire.patch
 # Upstream builds against maven-surefire 2.10 but in rawhide we have 2.12
-Patch1:	%{name}-maven-surefire.patch
-Patch2:	%{name}-use-custom-resolver.patch
+Patch2:	%{name}-maven-surefire.patch
+Patch3:	%{name}-use-custom-resolver.patch
 # Set some temporary build version so that the bootstrapped build has
 # a different version from the nonbootstrapped. Otherwise there will
 # be cyclic dependencies.
 %if %{bootstrap}
-Patch3:	%{name}-bootstrap.patch
+Patch4:	%{name}-bootstrap.patch
 %endif
 
 BuildArch:      noarch
@@ -109,10 +110,11 @@ This package contains the API documentation for %{name}.
 %setup -q -n %{name}-0.14.x
 
 %patch0 -p2
-%patch1 -p2
-%patch2 -p1
-%if %{bootstrap}
+%patch1 -p1
+%patch2 -p2
 %patch3 -p1
+%if %{bootstrap}
+%patch4 -p1
 %endif
 
 find tycho-core -iname '*html' -delete
@@ -193,6 +195,9 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}
 %{_javadocdir}/%{name}
 
 %changelog
+* Tue May 29 2012 Roland Grunberg <rgrunber at redhat.com> 0.14.1-4.1
+- Fix Tycho Surfire to run Eclipse test bundles.
+
 * Wed May 23 2012 Roland Grunberg <rgrunber at redhat.com> 0.14.1-4
 - Non-bootstrap build.
 


More information about the scm-commits mailing list