hfhbd
05/13/2024, 8:14 AMhfhbd
05/13/2024, 8:16 AMimport org.jetbrains.kotlin.gradle.plugin.*
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
id("com.android.library")
kotlin("plugin.parcelize")
}
kotlin {
jvm()
js(IR) {
browser()
nodejs()
}
// tier 1
linuxX64()
macosX64()
macosArm64()
iosSimulatorArm64()
iosX64()
// tier 2
linuxArm64()
watchosSimulatorArm64()
watchosX64()
watchosArm32()
watchosArm64()
tvosSimulatorArm64()
tvosX64()
tvosArm64()
iosArm64()
// tier 3
androidNativeArm32()
androidNativeArm64()
androidNativeX86()
androidNativeX64()
mingwX64()
watchosDeviceArm64()
jvmToolchain(8)
applyDefaultHierarchyTemplate {
common {
group("linuxDerivat") {
group("androidNative")
group("linux")
}
}
}
}
android {
compileSdk = 34
}
kotlin {
androidTarget {
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
}
}
tasks.register("printDependsOns") {
doFirst {
kotlin.sourceSets.map { from ->
"${from.name} -> ${from.dependsOn.map { it.name }}"
}.sorted().forEach { println(it) }
}
}
hfhbd
05/13/2024, 8:18 AMandroidDebug -> [commonMain]
androidInstrumentedTest -> [commonTest]
androidInstrumentedTestDebug -> [commonTest]
androidMain -> [commonMain]
androidRelease -> [commonMain]
androidUnitTest -> [commonTest]
androidUnitTestDebug -> [commonTest]
androidUnitTestRelease -> [commonTest]
But I miss the intermediate source sets: androidDebug -> androidMain -> commonMain
or androidUnitTest -> androidTest -> commonTest
hfhbd
05/13/2024, 8:29 AMandroid
but I am surprised I need to add the group manually:
kotlin {
applyDefaultHierarchyTemplate {
common {
group("android") {
withAndroidTarget()
}
}
}
}