krossbow icon indicating copy to clipboard operation
krossbow copied to clipboard

Make build fail if using Android-incompatible JVM APIs/deps

Open joffrey-bion opened this issue 4 years ago • 3 comments

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.

joffrey-bion avatar Apr 19 '20 09:04 joffrey-bion

Another related comment: https://discuss.kotlinlang.org/t/how-to-specifiy-java-jdk-version-in-gradle/1804/5

joffrey-bion avatar Nov 17 '20 15:11 joffrey-bion

Gradle setup is kinda described here: https://kotlinlang.org/docs/kmm-understand-project-structure.html#android-library

joffrey-bion avatar Oct 13 '21 19:10 joffrey-bion

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.

joffrey-bion avatar Jan 17 '23 13:01 joffrey-bion