I have a kotlin multi platform library.
I want to have extra code / API available in Debug build only.
This library is consumed by Android project.
I’ve added commonDebug inside build.gradle
and created my custom compilation and custom task to create debug jar.
kotlin {
sourceSets {
...
commonDebug {
dependsOn(commonMain)
}
}
targets {
...
jvm('jvm') {
compilations.create('debug') {
defaultSourceSet {
dependencies {
def main = compilations.main
// Compile against the main compilation's compile classpath and outputs:
implementation(main.compileDependencyFiles + main.output.classesDirs)
implementation(kotlin('stdlib'))
dependsOn(sourceSets.commonDebug)
dependsOn(sourceSets.jvmMain)
}
}
tasks.register('debugJar', Jar) {
def c = compilations.debug
from(c.compileDependencyFiles + c.output.classesDirs)
}
}
}
}
}
But how do i specify which jar do i need when i use this library from android project:
dependencies {
implementation project(':SharedLib')
}
Can i modify source set for debug build variant of a shared lib?