https://www.gravatar.com/avatar/5fe8f40633300a70ea088a594cb33031?s=240&d=mp

Testing a Shared KMM Repo Locally

There’s a lot of different ways of organizing your Kotlin Multiplatform Mobile codebase, Ben Asher and I gave an overview of some of those at KotlinConf 2019, where I described a setup where the shared code lives in your iOS and Android codebase and is copied between them. The pro of this was an easy local development setup, but there are a lot of cons. We moved away from this style to a separate (third) repository for the multiplatform code last year.

What we do in the shadows

If you’re in the business of publishing JVM libraries its possible you’ve needed to deal with dependency shading - bundling external jars in with your library and renaming the packages along the way to prevent a diamond dependency conflict. If your published JVM library is built with Gradle it’s then likely you’ve used John Engleman’s shading plugin ‘shadow’. It’s really a fantastic plugin to solve this problem, thank you mr engleman.

Mysterious SQLite bugs and how to solve them.

TLDR: Android 30 upgrades SQLite from 3.22.0 -> 3.28.0, this introduces new alter table behavior which will potentially cause runtime exceptions when ALTER TABLE statements are ran on tables which are used in a view. To preserve old behavior turn on PRAGMA legacy_alter_table=ON before running your migrations. Late last week we experienced a weird bug on Cash App happening to a few of our developers - reproducibly but not for everyone.

SQLite Helper Queries

In programming one of the earliest tools we’re given for simplifying complex code is helper functions. Splitting code into smaller more digestible blocks makes it easier to maintain and read, which is usually more important than code that’s easier to write. In SQL we have tools for accomplishing the same thing! One of the bigger ones is views which can help share an underlying query between multiple other ones. Leandro Favarin wrote a great post on how to put views into practice in SQLite here.

Supporting Multiple Dialects in SQLDelight

With SQLDelight 1.3.0 and above we now support multiple dialects of SQL (at time of writing: SQLite 3.18, SQLite 3.24, and MySQL). They’re not complete implementations of any of those dialects but they support necessary features and the real meat of the release is a straightforward framework for adding parts of the dialects incrementally. For example, SQLite 3.24 is just SQLite 3.18 with upsert on top (thank you Angus Holder!).

Integrating Github Actions for Kotlin Multiplatform

With Kotlin Multiplatform (KMP) it’s possible to build artifacts for multiple platforms using the same toolchain, but until portable artifacts for KMP are released you need to build platform artifacts on their respective platforms. With SqlDelight 1.2.2 we now also deploy Windows (mingW) artifacts, meaning it’s impossible to publish from a single OS (since we also support macOS targets). There was no simple setup with Travis and Github Actions is the new hot stuff so we gave that a go and here’s how it works: