Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / passwords / build.gradle.kts

build.gradle.kts118 lines · 5.6 KiBRaw
1plugins {
2 id("common-conventions-app")
3 // Listing screenshots come from Compose previews (src/screenshotTest), not from an
4 // instrumented test on a device. Same `:<module>:metadata` task name either way.
5 id("common-conventions-preview-metadata")
6 alias(libs.plugins.ksp)
7}
8
9launcherIcon {
10 symbol = "key_vertical"
11}
12
13android {
14 defaultConfig {
15 minSdk = 35
16 applicationId = "com.vayunmathur.passwords"
17 }
18 packaging {
19 resources.excludes += "META-INF/INDEX.LIST"
20 }
21 testOptions {
22 // CtapProcessor logs through android.util.Log, which is a stub that throws in JVM unit
23 // tests. Returning defaults lets the CTAP logic be tested without stripping the logging
24 // that makes caBLE sessions diagnosable on a device.
25 unitTests.isReturnDefaultValues = true
26 }
27}
28
29androidComponents {
30 onVariants { variant ->
31 variant.sources.jniLibs?.addStaticSourceDirectory(
32 layout.buildDirectory.dir("rustJniLibs").get().asFile.absolutePath
33 )
34 }
35}
36
37// Native KDBX (KeePass) read/write (Rust `keepass` crate). See passwords/src/main/rust/.
38// Sole KDBX implementation (replaced keepassjava2 + Bouncy Castle, both now removed);
39// existing .kdbx vaults stay interoperable.
40rustNativeLib("passwords_kdbx", "passwords-kdbx")
41
42// Only the classes below actually load a native library: they execute a
43// path that touches KdbxNative (libpasswords_kdbx, via NativeKdbxCodec's
44// read/write, KdbxBackupFormat's import/export over that codec, or
45// runKdbxSync's engine wired to NativeKdbxCodec). Tests that merely use
46// a FakeCodec, construct KdbxBackupFormat / a ViewModel without calling
47// its export/import, or hit the fail-closed / NotConfigured branches
48// before the codec never load the library and stay in the main task.
49// Quarantine the loaders and the shared-JVM polluters below into
50// testDevUnitTestNative (forkEvery = 1); the remaining classes batch
51// 20-per-JVM in testDevUnitTest, which depends on the quarantine task so
52// the usual invocation still runs everything.
53rustNativeTests {
54 nativeClasses.addAll(
55 listOf(
56 "com.vayunmathur.passwords.platform.KdbxBackupFormatExtraTest",
57 "com.vayunmathur.passwords.platform.KdbxBackupFormatVaultPathTest",
58 "com.vayunmathur.passwords.sync.NativeKdbxCodecExtraTest",
59 "com.vayunmathur.passwords.sync.NativeKdbxCodecTest",
60 "com.vayunmathur.passwords.sync.RunKdbxSyncEndToEndTest",
61 )
62 )
63 // Shared-JVM polluters keep forkEvery = 1 in the same companion task:
64 // DataStoreUtils is a process-wide singleton whose init eagerly
65 // collects the preferences DataStore, and PasswordsViewModel turns
66 // the repository's flows into viewModelScope stateIn collectors
67 // (SharingStarted.WhileSubscribed) that are never cleared when the
68 // test never calls onCleared; persisted DataStore state also leaks
69 // into classes expecting defaults. Same hazard for tests that use
70 // KdbxSyncSettings / KdbxSyncSection (its DataStore-backed flows),
71 // drive runKdbxSync's settings recording, initialise WorkManager /
72 // KdbxSyncScheduler, launch MainActivity (which builds the
73 // ViewModel), or drive the autofill / passkey credential services
74 // and CableService, whose serviceScope (SupervisorJob + IO) launches
75 // are never cancelled. Audit rule: any test instantiating
76 // PasswordsViewModel (or launching MainActivity, which builds one),
77 // using KdbxSyncSettings / DataStoreUtils-backed settings directly,
78 // rendering KdbxSyncSection, or building PasswordAutofillService /
79 // PasskeyCredentialService / CableService belongs here. All other
80 // classes batch.
81 isolatedClasses.addAll(
82 listOf(
83 "com.vayunmathur.passwords.platform.AutofillServiceDispatchTest",
84 "com.vayunmathur.passwords.platform.ImportFailureTest",
85 "com.vayunmathur.passwords.platform.MainActivityGateTest",
86 "com.vayunmathur.passwords.platform.PasswordsViewModelCsvInternalsTest",
87 "com.vayunmathur.passwords.platform.PasswordsViewModelExtraTest",
88 "com.vayunmathur.passwords.platform.PasswordsViewModelImportTest",
89 "com.vayunmathur.passwords.platform.PasswordsViewModelTest",
90 "com.vayunmathur.passwords.platform.ServicesExtraTest",
91 "com.vayunmathur.passwords.platform.ServicesRoboTest",
92 "com.vayunmathur.passwords.sync.KdbxSettingsAndRunSyncTest",
93 "com.vayunmathur.passwords.sync.KdbxSyncSchedulerTest",
94 "com.vayunmathur.passwords.sync.RunKdbxSyncExtraTest",
95 "com.vayunmathur.passwords.sync.RunKdbxSyncFullPathTest",
96 "com.vayunmathur.passwords.ui.ComposeInteractionsExtraTest",
97 "com.vayunmathur.passwords.ui.KdbxSyncSectionComposeTest",
98 "com.vayunmathur.passwords.ui.KdbxSyncSectionExtraComposeTest",
99 "com.vayunmathur.passwords.ui.PageWrappersComposeTest",
100 "com.vayunmathur.passwords.ui.PagesComposeExtraTest",
101 "com.vayunmathur.passwords.ui.PagesComposeTest",
102 )
103 )
104}
105
106dependencies {
107 implementation(project(":library:biometric"))
108 implementRoom(libs)
109 implementation(project(":library:room"))
110 implementation(libs.androidx.fragment.ktx)
111 implementation(libs.androidx.biometric)
112 implementation(libs.androidx.credentials.lib)
113 implementation(libs.androidx.autofill)
114 implementation(libs.androidx.work.runtime.ktx)
115 // Own WebSocketClient via :library:network – no Ktor
116 implementation(project(":library:network"))
117 testImplementation(libs.androidx.work.testing)
118}