Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Support 2.1.53 desktop version #2

Merged
merged 8 commits into from
Jun 26, 2022

Conversation

dae
Copy link

@dae dae commented Jun 16, 2022

Posting this for reference; recommend you pull it into an ankidroid-2.1.53 branch instead of main, which a new -Backend PR can then consume.

This reworks David's previous AnkiDroid-specific changes to work with the latest desktop code, and moves most of the additional Rust code from the -Backend repo into a patch on rslib. This greatly cuts down on the JNI boilerplate, and improves error handling. Most of the additional code is in separate files, so conflicts when rebasing over newer Anki versions should be fairly rare.

dae and others added 5 commits June 16, 2022 15:53
We add sqlite.proto and define interfaces to access this from rslib-bridge

(cherry picked from commit 6d5d150)
This works for all but open/closeBackend. This is because we currently return
raw values rather than protobuf byte streams.

This is WIP as the Rust could be implemented better - possibly a macro

A function was attempted and should be tried again with a single lambda
Multiple parameters made execution significantly slower.

But, learning how to do macros can wait until the library is released.

(cherry picked from commit 8cb83f4)
The anki crate should expose these as features in the future.
@dae
Copy link
Author

dae commented Jun 16, 2022

Please hold off on merging this until I have a chance to fix a Windows/Mac issue with the protobuf files.

- Reuses existing protobuf infrastructure to greatly cut down on the
JNI boilerplate
- Ensures all calls have errors handled, and happen behind a mutex
- Removes separate downgrade + open11 calls in favour of a flag to
the standard collection opening routine
- Various code cleanups
@dae
Copy link
Author

dae commented Jun 16, 2022

Should be good to go now; all tests are passing in the -Backend repo.

@mikehardy
Copy link
Member

Just agreeing with the mechanical / source integration comment here, preliminarily:

recommend you pull it into an ankidroid-2.1.53 branch instead of main, which a new -Backend PR can then consume.

The rest seems like deciding where to move the dirt under the rug, and I have a default position of agreeing with you as rust lib owner and following "implementor's choice" bias, but I want to review to make sure of course

@mikehardy mikehardy changed the base branch from main to ankidroid-2.1.53 June 26, 2022 00:02
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's my sincere hope to have as much of this as possible upstream-ed but this is already an improvement structurally as a sort of git branch-extension off the upstream tag. Not too hard to follow

I've done a branch here on our fork at your upstream 2.1.53 tag, re-targeted this PR to point to it and that should be how to do it unless my git-fu fails me

@mikehardy mikehardy merged commit 6ffa055 into ankidroid:ankidroid-2.1.53 Jun 26, 2022
@dae dae deleted the ankidroid-2.1.53 branch November 22, 2022 09:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants