Copy junit-runner in from twitter/commons.

Review Request #2043 - Created April 7, 2015 and submitted

Information
John Sirois
pants
jsirois/jvm_tools/adopt_junit_runner
1362, 1379
c2139fb...
Reviewers
pants-reviews
benjyw, stuhood, zundel
This ports the junit-runner used by pants but does not actually
configure pants to use the ported runner.  That will come later after
the tool is published: https://github.com/pantsbuild/pants/issues/1361

The junit-runner in twitter/commons will be deleted after this tool is
published and consumed by pants HEAD.

 3rdparty/BUILD                                                                             |   5 +
 BUILD                                                                                      |   5 +-
 src/java/org/pantsbuild/junit/annotations/BUILD                                            |  12 +
 src/java/org/pantsbuild/junit/annotations/TestParallel.java                                |  21 ++
 src/java/org/pantsbuild/junit/annotations/TestSerial.java                                  |  21 ++
 src/java/org/pantsbuild/tools/junit/AbortableListener.java                                 |  75 ++++++
 src/java/org/pantsbuild/tools/junit/AnnotatedClassRequest.java                             |  45 ++++
 src/java/org/pantsbuild/tools/junit/AntJunitXmlReportListener.java                         | 445 +++++++++++++++++++++++++++++++
 src/java/org/pantsbuild/tools/junit/BUILD                                                  |  36 +++
 src/java/org/pantsbuild/tools/junit/CompositeRequest.java                                  |  79 ++++++
 src/java/org/pantsbuild/tools/junit/ConcurrentCompositeRequest.java                        |  49 ++++
 src/java/org/pantsbuild/tools/junit/ConcurrentRunnerScheduler.java                         |  99 +++++++
 src/java/org/pantsbuild/tools/junit/ConsoleListener.java                                   |  26 ++
 src/java/org/pantsbuild/tools/junit/ConsoleRunner.java                                     | 712 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/java/org/pantsbuild/tools/junit/ForwardingListener.java                                | 103 ++++++++
 src/java/org/pantsbuild/tools/junit/ListenerRegistry.java                                  |  19 ++
 src/java/org/pantsbuild/tools/junit/PerClassConsoleListener.java                           |  33 +++
 src/java/org/pantsbuild/tools/junit/StreamSource.java                                      |  30 +++
 src/java/org/pantsbuild/tools/junit/Util.java                                              |  50 ++++
 src/java/org/pantsbuild/tools/junit/withretry/AllDefaultPossibilitiesBuilderWithRetry.java |  30 +++
 src/java/org/pantsbuild/tools/junit/withretry/BUILD                                        |  15 ++
 src/java/org/pantsbuild/tools/junit/withretry/BlockJUnit4ClassRunnerWithRetry.java         |  84 ++++++
 src/java/org/pantsbuild/tools/junit/withretry/JUnit4BuilderWithRetry.java                  |  30 +++
 tests/java/org/pantsbuild/tools/junit/BUILD                                                |  11 +
 tests/java/org/pantsbuild/tools/junit/ConsoleRunnerTest.java                               | 111 ++++++++
 tests/java/org/pantsbuild/tools/junit/FlakyTest.java                                       |  99 +++++++
 tests/java/org/pantsbuild/tools/junit/MockTest1.java                                       |  24 ++
 tests/java/org/pantsbuild/tools/junit/MockTest2.java                                       |  19 ++
 tests/java/org/pantsbuild/tools/junit/MockTest3.java                                       |  19 ++
 tests/java/org/pantsbuild/tools/junit/README                                               |  55 ++++
 tests/java/org/pantsbuild/tools/junit/TestRegistry.java                                    |  55 ++++
 31 files changed, 2415 insertions(+), 2 deletions(-)

I dogfooded the runner to test itself via:

$ pants.dev clean-all test {src,tests}/java/::

And by using the instructions in
tests/java/org/pantsbuild/tools/junit/README with the following diff:

$ git diff
diff --git a/BUILD.tools b/BUILD.tools
index fc53e75..da0a936 100644
--- a/BUILD.tools
+++ b/BUILD.tools
@@ -123,7 +123,8 @@ jar_library(name = 'junit',
             jars = [
               jar(org = 'junit', name = 'junit-dep', rev = '4.10'),
               jar(org = 'org.hamcrest', name = 'hamcrest-core', rev = '1.2'),
-              jar(org = 'com.twitter.common', name = 'junit-runner', rev = '0.0.41'),
+              jar(org = 'org.pantsbuild', name = 'junit-runner', rev = 'none', mutable = True,
+                  url = 'file:///home/jsirois/dev/3rdparty/jsirois-pants4/dist/junit-runner.jar'),

               # TODO(Eric Ayers) We need to rename/shade the dependencies of junit-runner
               #      or use a custom classloader for junit runner to permanently
diff --git a/src/python/pants/backend/jvm/tasks/junit_run.py b/src/python/pants/backend/jvm/tasks/junit_run.py
index 0c48798..509bf26 100644
--- a/src/python/pants/backend/jvm/tasks/junit_run.py
+++ b/src/python/pants/backend/jvm/tasks/junit_run.py
@@ -649,7 +649,7 @@ class Cobertura(_Coverage):


 class JUnitRun(JvmTask, JvmToolTaskMixin):
-  _MAIN = 'com.twitter.common.junit.runner.ConsoleRunner'
+  _MAIN = 'org.pantsbuild.tools.junit.ConsoleRunner'

   @classmethod
   def register_options(cls, register):

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/57658118

John Sirois
John Sirois
John Sirois
John Sirois
Benjy Weinberger
John Sirois
Benjy Weinberger
John Sirois
Eric Ayers
John Sirois
Eric Ayers
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...