Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / games / kart / build.gradle.kts
build.gradle.kts80 lines · 3.2 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-app") |
| 3 | // Listing screenshots come from Compose previews (src/screenshotTest), not from an |
| 4 | // instrumented test on a device. Same `:games:kart:metadata` task name either way. |
| 5 | id("common-conventions-preview-metadata") |
| 6 | } |
| 7 | |
| 8 | launcherIcon { |
| 9 | symbol = "directions_car" |
| 10 | } |
| 11 | |
| 12 | android { |
| 13 | defaultConfig { |
| 14 | applicationId = "com.vayunmathur.games.kart" |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | androidComponents { |
| 19 | onVariants { variant -> |
| 20 | variant.sources.jniLibs?.addStaticSourceDirectory( |
| 21 | layout.buildDirectory.dir("rustJniLibs").get().asFile.absolutePath |
| 22 | ) |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | // Native 3D racer engine (Sunset Oval track, kart physics, chase cam, items + |
| 27 | // AI). Same arrangement as games/voxels: the crate builds into rustJniLibs and |
| 28 | // KartNative.isAvailable gates every call, so devices without the .so run the |
| 29 | // placeholder race. Listing images are hand-captured (Layoutlib can't render |
| 30 | // the Vulkan surface); see the plan's verification notes. |
| 31 | // Phone-only: arm64 like every other app. The GLES renderer stays in the |
| 32 | // engine as the non-Vulkan fallback. |
| 33 | rustNativeLib( |
| 34 | "kart_engine", |
| 35 | "kart", |
| 36 | // kart_gles.* are GLSL ES, compiled at run time by the GLES fallback. |
| 37 | shaders = listOf("kart.vert", "kart.frag"), |
| 38 | ) |
| 39 | |
| 40 | // Only the classes below actually load a native library: KartHostAndNativeTest |
| 41 | // calls KartNative.* directly, KartSurfaceViewTest drives KartSurfaceView's |
| 42 | // surface callbacks (each reads KartNative.isAvailable), and the two screen |
| 43 | // tests compose KartGameScreen's RacingBody, which reads |
| 44 | // KartNative.isAvailable before composing KartSurfaceView. Touching |
| 45 | // KartNative triggers its clinit (NativeLoader.load("kart_engine")). |
| 46 | // Quarantine those loaders into testDevUnitTestNative (forkEvery = 1); the |
| 47 | // remaining classes batch 20-per-JVM in testDevUnitTest, which depends on |
| 48 | // the quarantine task so the usual invocation still runs everything. |
| 49 | rustNativeTests { |
| 50 | nativeClasses.addAll( |
| 51 | listOf( |
| 52 | "com.vayunmathur.games.kart.platform.KartHostAndNativeTest", |
| 53 | "com.vayunmathur.games.kart.ui.KartGameScreenTest", |
| 54 | "com.vayunmathur.games.kart.ui.KartRaceSurfaceTest", |
| 55 | "com.vayunmathur.games.kart.ui.KartSurfaceViewTest", |
| 56 | ) |
| 57 | ) |
| 58 | // Shared-JVM polluters keep forkEvery = 1 in the same companion task: |
| 59 | // KartViewModelTest and MainActivityTest instantiate KartViewModel, |
| 60 | // whose viewModelScope collects the process-wide preferencesDataStore |
| 61 | // ("settings" via KartDataStore, plus "kart_identity" via |
| 62 | // KartPairingStore) for the VM's lifetime and whose races bank cup / |
| 63 | // win / best-lap state other classes expect at defaults; |
| 64 | // KartViewModelTest also mutates the global KartNative.isAvailable. |
| 65 | // KartStoresTest writes the same two DataStores directly and asserts |
| 66 | // defaults first. All other classes batch. |
| 67 | isolatedClasses.addAll( |
| 68 | listOf( |
| 69 | "com.vayunmathur.games.kart.MainActivityTest", |
| 70 | "com.vayunmathur.games.kart.data.KartStoresTest", |
| 71 | "com.vayunmathur.games.kart.platform.KartViewModelTest", |
| 72 | ) |
| 73 | ) |
| 74 | } |
| 75 | |
| 76 | dependencies { |
| 77 | implementation(project(":sdk:controller")) |
| 78 | implementation(project(":library:e2ee-p2p")) |
| 79 | implementation(libs.androidx.datastore.preferences) |
| 80 | } |