refactor: move custom DB methods out of libAnki#18676
refactor: move custom DB methods out of libAnki#18676BrayanDSO merged 6 commits intoankidroid:mainfrom
Conversation
AnkiDroid/src/main/java/com/ichi2/anki/backend/BackendDBUtils.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/backend/BackendDBUtils.kt
Outdated
Show resolved
Hide resolved
Arthur-Milchior
left a comment
There was a problem hiding this comment.
I tihnk the commit message stating that you want to remove circular dependency is too vague. What you really do is reducing the dependency of anki to libanki, if I get it right.
You may want to add # before the issue number so that it's clickable
| * this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package com.ichi2.anki.backend |
There was a problem hiding this comment.
I think what may be really useful is to have a small README.md in the folder, to explain what we can expect to find in this folder, what is the logic used to decide what to put in it.
The code is right since it's, as far as I understand, only moved code. But if we try to improve the architecture, it may be nice to simultaneously explain in the code tree the architecture choice.
There was a problem hiding this comment.
What would you want in the readme?
My ping was for your comments regarding the package/naming.
I needed to extract this functionality, but it didn't fit well within the current package structure of the app.
If I were to write the readme, it would explain that the classes here are primarily adapters, extensions and utilities for libanki and the Rust-based backend (rsdroid). Mainly:
- To extend python-based signatures to make them more idiomatic kotlin
- Combining business logic with
libanki - To better document
libanki/rsdroid - Combining Android dependencies with
libanki/rsdroid
But: I don't know if you like the concept of this package, and whether we should split it further.
There was a problem hiding this comment.
I don't really know what I'd want, because I didn't really understand what was there. And yes, the explanation you give seems fine.
I guess, if I get it right, something such as:
This folder contains part of the back-end that is Kotlin-specific. It adds various helper, allowing to access the rust-backend and libanki (a port of Anki's python as literal as possible) in a way that is Kotlin-like.
There was a problem hiding this comment.
com.ichi2.anki.backendThis package makes the Anki backend (
com.ichi2.libanki) more easily consumable by an Android app.
It does so by adding helper methods, extension methods, and functionality which depends on Android.
libankiis expected to matchanki/pylib, with minimal Android dependencies and noAnki-Android
dependencies. Ascom.ichi2.anki.backendis inAnki-Android, these constraints do not apply.
|
I'm having trouble to really get an opinion, because I've no idea even what anki is supposed to be. There are so many things in it. I know libanki is a translation of upstream back-end folder, that one is easy to understand. If there is a document/issue that state the ultimate goal according to you that would help. In the meantime, as a way to separate libanki, I'm fine with this PR |
9722f85 to
ea2e3f4
Compare
lukstbit
left a comment
There was a problem hiding this comment.
LGTM, the issues below are not blocking more like notes.
Related to naming, I'm not able to come up with something better so they are fine from my point of view.
AnkiDroid/src/main/java/com/ichi2/anki/backend/BackendDBUtils.kt
Outdated
Show resolved
Hide resolved
ea2e3f4 to
959dc5c
Compare
|
Thanks! This PR was a mix of 'later' and 'newer' commits from the libAnki split PR (and I think it's the last one before we start moving files) The reviews here have been really useful to have a 'high level' view of where things move to, rather than the mechanical 'make things work' |
959dc5c to
036a68f
Compare
036a68f to
3545e88
Compare
* BackendDBUtils.withAndroidFramework Removes a cyclic dependency: libAnki <-> AnkiDroid Issue 18015
In order for us to remove the Android dependency Issue 18015
For us to remove the libAnki <-> AnkiDroid circular dependency Issue 18015
3545e88 to
622921f
Compare
For us to remove the libAnki <-> AnkiDroid circular dependency Issue 18015
622921f to
babbed3
Compare
`BackendDBUtils.withAndroidFramework` => `createDatabaseUsingAndroidFramework` `AnkiDroidDB.withRustBackend` => `createDatabaseUsingRustBackend`
For us to remove the libAnki <-> AnkiDroid circular dependency
libankito a module #18565Would appreciate someone (@lukstbit / @Arthur-Milchior ?) going over the new class/package names, I'm not too happy, but don't know how you want to move forwards
I also feel these should be combined in a follow-on commit, but wanted a thought on placement/naming first
com.ichi2.anki.backend.AnkiDroidDBcom.ichi2.anki.backend.BackendDBUtilsChecklist