I have a kotlin library project in the IntelliJ IDE with source folders like this:
src/main/com/mydomain/*.kt
src/forRelease/com/mydomain/*.kt
src/forDev/com/mydomain/*.kt
The bulk of the source code is in the main
folder. However, I’d like to build two slightly different versions of the library using the source file(s) held in the forRelease
and forDev
folders.
My gradle build file is written in kotlin.
I have managed to create sourceSets as follows:
kotlin {
sourceSets["main"].kotlin.srcDir("src/forRelease").srcDir("src/main")
sourceSets.create("forDev").kotlin.srcDir("src/forDev").srcDir("src/main")
}
However, I’m now stuck as to what to do with the sourceSets. If I run the assemble
gradle task it will correctly use the source code in src/main
and src/forRelease
, but how cab I assemble the library using the forDev
sourceSet?
Thanks in advance.