android_sdk: exclude test-only androidx host stub from perfetto_trace_lib_host_stubs
perfetto_trace_lib_host_stubs globs src/android_sdk/java/host_stubs/**/*.java,
which sweeps in androidx/test/ext/junit/runners/AndroidJUnit4.java. That stub
extends BlockJUnit4ClassRunner (org.junit.runners), but this library does not --
and should not -- depend on JUnit, so the Soong host build fails:
host_stubs/androidx/test/ext/junit/runners/AndroidJUnit4.java:
error: package org.junit.runners does not exist
The AndroidJUnit4 stub exists only for the standalone host runner
(tools/run_android_sdk_host_test), which compiles host_stubs with JUnit on the
classpath -- that is why it never failed there. It is not one of the SDK host
shims this library provides (dalvik annotations, SystemCleaner, android.util.*,
android.os.Process), and the Soong host/ravenwood build uses the real
androidx.test. Exclude androidx/** from the library.
Change-Id: I9487c66806e4b429904105dff3d38e905f6d12bb
diff --git a/Android.bp.extras b/Android.bp.extras
index c0d9dcb..10cf846 100644
--- a/Android.bp.extras
+++ b/Android.bp.extras
@@ -353,4 +353,14 @@
srcs: [
"src/android_sdk/java/host_stubs/**/*.java",
],
+ // androidx/** is a test-only shim (AndroidJUnit4) for the standalone host
+ // JUnit runner (tools/run_android_sdk_host_test), which compiles host_stubs
+ // with JUnit on the classpath. It is not one of the SDK host shims this
+ // library is meant to provide (see the comment above) and pulling it in here
+ // drags in org.junit, which this library does not depend on -- breaking the
+ // Soong host build. The Soong host/ravenwood build uses the real
+ // androidx.test, so exclude it.
+ exclude_srcs: [
+ "src/android_sdk/java/host_stubs/androidx/**/*.java",
+ ],
}