library: batch the pure classes in ml, avatar, e2ee-p2p, map, ocr
- Commit
b1b1e6d8eb05453b9f38d293d27023aa730dca76- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-21 23:23 UTC (14 days ago)
- Parents
b476feb
Same split audit across five library modules: real JNI loaders stay in per-class companions, pure classes batch at 20 (ml's Gemma math, e2ee's InviteFingerprint, map's projection/render-thread tests, ocr's mapping test). Counts identical before/after everywhere (97/22/14/101/16). library/e2ee-openpgp deliberately skipped - its single test class loads the PGP native in every test, so a split moves nothing. One pre-existing library/map failure (MapDeepTest reflective PointerInputChange construction) fails identically in both configurations and is triaged separately.
Diff
library/avatar/build.gradle.kts
diff --git a/library/avatar/build.gradle.kts b/library/avatar/build.gradle.ktsindex 85ac895ddd..5cc02d85e3 100644--- a/library/avatar/build.gradle.kts+++ b/library/avatar/build.gradle.kts@@ -35,3 +35,26 @@ rustNativeLib( // yuu_avatar_gles.* are GLSL ES, compiled at run time by the GLES path. shaders = listOf("yuu_avatar.vert", "yuu_avatar.frag"), )++// Only YuuPoseTest never loads a native library (the pure pose gallery).+// Every other class reaches YuuAvatarNative: YuuAvatarNativeTest drives+// the JNI bridge directly against the host libyuu_avatar, YuuAvatarAssetsTest+// goes through adoptBundledMesh/handOff (both gated on+// YuuAvatarNative.isAvailable, and handOff forwards the fd natively), and+// the components tests compose YuuAvatar3D / drive YuuAvatarSurfaceView,+// whose first check is YuuAvatarNative.isAvailable. Quarantine those+// loaders into testDebugUnitTestNative (forkEvery = 1); YuuPoseTest+// batches 20-per-JVM in testDebugUnitTest, which depends on the+// quarantine task so the usual invocation still runs everything. No+// isolatedClasses: no DataStore/ViewModel or process-wide singleton here.+rustNativeTests {+ nativeClasses.addAll(+ listOf(+ "com.vayunmathur.library.avatar.YuuAvatarAssetsTest",+ "com.vayunmathur.library.avatar.YuuAvatarNativeTest",+ "com.vayunmathur.library.avatar.components.YuuAvatar3DLifecycleTest",+ "com.vayunmathur.library.avatar.components.YuuAvatar3DTest",+ "com.vayunmathur.library.avatar.components.YuuAvatarSurfaceViewTest",+ )+ )+}
library/e2ee-p2p/build.gradle.kts
diff --git a/library/e2ee-p2p/build.gradle.kts b/library/e2ee-p2p/build.gradle.ktsindex 51332b319f..a98fdcf9ba 100644--- a/library/e2ee-p2p/build.gradle.kts+++ b/library/e2ee-p2p/build.gradle.kts@@ -24,3 +24,23 @@ androidComponents { // armeabi-v7a as well as arm64: :cast:tv runs on 32-bit-userspace Google TV hardware // and links this .so. Phone apps filter it back out via their arm64-only abiFilters. rustNativeLib("e2ee_pqc", "e2ee-pqc", extraAbis = listOf(ABI_ARMV7))++// Only the classes below actually load a native library: PqcTest drives+// Pqc.generateKem/generateDsa/encryptTo/signWith directly (libe2ee_pqc via+// PqcNative), and E2eeHkdfIdentityTest's identity tests mint and reload a+// PqcIdentity through the same bridge (its HKDF/AES/security-code tests+// are pure, but the class cannot be split below class granularity).+// InviteFingerprintTest is pure hashing over a fixed bundle and never+// touches Pqc. Quarantine the loaders into testDebugUnitTestNative+// (forkEvery = 1); InviteFingerprintTest batches 20-per-JVM in+// testDebugUnitTest, which depends on the quarantine task so the usual+// invocation still runs everything. No isolatedClasses: no+// DataStore/ViewModel or process-wide singleton here.+rustNativeTests {+ nativeClasses.addAll(+ listOf(+ "com.vayunmathur.e2ee.E2eeHkdfIdentityTest",+ "com.vayunmathur.e2ee.PqcTest",+ )+ )+}
library/map/build.gradle.kts
diff --git a/library/map/build.gradle.kts b/library/map/build.gradle.ktsindex 4edf520179..84ffa19185 100644--- a/library/map/build.gradle.kts+++ b/library/map/build.gradle.kts@@ -82,3 +82,27 @@ rustNativeLib( shaders = listOf("*.vert", "*.frag"), glslcArgs = listOf("--target-env=vulkan1.1", "-O"), )++// Only the classes below actually load a native library: they compose+// VectorMap, which binds a TextureView surface through VulkanMapSurface's+// MapSurfaceHost into SurfaceMapRenderer.attachSurface — the path that+// reads MapNative.isAvailable and queues MapNative.create for+// libmap_renderer. Every other class is camera/projection/gesture math,+// value types, or a SurfaceMapRenderer with no surface attached (whose+// mutators are dropped by MapNativeLink before any JNI: FrameLoopWakeTest,+// MapRenderThreadTest and RendererStateTest pin exactly that no-JNI+// contract), and MapGesturesTest exercises only the gesture modifier, not+// VectorMap. Quarantine the loaders into testDebugUnitTestNative+// (forkEvery = 1); the remaining classes batch 20-per-JVM in+// testDebugUnitTest, which depends on the quarantine task so the usual+// invocation still runs everything. No isolatedClasses: no+// DataStore/ViewModel here, and the no-surface renderers share only+// MapRenderThread's queue, which they never post to while unattached.+rustNativeTests {+ nativeClasses.addAll(+ listOf(+ "com.vayunmathur.library.map.MapAttachTest",+ "com.vayunmathur.library.map.MapComposeTest",+ )+ )+}
library/ml/build.gradle.kts
diff --git a/library/ml/build.gradle.kts b/library/ml/build.gradle.ktsindex 5b0ce81a94..836dbed219 100644--- a/library/ml/build.gradle.kts+++ b/library/ml/build.gradle.kts@@ -31,3 +31,29 @@ rustNativeLib( shaders = listOf("*.comp"), glslcArgs = listOf("--target-env=vulkan1.1", "-O"), )++// Only the classes below actually load a native library: they construct a+// handle, segmenter or recogniser (WhisperHandle, ClipHandle,+// Gemma4AudioHandle/Gemma4VisionHandle, TextRecognizer, FaceDetector, the+// segmenters, SupertonicSynthesizer), whose init reads MlNative.isAvailable+// — the one System.loadLibrary("modelrunner") attempt — or read that flag+// directly (HandlesUnavailableTest's `native availability flag` test). The+// pure Gemma companion tests (render/declare/parse, fitAudio/promptCeiling,+// markers, n-gram draft, sampling, tool calls) never construct a handle and+// never touch MlNative, so they stay in the main task. Quarantine the+// loaders into testDebugUnitTestNative (forkEvery = 1); the remaining+// classes batch 20-per-JVM in testDebugUnitTest, which depends on the+// quarantine task so the usual invocation still runs everything. No+// isolatedClasses: this module has no DataStore/ViewModel or other+// process-wide singleton for a test to pollute.+rustNativeTests {+ nativeClasses.addAll(+ listOf(+ "com.vayunmathur.library.ml.DataSemanticsTest",+ "com.vayunmathur.library.ml.HandlesUnavailableTest",+ "com.vayunmathur.library.ml.MlDeepTest",+ "com.vayunmathur.library.ml.SegmentationAndFacesTest",+ "com.vayunmathur.library.ml.SupertonicTest",+ )+ )+}
library/ocr/build.gradle.kts
diff --git a/library/ocr/build.gradle.kts b/library/ocr/build.gradle.ktsindex 5c0fe1ff0a..46c8fbbf71 100644--- a/library/ocr/build.gradle.kts+++ b/library/ocr/build.gradle.kts@@ -1,6 +1,23 @@ plugins { id("common-conventions-library") }++// This module has no rustNativeLib of its own: the native load arrives+// transitively from :library:ml (libmodelrunner), which is what puts this+// module's tests on the forkEvery = 1 path at all. Only OcrEngineTest+// actually loads it: OcrEngine.isAvailable/recognize construct a+// TextRecognizer (in :library:ml), whose init reads MlNative.isAvailable —+// the System.loadLibrary("modelrunner") attempt. OcrMappingTest only+// exercises the pure OcrEngine.linesToResult mapping and never constructs+// an engine or a recogniser. Quarantine the loader into+// testDebugUnitTestNative (forkEvery = 1); OcrMappingTest batches+// 20-per-JVM in testDebugUnitTest, which depends on the quarantine task+// so the usual invocation still runs everything. No isolatedClasses: no+// DataStore/ViewModel or process-wide singleton here.+rustNativeTests {+ nativeClasses.add("com.vayunmathur.library.ocr.OcrEngineTest")+}+ dependencies { // On-device OCR via PP-OCRv5 on the Vulkan compute runtime in `:library:ml`. Both // models ship as `.maml` in this module's assets and the whole detect-crop-recognise