Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / euicc / build.gradle.kts
build.gradle.kts86 lines · 3.6 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 `:euicc:metadata` task name either way. |
| 5 | id("common-conventions-preview-metadata") |
| 6 | } |
| 7 | |
| 8 | launcherIcon { |
| 9 | symbol = "sim_card" |
| 10 | } |
| 11 | |
| 12 | android { |
| 13 | defaultConfig { |
| 14 | applicationId = "com.vayunmathur.euicc" |
| 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 | // SGP.22 core (ASN.1 + ES9+/ES10 + crypto) is native, loaded as libeuicc.so. |
| 27 | // See euicc/src/main/rust/. |
| 28 | rustNativeLib("euicc") |
| 29 | |
| 30 | // Only the classes below actually load libeuicc: they call EuiccNative |
| 31 | // externs directly, or open the ISD-R channel over the fake telephony |
| 32 | // shadow so the native core runs (any touch of EuiccNative, including |
| 33 | // installing activeChannel, initialises the object and loads the |
| 34 | // library). Tests that never open a channel — the no-hardware |
| 35 | // EuiccManagerService/EuiccChannelManager paths throw before |
| 36 | // EuiccNative is touched — and pure data/UI tests stay in the main |
| 37 | // task. Quarantine the loaders and the shared-JVM polluters below into |
| 38 | // testDevUnitTestNative (forkEvery = 1); the remaining classes batch |
| 39 | // 20-per-JVM in testDevUnitTest, which depends on the quarantine task so |
| 40 | // the usual invocation still runs everything. |
| 41 | rustNativeTests { |
| 42 | nativeClasses.addAll( |
| 43 | listOf( |
| 44 | "com.vayunmathur.euicc.EuiccNativeTest", |
| 45 | "com.vayunmathur.euicc.FakeEuiccIntegrationTest", |
| 46 | "com.vayunmathur.euicc.FakeSmdpIntegrationTest", |
| 47 | "com.vayunmathur.euicc.telephony.EuiccChannelManagerFakeTest", |
| 48 | ) |
| 49 | ) |
| 50 | // Shared-JVM polluters keep forkEvery = 1 in the same companion |
| 51 | // task: EuiccViewModel's init calls the process-wide |
| 52 | // NetworkClient.init and launches a viewModelScope reload whose IO |
| 53 | // work is never cleared when the test never calls onCleared; its |
| 54 | // tests drain state by polling the main looper. Audit rule: any |
| 55 | // test instantiating EuiccViewModel (or rendering Navigation, |
| 56 | // which takes one) belongs here. This module's DataStore |
| 57 | // dependency is unused by main/test sources, so no DataStore |
| 58 | // polluters exist here. All other classes batch. |
| 59 | isolatedClasses.addAll( |
| 60 | listOf( |
| 61 | "com.vayunmathur.euicc.NavigationAndActivitiesTest", |
| 62 | "com.vayunmathur.euicc.platform.EuiccViewModelTest", |
| 63 | ) |
| 64 | ) |
| 65 | } |
| 66 | |
| 67 | dependencies { |
| 68 | // Compile-only stubs for the framework's @SystemApi eSIM LPA classes |
| 69 | // (android.service.euicc.*, EuiccProfileInfo). Provided by the framework at |
| 70 | // runtime on a system image; must NOT be packaged. |
| 71 | compileOnly(project(":library:aosp-stubs")) |
| 72 | // Unit tests reference the EuiccService surface at compile time; at runtime |
| 73 | // Robolectric supplies the framework's real classes. |
| 74 | testCompileOnly(project(":library:aosp-stubs")) |
| 75 | // Rust reaches the SM-DP+ over HTTP through the flat-framed JNI bridge in |
| 76 | // library:network (NativeHttpBridge), so libeuicc.so links no TLS of its own. |
| 77 | implementation(project(":library:network")) |
| 78 | // Local per-profile nicknames / prefs. |
| 79 | implementation(libs.androidx.datastore.preferences) |
| 80 | // QR activation-code scanning (CameraX preview + ZXing decode). |
| 81 | implementation(libs.androidx.camera.core) |
| 82 | implementation(libs.androidx.camera.camera2) |
| 83 | implementation(libs.androidx.camera.lifecycle) |
| 84 | implementation(libs.androidx.camera.view) |
| 85 | implementation(libs.zxing.core) |
| 86 | } |