Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / measure / build.gradle.kts
build.gradle.kts80 lines · 3.3 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 `:measure:metadata` task name either way. |
| 5 | id("common-conventions-preview-metadata") |
| 6 | } |
| 7 | |
| 8 | launcherIcon { |
| 9 | symbol = "straighten" |
| 10 | } |
| 11 | |
| 12 | android { |
| 13 | defaultConfig { |
| 14 | applicationId = "com.vayunmathur.measure" |
| 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 | // Visual-inertial tracking runs on the in-tree Rust CV core (`measure_cv`: |
| 27 | // Shi-Tomasi corners, pyramidal Lucas-Kanade, essential-matrix pose) behind |
| 28 | // the ArHitProvider seam. No third-party native CV library ships in the APK, |
| 29 | // so there is no prebuilt .so to fail 16 KB page-size alignment. See |
| 30 | // measure/src/main/rust/. |
| 31 | rustNativeLib("measure_cv", "measure") |
| 32 | |
| 33 | // Only the classes below actually load libmeasure_cv: they call |
| 34 | // MeasureCvNative directly, construct a VioEngine (whose init reads |
| 35 | // VioEngine.available -> MeasureCvNative.available and creates a native |
| 36 | // session when present), or launch MainActivity (which builds the |
| 37 | // ViewModel over the same engine seam). Tests that merely call the pure |
| 38 | // domain math, or compose contents from fake action objects without an |
| 39 | // engine/ViewModel, never load the library and stay in the main task. |
| 40 | // Quarantine the loaders and the shared-JVM polluters below into |
| 41 | // testDevUnitTestNative (forkEvery = 1); the remaining classes batch |
| 42 | // 20-per-JVM in testDevUnitTest, which depends on the quarantine task so |
| 43 | // the usual invocation still runs everything. |
| 44 | rustNativeTests { |
| 45 | nativeClasses.addAll( |
| 46 | listOf( |
| 47 | "com.vayunmathur.measure.MainActivityAndAnalyzerTest", |
| 48 | "com.vayunmathur.measure.platform.DirectByteBufferVioTest", |
| 49 | "com.vayunmathur.measure.platform.SyntheticVioHarnessTest", |
| 50 | "com.vayunmathur.measure.ui.MeasureContentsCoverageTest", |
| 51 | ) |
| 52 | ) |
| 53 | // Shared-JVM polluters keep forkEvery = 1 in the same companion task: |
| 54 | // MeasureViewModel reads the process-wide DataStoreUtils singleton |
| 55 | // synchronously at init and starts viewModelScope collectors on the |
| 56 | // orientation/tilt sensor flows that are never cleared when the test |
| 57 | // never clears the ViewModel; persisted DataStore state also leaks |
| 58 | // into classes expecting defaults. (Its init also touches |
| 59 | // VioEngine.available, so these classes would load the native |
| 60 | // library too — another reason they cannot batch.) Audit rule: any |
| 61 | // test instantiating MeasureViewModel belongs here. |
| 62 | // MainActivityAndAnalyzerTest also builds one but is already |
| 63 | // quarantined as a native loader above. All other classes batch. |
| 64 | isolatedClasses.addAll( |
| 65 | listOf( |
| 66 | "com.vayunmathur.measure.platform.ArFlowViewModelTest", |
| 67 | "com.vayunmathur.measure.platform.MeasureViewModelTest", |
| 68 | "com.vayunmathur.measure.ui.ArMeasurePageTest", |
| 69 | "com.vayunmathur.measure.ui.MeasurePagesTest", |
| 70 | ) |
| 71 | ) |
| 72 | } |
| 73 | |
| 74 | dependencies { |
| 75 | implementation(libs.androidx.camera.core) |
| 76 | implementation(libs.androidx.camera.camera2) |
| 77 | implementation(libs.androidx.camera.lifecycle) |
| 78 | implementation(libs.androidx.camera.compose) |
| 79 | implementation(libs.androidx.datastore.preferences) |
| 80 | } |