Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / openassistant / build.gradle.kts

build.gradle.kts115 lines · 4.9 KiBRaw
1plugins {
2 id("common-conventions-app")
3 // Listing screenshots come from Compose previews (src/screenshotTest), not from an
4 // instrumented test on a device. Same `:openassistant:metadata` task name either way.
5 id("common-conventions-preview-metadata")
6 alias(libs.plugins.ksp)
7}
8
9launcherIcon {
10 symbol = "robot_2"
11}
12
13android {
14 defaultConfig {
15 applicationId = "com.vayunmathur.openassistant"
16 }
17
18 packaging {
19 jniLibs {
20 pickFirsts.add("**/libc++_shared.so")
21 }
22 }
23}
24
25// This module has no Rust of its own, but :library:ml registers
26// libmodelrunner (rustNativeLib), so every unit test here has kept
27// forkEvery = 1. Only the classes below actually load that library:
28// they execute a path that touches MlNative.isAvailable
29// (System.loadLibrary("modelrunner") via NativeLoader), through
30// Gemma4Handle.inDirectory (MamlChatEngine's real model opener),
31// Gemma4VisionHandle / Gemma4AudioHandle.inDirectory (the multimodal
32// towers MamlChatEngine opens for image/audio turns, even when its
33// text model is a fake), or InferenceService's onCreate pre-warm with
34// the default (real) engine factory. Tests that merely reference
35// Gemma4Handle.Turn / ToolDeclaration, call the pure
36// declareGemma4Tools / parseGemma4ToolCall helpers, or inject a fake
37// text model / fake engine never load the library and stay in the
38// main task. Quarantine the loaders and the shared-JVM polluters
39// below into testDevUnitTestNative (forkEvery = 1); the remaining
40// classes batch 20-per-JVM in testDevUnitTest, which depends on the
41// quarantine task so the usual invocation still runs everything.
42rustNativeTests {
43 nativeClasses.addAll(
44 listOf(
45 "com.vayunmathur.openassistant.platform.MamlAndAssistTest",
46 "com.vayunmathur.openassistant.platform.MamlChatEngineFakeModelTest",
47 "com.vayunmathur.openassistant.util.InferenceServiceTest",
48 )
49 )
50 // Shared-JVM polluters keep forkEvery = 1 in the same companion task:
51 // DataStoreUtils is a process-wide singleton whose init eagerly
52 // collects the preferences DataStore, and AssistantViewModel turns
53 // repository flows into viewModelScope stateIn collectors
54 // (SharingStarted.WhileSubscribed) that are never cleared when the
55 // test never calls onCleared; its init also launches
56 // viewModelScope IO coroutines that call
57 // DataStoreUtils.getInstance, start InferenceService, and delete
58 // files under the external files dir. Same hazard for tests that
59 // launch MainActivity (which builds the ViewModel), use the
60 // OpenAssistantRepository.get process-wide singleton (and its
61 // cached Room database) directly, or build the real
62 // InferenceService: its serviceScope job loop, onCreate engine
63 // pre-warm, DataStore-backed system-prompt read, and the
64 // process-wide InferenceService.halt / newTitle statics outlive
65 // the test, and InferenceServiceModelLoadTest deletes and
66 // rewrites the shared model directory. Audit rule: any test
67 // instantiating AssistantViewModel (or launching MainActivity,
68 // which builds one), using OpenAssistantRepository.get directly,
69 // or building InferenceService belongs here. All other classes
70 // batch.
71 isolatedClasses.addAll(
72 listOf(
73 "com.vayunmathur.openassistant.MainActivityAndDeviceToolsTest",
74 "com.vayunmathur.openassistant.data.RepositoryAndSettingsBindingTest",
75 "com.vayunmathur.openassistant.ui.BubbleInputSurfaceExtraTest",
76 "com.vayunmathur.openassistant.ui.LiteRTChatUiTest",
77 "com.vayunmathur.openassistant.util.AssistantViewModelFakeDataTest",
78 "com.vayunmathur.openassistant.util.AssistantViewModelTest",
79 "com.vayunmathur.openassistant.util.InferenceServiceFakeEngineTest",
80 "com.vayunmathur.openassistant.util.InferenceServiceHostMarkerTest",
81 "com.vayunmathur.openassistant.util.InferenceServiceModelLoadTest",
82 )
83 )
84}
85
86dependencies {
87
88 // room
89 implementRoom(libs)
90 implementation(project(":library:room"))
91
92 // adaptive navigation
93 implementation(libs.androidx.compose.material3.adaptive.navigation.suite)
94
95 // display images
96 implementation(project(":library:image"))
97
98 // ai
99 // Gemma 4 chat runs on `:library:ml`'s Vulkan runtime (Gemma4Handle).
100 implementation(project(":library:ml"))
101 implementation(libs.kotlinx.coroutines.android)
102
103 implementation(project(":library:downloadservice"))
104
105 // web search/reading via api.maproj.org (Phase W)
106 implementation(project(":library:network"))
107
108 // generative UI: the model emits A2UI components, rendered natively in chat
109 implementation(libs.androidx.a2ui.model)
110 implementation(libs.androidx.a2ui.engine)
111 implementation(libs.kotlinx.serialization.json)
112
113 // Mock Context/PackageManager for cross-app intent tests.
114 testImplementation(libs.mockito.core)
115}