Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / cast / build.gradle.kts
build.gradle.kts96 lines · 4.7 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-app") |
| 3 | id("common-conventions-preview-metadata") |
| 4 | } |
| 5 | |
| 6 | launcherIcon { |
| 7 | symbol = "cast" |
| 8 | } |
| 9 | |
| 10 | android { |
| 11 | defaultConfig { |
| 12 | applicationId = "com.vayunmathur.cast" |
| 13 | } |
| 14 | // MediaProxyServer is sockets and lifecycle, and every branch of it logs. Its teardown is worth |
| 15 | // proving on the JVM, so android.util.Log has to answer rather than throw. |
| 16 | testOptions { |
| 17 | unitTests.isReturnDefaultValues = true |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | // This module has no Rust of its own, but :cast:protocol (and the |
| 22 | // test-only dep below) reach :library:e2ee-p2p, which registers |
| 23 | // libe2ee_pqc (rustNativeLib), so every unit test here has kept |
| 24 | // forkEvery = 1. Only the classes below actually load that library: |
| 25 | // they construct FakeTv, whose init runs PqcIdentity.loadOrCreate over |
| 26 | // an empty in-memory store -> Pqc.generateKem/generateDsa -> |
| 27 | // PqcNative (NativeLoader.load("e2ee_pqc")), and/or pair a |
| 28 | // MirrorClient / CastController against it, which seals the session |
| 29 | // secret via SecretSealing.seal -> Pqc.encryptTo and opens it in |
| 30 | // FakeTv via SecretSealing.open -> PqcIdentity.decrypt. Tests that |
| 31 | // merely drive the pure protocol/codec helpers, compose with fake |
| 32 | // actions, or run MirrorClient against a closed port never load the |
| 33 | // library and stay in the main task. Quarantine the loaders and the |
| 34 | // shared-JVM polluters below into testDevUnitTestNative |
| 35 | // (forkEvery = 1); the remaining classes batch 20-per-JVM in |
| 36 | // testDevUnitTest, which depends on the quarantine task so the usual |
| 37 | // invocation still runs everything. |
| 38 | rustNativeTests { |
| 39 | nativeClasses.addAll( |
| 40 | listOf( |
| 41 | "com.vayunmathur.cast.platform.CastControllerTest", |
| 42 | "com.vayunmathur.cast.platform.ConnectionExtraTest", |
| 43 | "com.vayunmathur.cast.platform.ControllerBranchesTest", |
| 44 | "com.vayunmathur.cast.platform.DesktopAndCaptureTest", |
| 45 | "com.vayunmathur.cast.platform.DesktopRenegotiateTest", |
| 46 | "com.vayunmathur.cast.platform.MirrorClientExtraTest", |
| 47 | "com.vayunmathur.cast.platform.MirrorClientTest", |
| 48 | "com.vayunmathur.cast.platform.ProviderRouteTest", |
| 49 | "com.vayunmathur.cast.platform.SessionEncoderBackedTest", |
| 50 | "com.vayunmathur.cast.platform.TileIdleClickTest", |
| 51 | "com.vayunmathur.cast.platform.mirror.EncoderBackedTest", |
| 52 | "com.vayunmathur.cast.service.ContentCastIntegrationTest", |
| 53 | "com.vayunmathur.cast.service.ContentStartedTest", |
| 54 | ) |
| 55 | ) |
| 56 | // Shared-JVM polluters keep forkEvery = 1 in the same companion task: |
| 57 | // CastViewModel turns CastController's flows into a viewModelScope |
| 58 | // stateIn collector (SharingStarted.WhileSubscribed) that is never |
| 59 | // cleared when the test never calls onCleared, and |
| 60 | // MirrorPreferences reads/writes through the DataStoreUtils |
| 61 | // process-wide singleton (its init eagerly collects the preferences |
| 62 | // DataStore), so persisted DataStore state leaks into classes |
| 63 | // expecting defaults. Audit rule: any test instantiating |
| 64 | // CastViewModel or launching MainActivity (which builds one), or |
| 65 | // using MirrorPreferences directly, belongs here, unless it already |
| 66 | // loads the native library above. All other classes batch. |
| 67 | isolatedClasses.addAll( |
| 68 | listOf( |
| 69 | "com.vayunmathur.cast.platform.ActivitiesTest", |
| 70 | "com.vayunmathur.cast.platform.CastViewModelTest", |
| 71 | "com.vayunmathur.cast.platform.RemoteDisplayAndTileTest", |
| 72 | "com.vayunmathur.cast.platform.mirror.MirrorPreferencesEmptyTest", |
| 73 | "com.vayunmathur.cast.platform.mirror.MirrorPreferencesTest", |
| 74 | "com.vayunmathur.cast.ui.CastComposeTest", |
| 75 | ) |
| 76 | ) |
| 77 | } |
| 78 | |
| 79 | dependencies { |
| 80 | // Compile-only stubs for `com.android.media.remotedisplay`, the remote display provider API. |
| 81 | // A shared library on the system image, pulled in at runtime by the `<uses-library>` tag; |
| 82 | // must NOT be packaged. See :library:aosp-stubs. |
| 83 | compileOnly(project(":library:aosp-stubs")) |
| 84 | // The wire format, shared verbatim with the TV receiver. Nothing here re-implements it. |
| 85 | implementation(project(":cast:protocol")) |
| 86 | // The IPC contract, shared with every app that streams its content through here. Depended on |
| 87 | // rather than duplicated, which is the one thing FamilyLocationProtocol gets wrong. |
| 88 | implementation(project(":sdk:cast")) |
| 89 | // Test-only: the fake TV in unit tests holds a real PQC identity to seal against. |
| 90 | testImplementation(project(":library:e2ee-p2p")) |
| 91 | // Test-only: lets Robolectric load the remote-display provider against the stub surface. |
| 92 | testImplementation(project(":library:aosp-stubs")) |
| 93 | } |
| 94 | |
| 95 | // No Rust crate. The protocol module already reaches ML-KEM through :library:e2ee-p2p, and |
| 96 | // everything left here is Android platform work: MediaProjection, MediaCodec, sockets. |