11## AnkiDroid Common
22
3- AnkiDroid Common is a [ Gradle module] ( https://developer.android.com/topic/modularization )
3+ AnkiDroid Common is a pure JVM [ Gradle module] ( https://developer.android.com/topic/modularization )
44containing utility functions, and definitions for core functionality used by other modules
55within AnkiDroid. Common should be the base of the AnkiDroid dependency tree.
66
7- Common is used by ` libAnki ` (which has no Android dependencies), so dependencies on the Android
8- framework should be in packages named ` android ` .
7+ Common has no Android dependencies. Code requiring Android APIs belongs in ` :common:android ` .
98
109This module is expected to define interfaces which are initialized in the ` AnkiDroid ` module
1110
@@ -19,48 +18,29 @@ These are to be initialized higher up the dependency tree, typically in `AnkiDro
1918
2019### ` com.ichi2.anki.common.utils `
2120
22- Utility classes and methods without an Android dependency
23-
21+ Utility classes and methods
2422
2523### ` com.ichi2.anki.common.utils.ext `
2624
2725Extension methods, universally applicable to the classes they extend
2826
29- Examples:
30-
31- * ` Int.kt ` - ` ifNotZero `
32- * ` InputStream.kt ` - ` convertToString `
33-
34- ### ` com.ichi2.anki.common.utils.android `
35-
36- Utilities with a dependency on Android
37-
3827## Context
3928
40- This is a work in progress. As discussed in
29+ As discussed in
4130[ #12582 ] ( https://github.com/ankidroid/Anki-Android/issues/12582 ) , AnkiDroid decided to split the
4231codebase into two modules, ` libAnki ` (business logic) and ` AnkiDroid ` (code interacting with
43- Android APIs).
44-
45- At the time of writing, this split is not yet done. We expect to do it with the following steps:
32+ Android APIs). ` common ` existed for logic which both ` AnkiDroid ` and ` libAnki ` depended on.
4633
47- * ` com.ichi2.compat ` was deemed to be an easy module to split out to trial this refactor
48- but this had circular dependencies
49- * A ` common ` module was proposed to fix this
50- * To reduce the execution time of tests, ` libAnki ` should have no dependencies on Android
51- * A lint rule will be applied to ` libAnki ` from using Android dependencies
52- * The alternate: splitting modules based on architecture was deemed to be unwieldy
34+ Later, ` compat ` was split out, also depending on ` common ` , solidifying ` common `
5335
54- The following were blockers for ` compat ` to be split out
36+ [ Backend - #647 ] ( https://github.com/ankidroid/Anki-Android-Backend/issues/674 ) : ` libAnki ` is
37+ intended to be converted to a ` java-library ` , so ` :common ` was split into ` :common:android ` ,
38+ ensuring that
5539
56- * ` isRobolectric `
57- * ` CrashReportService `
58- * ` showThemedToast `
59- * ` TimeManager ` (maybe)
60- * ` @KotlinCleanup ` (maybe)
6140
6241Discussed on Discord: https://discord.gg/qjzcRTx
6342
6443* Discussion: https://discord.com/channels/368267295601983490/701922522836369498/1243991110888591482
6544* Thread: https://discord.com/channels/368267295601983490/1244372448233914438
6645* https://github.com/ankidroid/Anki-Android/pull/16498
46+ * [ #20547 - extract ` :compat ` ] ( https://github.com/ankidroid/Anki-Android/issues/20547 )
0 commit comments