Is it possible to configure a multi module project...
# gradle
h
Is it possible to configure a multi module project, containing several library modules (in my case one is KMP, 2 are android only) and one sample app android application, in such a way that: • The library modules use the latest kotlin version (1.7.20-RC) • The android application uses an older kotlin version (1.7.0) • The android application can still depend on the library modules using
implementation(project(":module-name"))
? This is because I am running into issues with several libraries that do not yet support Kotlin 1.7.20-RC (compose, hilt), but I need to use a feature specifically of Kotlin 1.7.20-RC (
kotlin.native.binary.objcExportSuspendFunctionLaunchThreadRestriction=none
) to properly support the ios side in KMP project.
e
only one Kotlin Gradle Plugin version is allowed per Gradle build
h
So that means that having a project dependency on another gradle module always means that you are in the same gradle build, thus cannot switch kotlin versions? So my only options are either • to find all cutting edge library versions that use the new kotlin version (if they exist) and use the same kotlin version • or publish my libraries to maven (local or remote), change kotlin version in the sample app, point to those published maven repositories and build with a different kotlin version right?
e
I'm not aware of a Kotlin/Hilt incompatibility in 1.7.20-RC, but you can get compose compiler plugin compatible with prerelease Kotlin at https://androidx.dev/storage/compose-compiler/repository (you do not need to update the rest of your compose libraries)
h
I think the issue lies with the KSP plugin, but when i try to start using 1.7.20-RC things get a bit messy so i might have misunderstood some errors
e
or you could build iOS with one Kotlin version, and in a completely separate build, build everything else with a different Kotlin version
h
hmm true, i could configure my devops and xcode build scripts like that, thats an idea as well
Thanks for the help, at least i better understand whats possible and whats not and what my options are 👍
v
If you really need separate builds to have separate Kotlin versions to build against, you can use composite build to combine them, so you don't need to publish and consume but still build everything together
e
for multiplatform projects there are still some issues with included builds :( https://youtrack.jetbrains.com/issue/KT-52172/Multiplatform-Support-composite-builds
v
☹️😲