I'm happy to announce a new KMP-compatible NoSQL d...
# feed
j
I'm happy to announce a new KMP-compatible NoSQL database 🚀, with the release of my Kotlin Multiplatform library for _Couchbase Lite_: Kotbase! Couchbase Lite is a JSON document database for mobile/embedded applications. Features include: • SQL++, key/value, and full-text search queries • Observable queries, documents, databases, and replicators • Binary document attachments (blobs) • Cloud-to-edge and peer-to-peer data sync Kotbase supports Android, JVM, iOS, macOS, Linux, and MinGW. Please check it out and discuss in #couchbase.
🔥 8
🎉 1
👀 1
l
Do I have to pay for Kotbase/Couchbase Lite? Is it self-hostable? Is it free software?
I'm asking this because I quickly fell on https://www.couchbase.com/pricing/ which seems to be a paid only database
👆 2
j
The community edition of both Couchbase Lite and Couchbase Server is free and open source. The enterprise edition requires a license for production use, but is free to develop with. You can self host either edition of Couchbase Server. My KMP Kotbase library is free and open source with no additional licensing required.
c
Just in time, we have a greenfield app we are developing and I’ll be proposing this.
🙌🏼 1
🙌 1
c
Good morning @Jeff Lockhart... I have a potentially big question: I have added your library (the community version) to my KMM project:
Copy code
implementation("dev.kotbase:couchbase-lite:3.0.12-1.0.0")
My project cannot build:
Copy code
> Task :shared:linkDebugFrameworkIosX64
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors

The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
ld: warning: ignoring duplicate libraries: '-ldl', '-lobjc'
ld: framework 'CouchbaseLite' not found
Are there additional dependencies that must be added to my shared build.gradle.kts file?
I followed the instructions provided on this page: https://kotbase.dev/installation/
j
Hey, @coachroebuck! So that's a linker error. The native platforms need to link with the native CouchabseLite binary. I mention this in more detail here: https://kotbase.dev/platforms/#ios-macos, but I've also made a note and added a section to the installation docs about it. I just haven't published those updates to the docs yet. It is on the readme now though.
If you're using the CocoaPods plugin, the simplest way to link to the native framework is to add the pod as
linkOnly
, e.g.:
Copy code
kotlin {
    cocoapods {
        ...
        pod("CouchbaseLite", version = "3.0.12", linkOnly = true)
    }
}
I'm about to release an update that includes the latest Couchbase 3.0.x 3.0.15 version. I'll also publish the updated docs as well.
c
I chose to create the KMM project using the regular framework instead of the cocoapods dependency manager. I didn't want to deal with third party libraries at the time. 😞
j
That makes sense. CocoaPods isn't the greatest dependency manager, but it's one the iOS ecosystem has relied on for a long time. You could either migrate to using the CocoaPods plugin in your KMP project, or download and link to the binary manually. There are examples of both in the getting started apps. getting-started manually links to the framework within the repo. You could also use a Gradle task to download and extract the Objective-C framework to your build directory. getting-started-compose uses the CocoaPods plugin as I described above. The difference between CocoaPods plugin and regular framework is all in the iosApp.xcodeproj/project.pbxproj file. If you do a diff between the two example apps, you can see where the build scripts differ. (getting-started also uses the KMP-NativeCoroutines library, is the only other difference.) Maybe at some point Kotlin will provide a way to bundle the native binary with the Kotlin native klib and provide metadata for the consuming application to link to that binary at build time.
I just released Kotbase 3.0.15-1.0.1 to Maven Central. 🎉
👀 1
481 Views