Given a 100% Kotlin Android project, does moving all code from
src/main/java
to
src/main/kotlin
has any positive impact on build speed ?
I'd expect to avoid at least a java compiler pass.
d
Dominaezzz
09/01/2019, 6:14 PM
I think you can still have java source code in
src/main/kotlin
, so it won't make a difference.
👍 1
w
wasyl
09/01/2019, 7:01 PM
I don’t think it makes a difference where you keep the code. If you want to avoid java compiler pass, you actually need to only have
.kt
classes in the entire Gradle module.
wasyl
09/01/2019, 7:02 PM
Consider that classes from
src/main/java
see classes from
src/main/kotlin
and vice versa, so Kotlin folks can’t really make any optimizations based on where the files are
wasyl
09/01/2019, 7:04 PM
But with separate modules, the Gradle plugin can see that only
kt
files are present, so it doesn’t need to engage javac. But it’s also quite difficult, for example if you use annotation processor that generates java code, you’ll end up with mixed
.kt
and
.java
files anyway
wasyl
09/01/2019, 7:04 PM
Also I’m not an expert here, so I may be wrong — it’s just something I recall from a talk from some conference
t
tseisel
09/01/2019, 7:10 PM
Thanks @Dominaezzz and @wasyl.
Since I'm using a lot of annotation processors that generate Java code, I don't think that would have any impact then.
I guess I'd better split my project into multiple gradle modules.