I have a multiplatform library targeting JS and the JVM. I’m currently compiling for JVM9+, but I also want to compile the same source to 1.8 separately for legacy compatibility. It could then be published to Maven with a classifier like “jvm8” or maybe as a separate module.
So how would I go about doing this, if it’s even possible?
I was thinking something with compilations, like this:
kotlin {
jvm {
compilations {
val main by getting {
kotlinOptions {
jvmTarget = "9"
// ...
}
}
val jvm8 by creating {
kotlinOptions {
jvmTarget = "1.8"
// ...
}
}
}
}
}
However, I’m unclear on how to share the source between the two. I’m also unclear how I would configure the publishing.