loke
05/14/2025, 3:07 AMcommonJvm
module which the jvm
and android
modules can use, so I can break out the Android-specific code while keeping the majority in a single module.
Now, the problem: This is not really an Android project, and the toplevel build is not using the Android plugin. So what I have done is to make all the android-specific code conditional on a configuration parameter.
My question is, is this a good way to do it? Here is the code that does this: https://codeberg.org/loke/array/src/branch/jvm-android-split-new/array/build.gradle#L44
The key code looks like this:
applyDefaultHierarchyTemplate { x ->
x.group("common") { y ->
y.group("commonJvm") { z ->
z.withJvm()
if (Boolean.parseBoolean(project.getProperty("kap.settings.androidEnabled"))) {
z.withAndroid()
}
}
}
}
ephemient
05/14/2025, 5:02 PMloke
05/14/2025, 5:04 PMephemient
05/14/2025, 5:09 PMloke
05/15/2025, 3:31 AMandroidEnabled
set to true, while the project which I linked to will have it false.