I know that there’s a possibility to name your dir...
# gradle
s
I know that there’s a possibility to name your directory as
src/**/java
or
src/**/kotlin
and then gradle recognizes those two as separate source sets. For example there’s a bug in
ktlint-gradle
since it doesn’t handle that case. We’ve now migrated from that plugin and can use the
kotlin
name, but question is, should we? Is there any build speed or anything really that would improve by doing such a move? Our project is 100% Kotlin already and will stay so too.
t
no, there is no build speed or whatever improvement
s
Aha so a purely aesthetic change then. Good to know, thank you!
v
Having by default the possibility to have Kotlin files in
src/**/java
was afair just to ease the incremental migration of Java projects to Kotlin so that all sources can be kept along. But actually it is not really following the Gradle standard of having separate directories for separate languages. I personally don't really like it if there are foreign files, it just feels wrong to have Kotlin files in the
java
folder. And more so if it is a pure Kotlin project.
s
Thanks for the perspective from gradle too. In the end we just did migrate to naming them
kotlin
just cause it simply felt weird to name it
java
where we had 0% java code in any of our modules.
t
Probably one thing worth to be aware of - by default in
src/main/kotlin
any
.java
file will not be compiled by
:compileJava
task
s
Good to know! Another reason to deter anyone from writing a Java file (I severely doubt we will 😅 I hope I don’t get proven wrong)