summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2017-07-05 09:51:25 +0100
committer Paul Duffin <paulduffin@google.com> 2017-07-05 10:09:52 +0100
commit8eaf94be5252779f89ebb6226cfbcfa5683244a1 (patch)
treef710b0bfedd712345153b41c24cb5d1922b271b7
parent3594b9f4fda1e83c48aba8ace4c688d5c0ea21c6 (diff)
Add repackaged legacy-test and android.test.runner
The CtsSignatureTestCases test verifies that the API described in the api/current.txt file is actually available at runtime. The test class, SignatureTest, requires junit and android.test classes, some from legacy-test, some from android.test.runner which makes it impossible (without classpath scanning) for it to verify that those classes are accessible at runtime when they should be and inaccessible when they should not be which is needed for the work to remove JUnit from the Android API. This change uses jarjar to repackage the junit and android.test classes into repackaged.junit and repackaged.android.test packages in the repackaged-legacy-test and repackaged.android.test.runner modules respectively. A follow on change will switch SignatureTest over to using the repackaged classes thus allowing it to work even when junit and android.test classes are not visible. Tested by making the modules and manually verifying that they contain the classes in the repackaged package. Bug: 35192974 Bug: 30188076 Test: see above Change-Id: If0355a0d50b7540f416d464fdf7ffae0e4766b1c
-rw-r--r--legacy-test/Android.mk14
-rw-r--r--legacy-test/jarjar-rules.txt2
-rw-r--r--test-runner/Android.mk14
3 files changed, 30 insertions, 0 deletions
diff --git a/legacy-test/Android.mk b/legacy-test/Android.mk
index ae5ae1a26055..ef2950b2f026 100644
--- a/legacy-test/Android.mk
+++ b/legacy-test/Android.mk
@@ -31,6 +31,20 @@ LOCAL_JAVA_LIBRARIES := core-oj core-libart framework
include $(BUILD_JAVA_LIBRARY)
+# Build the repackaged-legacy-test library
+# ========================================
+# This contains repackaged versions of the classes from legacy-test.
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE := repackaged-legacy-test
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj core-libart framework
+LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
# Generate the stub source files for legacy.test.stubs
# ====================================================
include $(CLEAR_VARS)
diff --git a/legacy-test/jarjar-rules.txt b/legacy-test/jarjar-rules.txt
new file mode 100644
index 000000000000..9077e6f8ba26
--- /dev/null
+++ b/legacy-test/jarjar-rules.txt
@@ -0,0 +1,2 @@
+rule junit.** repackaged.junit.@1
+rule android.test.** repackaged.android.test.@1
diff --git a/test-runner/Android.mk b/test-runner/Android.mk
index b41dadb2950e..9053b23cfe9a 100644
--- a/test-runner/Android.mk
+++ b/test-runner/Android.mk
@@ -30,6 +30,20 @@ LOCAL_MODULE:= android.test.runner
include $(BUILD_JAVA_LIBRARY)
+# Build the repackaged.android.test.runner library
+# ================================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_JAVA_LIBRARIES := core-oj core-libart framework legacy-test
+
+LOCAL_JARJAR_RULES := $(LOCAL_PATH)/../legacy-test/jarjar-rules.txt
+
+LOCAL_MODULE:= repackaged.android.test.runner
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
# Generate the stub source files for android.test.runner.stubs
# ============================================================
include $(CLEAR_VARS)