I’m working on a <library> written in java. It is ...
# gradle
j
I’m working on a library written in java. It is used by applications written for Android (among other places). A while back, the team included
AndroidLint
in its CI pipeline build to make sure they were compatible with that. So far, so good. Now, the project wants to explore that lib to Kotlin, ideally using an incremental migration. In my research, I haven’t been able to find a way to compile Kotlin both for the jvm and for android from the same build, as the
java
and the
kotlin-android
plugins are incompatible. Is there a technique for doing this that I’ve not uncovered yet?
e
the incremental approach would be to keep it the same as Java - build it targeting the JVM only, and (as long as you use a compatible subset of the Java standard classpath and compatible bytecode level) it will work on Android
the
com.android.lint
plugin works with non-Android projects, https://googlesamples.github.io/android-custom-lint-rules/usage/agp-dsl.md.html
j
Ah, ta. Fully agree with your first comment. This is a codebase that provides stable functionality, but has grown long in the tooth over the years. I don’t think they knew about the
com.android.lint
plugin at the time.
w
The #multiplatform plugin lets you compile the same common kotlin source to multiple targets.