krossbow
krossbow copied to clipboard
Make build fail if using Android-incompatible JVM APIs/deps
Based on this slack conversation, there should be a way to define an Android target (making use of the Android toolchain) in the build, so that using incompatible JVM dependencies or APIs fails the build.
An attempt lives here: 5f27a776c7264fe9d5de69531fb35bca85584c8c
But it requires actually installing the android toolchain locally and in the CI, and may not be worth it for now until people upvote this issue.
Another related comment: https://discuss.kotlinlang.org/t/how-to-specifiy-java-jdk-version-in-gradle/1804/5
Gradle setup is kinda described here: https://kotlinlang.org/docs/kmm-understand-project-structure.html#android-library
Creating an Android target might actually not be necessary nor desirable if we're not building an actual Android library (with manifest, potential R resources, etc.).
Another option could be to use AnimalSniffer to check for old Android API usages ru.vyarus.animalsniffer
.
EDIT: animal sniffer with Android signatures might be only useful for detecting usages of Android-specific APIs, but might not detect the use of unsupported Java features. To be double checked. Not that Java 9+ APIs would be detected via toolchains anyway.