https://kotlinlang.org logo
Title
m

MarkRS

09/22/2021, 9:34 AM
Why does the KMM application type generate an Android module with a "java" directory rather than a "kotlin" one? I suppose the more important (?) question is, is there any reason not to rename it "kotlin"?
e

ephemient

09/22/2021, 3:52 PM
Android sourceset is… special. it doesn't use a "kotlin" directory unless you specifically configure it, e.g.
android.sourceSets.all { java.srcDir("src/$name/kotlin" }
.
since the Kotlin plugin uses Android sourceset's java.srcDirs, "java" works right out of the box
m

MarkRS

09/22/2021, 4:30 PM
Thank you @ephemient. Therefore would I be right in thinking there's no harm in making the necessary changes? Surely it looks likely such a change will become standard in the not too distant future?
e

ephemient

09/22/2021, 6:52 PM
yes, it's safe to make those changes. I'm not sure if it will become standard, this is how it's been for the whole existence of kotlin-android gradle plugin, and the android plugin doesn't have a way to register custom sourcedirectorysets
👍 1
a

andylamax

09/24/2021, 11:03 AM
actually the android plugin allows registering custom directory source and resources sets. I have been doing it for quite a while now