Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / youpipe / build.gradle.kts
build.gradle.kts131 lines · 6.2 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-app") |
| 3 | // androidx.tv, so the TV entry is built on a design system that knows what a D-pad is |
| 4 | // (the cast:tv precedent). |
| 5 | id("common-conventions-tv") |
| 6 | // Listing screenshots come from Compose previews (src/screenshotTest), not from an |
| 7 | // instrumented test on a device. Same `:youpipe:metadata` task name either way. |
| 8 | id("common-conventions-preview-metadata") |
| 9 | alias(libs.plugins.ksp) |
| 10 | } |
| 11 | |
| 12 | launcherIcon { |
| 13 | symbol = "play_arrow" |
| 14 | } |
| 15 | |
| 16 | // Google TV hardware runs a 32-bit userspace: an arm64-only APK is rejected at install. |
| 17 | nativeAbis { |
| 18 | armv7 = true |
| 19 | } |
| 20 | |
| 21 | androidComponents { |
| 22 | onVariants { variant -> |
| 23 | variant.sources.jniLibs?.addStaticSourceDirectory( |
| 24 | layout.buildDirectory.dir("rustJniLibs").get().asFile.absolutePath |
| 25 | ) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | // YouTube (InnerTube) extractor — a Rust port of PipePipeExtractor. See youpipe/src/main/rust/. |
| 30 | // extraAbis: the .so must also load on 32-bit Google TV. |
| 31 | rustNativeLib("youpipe_extractor", "youpipe", extraAbis = listOf("armeabi-v7a")) |
| 32 | |
| 33 | // Only the class below actually loads libyoupipe_extractor: it calls |
| 34 | // NativeExtractor.*, which initialises YouPipeNative (the one |
| 35 | // NativeLoader.load("youpipe_extractor") attempt) and then invokes the |
| 36 | // external functions. Tests that only exercise NativeExtractor.unwrap, |
| 37 | // the NewPipe-extractor helpers in network/Extractor.kt, or DTO/JSON |
| 38 | // contracts never initialise YouPipeNative and stay in the main task. |
| 39 | // Quarantine the loader and the shared-JVM polluters below into |
| 40 | // testDevUnitTestNative (forkEvery = 1); the remaining classes batch |
| 41 | // 20-per-JVM in testDevUnitTest, which depends on the quarantine task so |
| 42 | // the usual invocation still runs everything. |
| 43 | rustNativeTests { |
| 44 | nativeClasses.add("com.vayunmathur.youpipe.nativeext.NativeExtractorDispatchDeepTest") |
| 45 | // Shared-JVM polluters keep forkEvery = 1 in the same companion task: |
| 46 | // YouPipeViewModel stateIns (SharingStarted.WhileSubscribed) more |
| 47 | // than a dozen repository flows plus the process-wide DataStoreUtils |
| 48 | // singleton's flows (sponsor-block, language, default page, playback |
| 49 | // speed, ...) in viewModelScope, and is never cleared when the test |
| 50 | // never calls onCleared; persisted DataStoreUtils state also leaks |
| 51 | // into classes expecting defaults. Audit rule: any test |
| 52 | // instantiating YouPipeViewModel (or launching MainActivity, which |
| 53 | // builds one via its factory) belongs here. Tests that build only an |
| 54 | // in-memory SubscriptionDatabase/repository seam without the |
| 55 | // ViewModel batch. The two Sabr WebView classes below share the |
| 56 | // process-wide SharedWebViewRuntime singleton (same Robolectric |
| 57 | // @Config, hence the same sandbox classloader in a shared JVM): |
| 58 | // each calls SharedWebViewRuntime.get(ctx).warmUp() and depends on |
| 59 | // its stored init-failure latch, so they must not share a JVM with |
| 60 | // each other either. All other classes batch. |
| 61 | isolatedClasses.addAll( |
| 62 | listOf( |
| 63 | "com.vayunmathur.youpipe.RootSlice3Pass2Test", |
| 64 | "com.vayunmathur.youpipe.RootSlice3RouteTest", |
| 65 | "com.vayunmathur.youpipe.network.sabr.SabrSlice1StoreDownloadTest", |
| 66 | "com.vayunmathur.youpipe.network.sabr.SabrSlice1WebViewTest", |
| 67 | "com.vayunmathur.youpipe.platform.ImportExportDeepTest", |
| 68 | "com.vayunmathur.youpipe.platform.SharedLinkDeepTest", |
| 69 | "com.vayunmathur.youpipe.platform.VideoLoadingDeepTest", |
| 70 | "com.vayunmathur.youpipe.ui.C9Slice2PagesTest", |
| 71 | "com.vayunmathur.youpipe.ui.ChannelPageDeepTest", |
| 72 | "com.vayunmathur.youpipe.ui.DataSettingsRowsPass3Test", |
| 73 | "com.vayunmathur.youpipe.ui.ExpandedWidthPass3Test", |
| 74 | "com.vayunmathur.youpipe.ui.HistoryInteractionsPass3Test", |
| 75 | "com.vayunmathur.youpipe.ui.ManageInterestsActionsPass3Test", |
| 76 | "com.vayunmathur.youpipe.ui.OrientationHistoryPass3Test", |
| 77 | "com.vayunmathur.youpipe.ui.PagesPass3Test", |
| 78 | "com.vayunmathur.youpipe.ui.PhonePlayerSearchDeepTest", |
| 79 | "com.vayunmathur.youpipe.ui.PhoneVideoDeepTest", |
| 80 | "com.vayunmathur.youpipe.ui.PlayerMenusPass3Test", |
| 81 | "com.vayunmathur.youpipe.ui.PlaylistInteractionsPass3Test", |
| 82 | "com.vayunmathur.youpipe.ui.SavedPlaylistMorePass3Test", |
| 83 | "com.vayunmathur.youpipe.ui.SettingsDialogsMorePass3Test", |
| 84 | "com.vayunmathur.youpipe.ui.SettingsDownloadsPass3Test", |
| 85 | "com.vayunmathur.youpipe.ui.SubscriptionsSettingsNavPass3Test", |
| 86 | "com.vayunmathur.youpipe.ui.VideoPlayerPass3Test", |
| 87 | "com.vayunmathur.youpipe.ui.ViewModelHarnessPass3Test", |
| 88 | "com.vayunmathur.youpipe.ui.dialogs.RootSlice3PlaylistDialogsTest", |
| 89 | "com.vayunmathur.youpipe.ui.tv.TvBrowseDeepTest", |
| 90 | "com.vayunmathur.youpipe.ui.tv.TvFeedDeepTest", |
| 91 | "com.vayunmathur.youpipe.ui.tv.TvPagesDeep2Test", |
| 92 | "com.vayunmathur.youpipe.ui.tv.TvPagesTest", |
| 93 | "com.vayunmathur.youpipe.ui.tv.TvPlayerDeepTest", |
| 94 | "com.vayunmathur.youpipe.ui.tv.TvSearchChannelDeepTest", |
| 95 | "com.vayunmathur.youpipe.ui.tv.TvSearchDownloadsDeepTest", |
| 96 | ) |
| 97 | ) |
| 98 | } |
| 99 | |
| 100 | android { |
| 101 | defaultConfig { |
| 102 | applicationId = "com.vayunmathur.youpipe" |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | dependencies { |
| 107 | implementation(project(":library:tv")) |
| 108 | implementation(project(":library:image")) |
| 109 | implementation(project(":youpipe:extractor")) |
| 110 | // Puts the video on a TV through the installed Cast app: a Surface and a PCM pipe, no sockets. |
| 111 | implementation(project(":sdk:cast")) |
| 112 | implementation(libs.quickjs.kt) |
| 113 | implementation(libs.androidx.webkit) |
| 114 | |
| 115 | implementRoom(libs) |
| 116 | implementation(project(":library:room")) |
| 117 | |
| 118 | implementation(libs.androidx.media3.ui.compose.material3) |
| 119 | implementation(libs.androidx.media3.exoplayer) |
| 120 | implementation(libs.androidx.media3.exoplayer.dash) |
| 121 | implementation(libs.androidx.media3.session) |
| 122 | // DefaultHttpDataSource (HttpURLConnection) for progressive; SABR via library:network – no okhttp |
| 123 | |
| 124 | implementation(libs.androidx.work.runtime.ktx) |
| 125 | implementation(project(":library:work")) |
| 126 | |
| 127 | // Android-only network – HttpURLConnection + own WS; no direct okhttp dep |
| 128 | implementation(project(":library:network")) |
| 129 | |
| 130 | testImplementation(libs.androidx.work.testing) |
| 131 | } |