Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / astronomy / build.gradle.kts
build.gradle.kts78 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 `:astronomy:metadata` task name either way. |
| 5 | id("common-conventions-preview-metadata") |
| 6 | } |
| 7 | |
| 8 | launcherIcon { |
| 9 | symbol = "star" |
| 10 | } |
| 11 | |
| 12 | android { |
| 13 | defaultConfig { |
| 14 | applicationId = "com.vayunmathur.astronomy" |
| 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 celestial transforms + sky projection (Rust). See astronomy/src/main/rust/. |
| 27 | rustNativeLib("astronomy_engine", "astronomy") |
| 28 | |
| 29 | // Only the classes below actually load a native library: they call |
| 30 | // CoordinateTransforms.batchRaDecToAltAz or projectAll (both read |
| 31 | // AstronomyNative.available — NativeLoader.load("astronomy_engine") — |
| 32 | // and forward to the Rust batch entry points when present), |
| 33 | // ProjectionEdgeCasesTest also calls AstronomyNative directly, and the |
| 34 | // two sky-canvas tests compose SkyCanvas over a populated sky, which |
| 35 | // projectAlls its stars. Quarantine those loaders into |
| 36 | // testDevUnitTestNative (forkEvery = 1); the remaining classes batch |
| 37 | // 20-per-JVM in testDevUnitTest, which depends on the quarantine task so |
| 38 | // the usual invocation still runs everything. |
| 39 | rustNativeTests { |
| 40 | nativeClasses.addAll( |
| 41 | listOf( |
| 42 | "com.vayunmathur.astronomy.domain.engine.CoordinateTransformsTest", |
| 43 | "com.vayunmathur.astronomy.domain.engine.EngineEdgeCasesTest", |
| 44 | "com.vayunmathur.astronomy.domain.projection.ProjectionEdgeCasesTest", |
| 45 | "com.vayunmathur.astronomy.ui.AstronomyScreensTest", |
| 46 | "com.vayunmathur.astronomy.ui.SkyCanvasDrawTest", |
| 47 | ) |
| 48 | ) |
| 49 | // Shared-JVM polluters keep forkEvery = 1 in the same companion task: |
| 50 | // every class below instantiates AstronomyViewModel (MainActivityRoboTest |
| 51 | // via MainActivity's by viewModels()), whose viewModelScope owns |
| 52 | // AstronomyPrefs over the process-wide DataStoreUtils singleton |
| 53 | // ("datastore_default"), eagerly stateIns the visible-sky flow, and |
| 54 | // launches orientation/location/ticker collectors that outlive a |
| 55 | // single test; the VM also recomputes the sky through the native |
| 56 | // batch path above. Persisted prefs and leaked collectors leaking |
| 57 | // into a batched neighbour are the appstore DataStore hang shape. |
| 58 | // All other classes batch. |
| 59 | isolatedClasses.addAll( |
| 60 | listOf( |
| 61 | "com.vayunmathur.astronomy.MainActivityRoboTest", |
| 62 | "com.vayunmathur.astronomy.NavigationRouteTest", |
| 63 | "com.vayunmathur.astronomy.platform.AstronomyViewModelLocationTest", |
| 64 | "com.vayunmathur.astronomy.platform.AstronomyViewModelTest", |
| 65 | "com.vayunmathur.astronomy.ui.AstronomyPagesTest", |
| 66 | "com.vayunmathur.astronomy.ui.ObjectDetailPagesTest", |
| 67 | "com.vayunmathur.astronomy.ui.SkyMapScreenTest", |
| 68 | ) |
| 69 | ) |
| 70 | } |
| 71 | |
| 72 | dependencies { |
| 73 | implementation(libs.androidx.camera.core) |
| 74 | implementation(libs.androidx.camera.camera2) |
| 75 | implementation(libs.androidx.camera.lifecycle) |
| 76 | implementation(libs.androidx.camera.compose) |
| 77 | implementation(libs.androidx.datastore.preferences) |
| 78 | } |