Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / communicate / build.gradle.kts
build.gradle.kts218 lines · 11.8 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-app") |
| 3 | // Store-listing screenshots rendered from Compose @Preview (car views). |
| 4 | id("common-conventions-preview-metadata") |
| 5 | id("com.google.devtools.ksp") |
| 6 | } |
| 7 | |
| 8 | launcherIcon { |
| 9 | symbol = "call" |
| 10 | } |
| 11 | |
| 12 | // Pixel Watch 5 is armeabi-v7a (32-bit) only: an arm64-only APK is rejected at install. |
| 13 | nativeAbis { |
| 14 | armv7 = true |
| 15 | } |
| 16 | |
| 17 | android { |
| 18 | defaultConfig { |
| 19 | applicationId = "com.vayunmathur.communicate" |
| 20 | } |
| 21 | compileOptions { |
| 22 | isCoreLibraryDesugaringEnabled = true |
| 23 | } |
| 24 | packaging { |
| 25 | resources { |
| 26 | // libsignal-client bundles its desktop JNI natives (macOS .dylib, |
| 27 | // Windows .dll) as Java resources. They can never load on Android and |
| 28 | // add ~40 MB to the APK — strip them. The Android lib/arm64-v8a/ |
| 29 | // libsignal_jni.so is unaffected. |
| 30 | excludes += setOf("**/*.dylib", "*.dylib", "**/*.dll", "*.dll") |
| 31 | } |
| 32 | jniLibs { |
| 33 | // Test-only libsignal native (NativeTesting bridge); unused in prod. |
| 34 | excludes += "**/libsignal_jni_testing.so" |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | dependencies { |
| 40 | coreLibraryDesugaring(libs.desugar.jdk.libs) |
| 41 | // Dev-only line library (WhatsApp/Signal/RCS). Linked only into the |
| 42 | // dev variant, so release builds neither compile nor package it. |
| 43 | // `dev` is a repo-custom build type, so there is no static |
| 44 | // `devImplementation` accessor; use add() like the convention does. |
| 45 | add("devImplementation", project(":communicate-dev")) |
| 46 | } |
| 47 | |
| 48 | rustNativeTests { |
| 49 | nativeClasses.addAll( |
| 50 | listOf( |
| 51 | "com.vayunmathur.communicate.data.Y3MergedGvTest", |
| 52 | "com.vayunmathur.communicate.data.Y3RcsSendSuccessTest", |
| 53 | "com.vayunmathur.communicate.rcs.MlsLifecycleRcsPass3Test", |
| 54 | "com.vayunmathur.communicate.rcs.RcsSlice3E2ESupportTest", |
| 55 | "com.vayunmathur.communicate.rcs.RcsSlice3Pass2E2ETest", |
| 56 | "com.vayunmathur.communicate.rcs.RcsSlice3Pass2FakeTransportTest", |
| 57 | "com.vayunmathur.communicate.rcs.RcsSlice3Pass2UiTest", |
| 58 | "com.vayunmathur.communicate.signal.RegistrationHttpClientSignalPass3Test", |
| 59 | "com.vayunmathur.communicate.signal.RustSignalCryptoSignalPass3Test", |
| 60 | "com.vayunmathur.communicate.signal.SignalAuthAndServiceDataTest", |
| 61 | "com.vayunmathur.communicate.signal.SignalCallAndTransportParseTest", |
| 62 | "com.vayunmathur.communicate.signal.SignalCdsiTest", |
| 63 | "com.vayunmathur.communicate.signal.SignalGroupsAndSyncTest", |
| 64 | "com.vayunmathur.communicate.signal.SignalIdentitySignalPass3Test", |
| 65 | "com.vayunmathur.communicate.signal.SignalInboundPollW1Test", |
| 66 | "com.vayunmathur.communicate.signal.SignalSafetyNumberTest", |
| 67 | "com.vayunmathur.communicate.signal.SignalSealedSenderTest", |
| 68 | "com.vayunmathur.communicate.signal.SignalSlice2E2ETest", |
| 69 | "com.vayunmathur.communicate.signal.SignalSlice2InboundTest", |
| 70 | "com.vayunmathur.communicate.signal.SignalSlice2MessagingOfflineTest", |
| 71 | "com.vayunmathur.communicate.signal.SignalSlice2SealedCacheTest", |
| 72 | "com.vayunmathur.communicate.signal.Y1SignalMessagingGroupTest", |
| 73 | "com.vayunmathur.communicate.signal.Y1SignalSendPipelineTest", |
| 74 | "com.vayunmathur.communicate.signal.Y2SignalSocketRegTest", |
| 75 | "com.vayunmathur.communicate.signal.Y3SignalGroupOpsServerTest", |
| 76 | "com.vayunmathur.communicate.signal.Y3SignalPipelineServerTest", |
| 77 | "com.vayunmathur.communicate.signal.Y3SignalServerApiTest", |
| 78 | "com.vayunmathur.communicate.telephony.WelcomeJoinRcsPass3Test", |
| 79 | "com.vayunmathur.communicate.ui.Y3GroupCreatePickerTest", |
| 80 | "com.vayunmathur.communicate.whatsapp.W5Slice1AttestationTest", |
| 81 | "com.vayunmathur.communicate.whatsapp.W5Slice1MexRouterTest", |
| 82 | "com.vayunmathur.communicate.whatsapp.W5Slice1RegBundleTest", |
| 83 | "com.vayunmathur.communicate.whatsapp.WhatsAppAttestationTest", |
| 84 | "com.vayunmathur.communicate.whatsapp.WhatsAppRegistrationBadParamRegressionTest", |
| 85 | "com.vayunmathur.communicate.whatsapp.Y1WaE2eSyncTest", |
| 86 | "com.vayunmathur.communicate.whatsapp.Y1WaInboundTest", |
| 87 | "com.vayunmathur.communicate.whatsapp.Y1WaRegistrationHttpTest", |
| 88 | "com.vayunmathur.communicate.whatsapp.Y2WaSocketSendTest", |
| 89 | "com.vayunmathur.communicate.whatsapp.Y3AppStatePageTest", |
| 90 | ) |
| 91 | ) |
| 92 | // Shared-JVM polluters keep forkEvery = 1 in the same companion task: |
| 93 | // these touch the process-wide DataStoreUtils singleton (the |
| 94 | // datastore_default file behind GoogleVoiceSession and the line |
| 95 | // sessions) or collect its flows, so persisted DataStore state can |
| 96 | // leak into classes expecting defaults when batched. Audit rule: |
| 97 | // any test instantiating a *LineSession / GoogleVoiceSession or |
| 98 | // using DataStoreUtils.getInstance directly belongs here. All other |
| 99 | // classes batch. |
| 100 | // |
| 101 | // Post-batch CI fallout (46858d7faa, 5-CPU) added six more: |
| 102 | // (The fixed P-CSCF port 5060 shared by the DirectSip/Ims tests is |
| 103 | // handled in those classes with SO_REUSEADDR + bounded bind retry: |
| 104 | // forkEvery is a per-worker restart counter, not a fixed batch, so |
| 105 | // no task placement can serialize them.) |
| 106 | // - RcsSlice3Pass2DirectSipAuthTest asserts the RcsDirectSip |
| 107 | // singleton's SIP CSeq starts at 1; batched neighbours that drive |
| 108 | // the same singleton (same Robolectric sandbox classloader) |
| 109 | // increment it first ("CSeq: 7 REGISTER" observed). |
| 110 | // - RcsSlice3Pass2TransportTest asserts RcsCapabilityExchange's |
| 111 | // updates flow starts empty; neighbours populate it. |
| 112 | // - RcsSlice3Pass2TlsAndFtTest holds RcsMsrpTls's process-wide |
| 113 | // cached identity + persisted identity files and the |
| 114 | // RcsDatabase.overrideForTest seam. |
| 115 | // - W5Pass2ClientCoreTest / W5Pass2SyncHistoryTest / |
| 116 | // W5Pass2ContactUtilsTest drive the WhatsAppClient singleton |
| 117 | // (auth/db/socket/state fields and its never-cancelled IO scope), |
| 118 | // whose asynchronous leftovers from batched neighbours can land |
| 119 | // inside their assertions. |
| 120 | isolatedClasses.addAll( |
| 121 | listOf( |
| 122 | "com.vayunmathur.communicate.data.SecretSealingTest", |
| 123 | "com.vayunmathur.communicate.data.Y1RepositoryLoadersTest", |
| 124 | "com.vayunmathur.communicate.googlevoice.GoogleVoiceSessionSlice4Test", |
| 125 | "com.vayunmathur.communicate.rcs.RcsSlice3Pass2DirectSipAuthTest", |
| 126 | "com.vayunmathur.communicate.rcs.RcsSlice3Pass2TlsAndFtTest", |
| 127 | "com.vayunmathur.communicate.rcs.RcsSlice3Pass2TransportTest", |
| 128 | "com.vayunmathur.communicate.ui.Y2TopLevelScreensTest", |
| 129 | "com.vayunmathur.communicate.whatsapp.W5Pass2ClientCoreTest", |
| 130 | "com.vayunmathur.communicate.whatsapp.W5Pass2ContactUtilsTest", |
| 131 | "com.vayunmathur.communicate.whatsapp.W5Pass2SyncHistoryTest", |
| 132 | // Batch-shift fallout from the wear merge's added classes: |
| 133 | // Y2RepositoryRcsSendTest's MMS send and |
| 134 | // Y1RegistrationScreensTest's RCS verify (AndroidKeyStore via |
| 135 | // Room/SQLCipher) fail when they share a batched Robolectric |
| 136 | // sandbox with new neighbours; both pass isolated. |
| 137 | "com.vayunmathur.communicate.data.Y2RepositoryRcsSendTest", |
| 138 | "com.vayunmathur.communicate.ui.Y1RegistrationScreensTest", |
| 139 | ) |
| 140 | ) |
| 141 | } |
| 142 | |
| 143 | dependencies { |
| 144 | // Google Voice virtual line: protojson RPCs + SIP-over-WSS transport go through |
| 145 | // the repo's own Android-only HTTP/WebSocket stack (no OkHttp/Ktor). |
| 146 | implementation(project(":library:network")) |
| 147 | // Both sides of the Wear OS sync live in this one APK (same |
| 148 | // applicationId and signing, as the WearLink handshake requires): |
| 149 | // data/WearCommunicateSync publishes the phone snapshot, |
| 150 | // sync/WearLinkBridge receives it on a watch. FormFactor picks the |
| 151 | // side at runtime. |
| 152 | implementation(project(":library:wearlink")) |
| 153 | // Watch experience (ui/Wear*): Wear Compose + the repo log facade the |
| 154 | // watch store/sync code writes through. |
| 155 | implementation(libs.androidx.wear.compose.material) |
| 156 | implementation(libs.androidx.wear.compose.foundation) |
| 157 | implementation(project(":library:log")) |
| 158 | // Local Compose image loading for Google Voice MMS previews (remote https + content://). |
| 159 | implementation(project(":library:image")) |
| 160 | // RingRTC supplies both Signal's calling engine and the org.webrtc classes every line's calling |
| 161 | // uses. It bundles its own WebRTC, so no other WebRTC distribution can be on the classpath: the two |
| 162 | // ship ~368 identical org.webrtc class names, and RingRTC's native library binds to that exact |
| 163 | // package via JNI symbol names and FindClass descriptors, so relocating it is not an option either. |
| 164 | implementation(libs.ringrtc.android) |
| 165 | // E.164 normalization to reconcile SIM vs Google Voice numbers. |
| 166 | implementation(libs.libphonenumber) |
| 167 | // Compile-only stubs for the framework's @SystemApi app-data backup transport |
| 168 | // and single-registration RCS APIs (SipDelegateManager, UCE). Absent from the |
| 169 | // public SDK; the framework provides them at runtime, so they must NOT be |
| 170 | // packaged. See :library:aosp-stubs. |
| 171 | compileOnly(project(":library:aosp-stubs")) |
| 172 | // Google Voice / WhatsApp session persistence goes through :library's DataStoreUtils. |
| 173 | // Document-start JS injection to hook fetch/XHR before the GV web app captures them. |
| 174 | implementation(libs.androidx.webkit) |
| 175 | |
| 176 | // Room runtime only for host-side unit tests, which open in-memory |
| 177 | // instances of :communicate-dev's line databases; the three line |
| 178 | // databases themselves (and their SQLCipher runtime) live in |
| 179 | // :communicate-dev, which is devImplementation-only. |
| 180 | compileOnly(libs.androidx.room3.runtime) |
| 181 | testImplementation(libs.androidx.room3.runtime) |
| 182 | |
| 183 | // kotlinx.serialization — session/auth data persistence + serviceData blob. |
| 184 | implementation(libs.kotlinx.serialization.json) |
| 185 | |
| 186 | // Car templates (P-car-dock): AndroidX Car App Library, same pairing as |
| 187 | // :maps. Only pulled into the car code path (service/car/) — phone UI, |
| 188 | // sync services and crypto paths are untouched. |
| 189 | implementation(libs.androidx.car.app) |
| 190 | implementation(libs.androidx.car.app.projected) |
| 191 | |
| 192 | // Car-view store-listing screenshots render through the shared host renderer. |
| 193 | add("screenshotTestImplementation", project(":library:carhost")) |
| 194 | |
| 195 | // Voicemail tab audio playback: plain ExoPlayer (no session/controller stack — |
| 196 | // voicemail clips are short local files, not a browsable media library). |
| 197 | implementation(libs.androidx.media3.exoplayer) |
| 198 | |
| 199 | // voicemailNumber() reads TelephonyManager.voiceMailNumber, which the unit-test stub |
| 200 | // android.jar does not implement ("not mocked"). Robolectric supplies the framework |
| 201 | // shadows so the pilot lookup (and its permission/dual-SIM fallbacks) can be asserted |
| 202 | // on the JVM; same reason emergency/pdf use it. |
| 203 | // Line proto/libsignal types reach host unit tests through :communicate-dev's |
| 204 | // public API; its implementation deps are not exposed, so tests name them here. |
| 205 | testImplementation(libs.protobuf.java) |
| 206 | testImplementation(libs.libsignal.android) |
| 207 | testImplementation(libs.robolectric) |
| 208 | testImplementation(libs.androidx.car.app.testing) |
| 209 | testImplementation(libs.androidx.test.core) |
| 210 | // Compile-only hidden-API stubs (SipMessage etc.) so RCS inbound tests can reference |
| 211 | // them; Robolectric's android-all supplies the real implementations at runtime. |
| 212 | testImplementation(project(":library:aosp-stubs")) |
| 213 | // Route slice-6 contract tests use KClass reflection (sealedSubclasses, constructors). |
| 214 | testImplementation(libs.kotlin.reflect) |
| 215 | // RCS slice tests: real in-memory Room database via the bundled sqlite driver |
| 216 | // (same pattern as :todo's TodoMigrationTest). |
| 217 | testImplementation(libs.androidx.sqlite.bundled.jvm) |
| 218 | } |