Build junit for android.test.runner.

Build the junit classes that go into android.test.runner from
external/junit, rather than having copies of the code in frameworks/base.

Bug 5826326

Change-Id: I363d0788d4ac1890aef0aa5a7e867175f667b8d5
diff --git a/Android.mk b/Android.mk
index 1de665c..d0053cc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -26,11 +26,8 @@
 # note: ideally this should be junit-host, but leave as is for now to avoid
 # changing all its dependencies
 LOCAL_MODULE := junit
-
 LOCAL_MODULE_TAGS := optional
-
 LOCAL_STATIC_JAVA_LIBRARIES := hamcrest-host
-
 include $(BUILD_HOST_JAVA_LIBRARY)
 
 # ----------------------------------
@@ -71,6 +68,17 @@
 endif
 
 #-------------------------------------------------------
+# build a junit-runner jar representing the
+# junit classes in the frameworks/base android.test.runner.jar
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(junit-runner-files)
+LOCAL_MODULE := junit-runner
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+#-------------------------------------------------------
 # build a junit4-target jar representing the
 # classes in external/junit that are not in the core public API 4
 # Note: 'core' here means excluding the classes that are contained
@@ -95,7 +103,3 @@
 LOCAL_STATIC_JAVA_LIBRARIES := hamcrest
 include $(BUILD_STATIC_JAVA_LIBRARY)
 
-
-
-
-
diff --git a/Common.mk b/Common.mk
index 2275c9b..593bec1 100644
--- a/Common.mk
+++ b/Common.mk
@@ -6,8 +6,6 @@
 
 # List of source to build into the core-junit library
 #
-# The list also includes all junit files in public API.
-#
 core-junit-files := \
 src/junit/framework/Assert.java \
 src/junit/framework/AssertionFailedError.java \
@@ -21,11 +19,21 @@
 src/junit/framework/TestResult.java \
 src/junit/framework/TestSuite.java
 
-# TODO: add define for public API files in android.test.runner
+# List of source to build into the android.test.runner library
+#
+junit-runner-files := \
+src/junit/runner/BaseTestRunner.java \
+src/junit/runner/TestRunListener.java \
+src/junit/runner/TestSuiteLoader.java \
+src/junit/runner/StandardTestSuiteLoader.java \
+src/junit/runner/Version.java \
+src/junit/textui/ResultPrinter.java \
+src/junit/textui/TestRunner.java
 
 # List of junit javadoc source files for Android public API
 #
 # $(1): directory for search (to support use from frameworks/base)
 define junit_to_document
- $(core-junit-files)
+ $(core-junit-files) \
+ $(junit-runner-files)
 endef
diff --git a/src/junit/runner/TestSuiteLoader.java b/src/junit/runner/TestSuiteLoader.java
index 75a96fe..9cc6d81 100644
--- a/src/junit/runner/TestSuiteLoader.java
+++ b/src/junit/runner/TestSuiteLoader.java
@@ -3,9 +3,8 @@
 /**
  * An interface to define how a test suite should be loaded.
  *
- * // android-changed
- * @deprecated unused and not present in current upstream JUnit
  */
+//  TODO: deprecate
 public interface TestSuiteLoader {
     abstract public Class load(String suiteClassName) throws ClassNotFoundException;
     abstract public Class reload(Class aClass) throws ClassNotFoundException;
diff --git a/src/junit/textui/package.html b/src/junit/textui/package.html
new file mode 100644
index 0000000..723f2ae
--- /dev/null
+++ b/src/junit/textui/package.html
@@ -0,0 +1,6 @@
+<HTML>
+<BODY>
+Utility classes supporting the junit test framework.
+{@hide} - Not needed for 1.0 SDK
+</BODY>
+</HTML>