Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / cast / tv / build.gradle.kts
build.gradle.kts94 lines · 4.7 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-app") |
| 3 | // androidx.tv, so this app is built on a design system that knows what a D-pad is. Named here |
| 4 | // *alongside* the app convention rather than instead of it, even though it applies that itself: |
| 5 | // the type-safe `launcherIcon` and `nativeAbis` accessors below are generated from the plugins this |
| 6 | // file applies directly. |
| 7 | id("common-conventions-tv") |
| 8 | // Listing screenshots come from Compose previews (src/screenshotTest) for the |
| 9 | // Layoutlib-renderable TV screens (ready/pairing/now-playing); decoder/mirror |
| 10 | // surfaces are not previewed — see MetadataPreviews.kt. Renders land in |
| 11 | // metadata_data/photos/cast-tv/tv/. metadata_data/cast-tv.md still exists, which |
| 12 | // is what makes release.sh generate a listing at all. |
| 13 | id("common-conventions-preview-metadata") |
| 14 | } |
| 15 | |
| 16 | launcherIcon { |
| 17 | symbol = "cast" |
| 18 | } |
| 19 | |
| 20 | // Google TV hardware (the onn 4K Streaming Box and friends) runs a 32-bit userspace and |
| 21 | // reports only `armeabi-v7a,armeabi`, so an arm64-only APK is rejected at install time. |
| 22 | nativeAbis { |
| 23 | armv7 = true |
| 24 | } |
| 25 | |
| 26 | android { |
| 27 | defaultConfig { |
| 28 | applicationId = "com.vayunmathur.cast.tv" |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | // This module has no Rust of its own, but :library:e2ee-p2p (below) |
| 33 | // registers libe2ee_pqc (rustNativeLib), so every unit test here has |
| 34 | // kept forkEvery = 1. Only the classes below actually load that |
| 35 | // library: they call ReceiverController.start (whose listen() runs |
| 36 | // PqcIdentity.loadOrCreate over PairingStore -> Pqc.generateKem / |
| 37 | // generateDsa -> PqcNative, NativeLoader.load("e2ee_pqc")), seal a |
| 38 | // session secret directly via SecretSealing.seal -> Pqc.encryptTo, or |
| 39 | // drive ReceiverService.onStartCommand / MainActivity, which start |
| 40 | // the controller the same way. Tests that merely call the pure |
| 41 | // pairing/session helpers, compose TV surfaces, or drive decoders |
| 42 | // with fake codecs never load the library and stay in the main task. |
| 43 | // Quarantine the loaders and the shared-JVM polluters below into |
| 44 | // testDevUnitTestNative (forkEvery = 1); the remaining classes batch |
| 45 | // 20-per-JVM in testDevUnitTest, which depends on the quarantine task |
| 46 | // so the usual invocation still runs everything. |
| 47 | rustNativeTests { |
| 48 | nativeClasses.addAll( |
| 49 | listOf( |
| 50 | "com.vayunmathur.cast.tv.ReceiverShellTest", |
| 51 | "com.vayunmathur.cast.tv.ServiceNotificationsTest", |
| 52 | "com.vayunmathur.cast.tv.platform.ContentSessionSuccessTest", |
| 53 | "com.vayunmathur.cast.tv.platform.ControlChannelDeepTest", |
| 54 | "com.vayunmathur.cast.tv.platform.FullSessionTest", |
| 55 | "com.vayunmathur.cast.tv.service.ServiceCollectTest", |
| 56 | ) |
| 57 | ) |
| 58 | // Shared-JVM polluters keep forkEvery = 1 in the same companion task: |
| 59 | // ReceiverController is a process-wide object (state StateFlow, |
| 60 | // serverSocket, session/media jobs, surface/contentPlayer fields) |
| 61 | // whose session state one class leaves behind is the next class's |
| 62 | // starting phase, and PairingStore persists through the |
| 63 | // DataStoreUtils process-wide singleton (its init eagerly collects |
| 64 | // the preferences DataStore), so remembered-device keys and the |
| 65 | // friendly name leak into classes expecting defaults. Audit rule: |
| 66 | // any test calling ReceiverController.authenticate / serveContent / |
| 67 | // startStreaming / pump, mutating its state or fields, or using |
| 68 | // PairingStore / DataStoreUtils directly belongs here, unless it |
| 69 | // already loads the native library above. All other classes batch. |
| 70 | isolatedClasses.addAll( |
| 71 | listOf( |
| 72 | "com.vayunmathur.cast.tv.platform.AuthenticateDeepTest", |
| 73 | "com.vayunmathur.cast.tv.platform.AuthenticateTest", |
| 74 | "com.vayunmathur.cast.tv.platform.FinalSmallTest", |
| 75 | "com.vayunmathur.cast.tv.platform.PlatformTvTest", |
| 76 | "com.vayunmathur.cast.tv.platform.ServeContentDeepTest", |
| 77 | "com.vayunmathur.cast.tv.platform.StartStreamingDeepTest", |
| 78 | "com.vayunmathur.cast.tv.platform.StreamingPumpDeepTest", |
| 79 | ) |
| 80 | ) |
| 81 | } |
| 82 | |
| 83 | dependencies { |
| 84 | // The wire format, shared verbatim with the phone. Nothing in this app re-implements it. |
| 85 | implementation(project(":cast:protocol")) |
| 86 | implementation(project(":library:e2ee-p2p")) |
| 87 | // The shared TV design system: theme, cards, controls, states, transport. Deliberately not |
| 88 | // :library:image, so this offline receiver gains no INTERNET permission from its UI. |
| 89 | implementation(project(":library:tv")) |
| 90 | // App content arrives as media rather than as pixels now, so the TV needs a player. Not |
| 91 | // `media3-session`: the TV already has a remote-control path through its own control channel, |
| 92 | // and a MediaSession would be a second one competing with it. |
| 93 | implementation(libs.androidx.media3.exoplayer) |
| 94 | } |