-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft-work in progress need dicussion! #17
base: ffi1.0
Are you sure you want to change the base?
Conversation
I've seen this approach, and there are some interesting tricks. However I'm more inclined to just write a tool that does the download. Probably a dart script that reads the pubspec.yaml or pubspeck.lock to get the version number and download the libs and copy them where they have to be. Something you run after With that being said, if you can get it working and tested for all platforms I'm happy to add it as an option. Having multiple options on how to get the artifacts is never a bad thing. A few things of the top of my head, to get the discussion started: Windows: the trick with cmake is pretty neat, and while cmake makes me nervous because I'm not too familiar with it, it could be the easiest platform to manage. Android: like objectbox, the .so libs would have to be included as aar artifact (from Maven, see https://search.maven.org/search?q=a:objectbox-android). This means that the 4 Android libs would have to be packaged and uploaded to maven. Last time I checked how to create a maven account and artifact I gave up after two days of reading the documentation and still not having any idea what I have to do to create an account. Unfortunately I don't have the time or energy to deal with it right now. macos, ios: this I understand even less because I remember even less about ios. Last time I developed an app for ios was in the objective-c times (2014 maybe?), and I remember almost nothing about what pods are and how to create them. linux: pfft, 😄 . I won't even bother building the library for linux. Even for a hobby project that's beyond my needs and interests. |
Good point here, was wondering is there a good reason of not using directly implementation "com.couchbase.lite:couchbase-lite-android:2.8.5" in gradle? I think it is somewhat doable, I guess still researching. |
@Rudiksz seems like for windows we need .lib file too! see here https://stackoverflow.com/questions/913691/dll-and-lib-files-what-and-why/913744 I don't know if you can help on that. |
Any help on how to build the libraries is appreciated. as I fail every time I attempt to do it. |
That is the Java library and you need to use Flutter's platform channels to use it. There is already a dart plugin for that, but it's Android and iOS only. |
Dart can look up symbols and functions from the dll directly. That's what the bindings.dart file is for. |
You need to use this fork of the C library https://github.com/Rudiksz/couchbase-lite-C I know nothing about building C code, and it took me a lot of trial and error to have it built on my windows machine. I use cmake that I downloaded myself, (instead of some version bundled with some other software) and did trial and error until I got it working. |
If the process can be documented would be a good starting point and for future development going forward. |
and I think the right branch to look for is couchbase-lite-C (dart-ffi1) |
In my last attempt, |
The dll is not meant to be used as a plugin. In fact, the point of this package is to have a dart package independent of flutter and flutter's platform channels. |
I failed to continue my contribution as I can not build the C library on my local machine, I will be happy to be engaged in any conversation that can move this project forward, I strongly believe that if we want to make this project a success we need first to set up the build instructions in the wiki page of the C libraries. this will help anyone to jump in and develop on this project. @Rudiksz |
The C library is still in beta status and is hardly even supported by Couchbase. For every platform I had to do a number of fixes to make it build, and they still break at random times. I don't even remember most of them, and I suspect they are specific to my environments. Lately there were also a lot of breaking changes implemented in the upstream repo, and with the changes in dart ffi, the custom code I have to add is a lot less. That should make working with the C part less error-prone, but not yet. Since both this library and dart's ffi are in beta and in constant evolution, I simply see no reason to spend time setting up a build pipeline yet. Specially seeing that there's not much interest for Couchbase in the Flutter community (Firebase being the de facto standard), and Couchbase does not seem to be interested in supporting Flutter. |
A new package to just hold the platform-specific code
couchbaselite_dart_flutter_libs
This package will have the code specific for each platform, the library such as .dll files and .so files will be downloaded as per the platform, the library will be downloaded from URL see example here LIBS I hope we can open discussion on how we can take this route and move forward.