What would be the best way to start finding the ca...
# compiler
m
What would be the best way to start finding the cause for
Non-incremental compilation will be performed: inputs' changes are unknown (first or clean build)
message with Kotlin compiler (with gradle builds)? It seems like when starting to build, kotlin will occasionaly decide to do full build instead of incremental. Enabling build report produces above message.
g
Are you sure that it’s not incremental build?
m
yes, single file changes usually take about a second to compile at most (on both kapt stubs and normal kotlin compile tasks)
but from time to time they take 10+ seconds to build
it hampers the flow significantly
w
@Matej Drobnič you can enable build scans for your builds. If you poke around the documentation you'll find how to run scans for each build, and then upload latest build if you encounter the issue
And build scans provide lots of information about tasks, whether they were up-to-date or cached, and why if not. Should help anyway
m
I've tried doing build scans, but I'm not sure where to start on diagnosting this issue. Build scans only say that kotlin task was not up to date / cached (which makes sense since files were changed).
g
If you click on task on Timeline page it shows the reason:
The task was not up-to-date because of the following reasons
👆 1
m
I've done some checking and it appears that most of the cases appear after compile error
e.g. task was not up to date because it errored on previous run
So kotlin makes clean build after every error?
g
no, I don’t think so
e.g. task was not up to date because it errored on previous run
It just invalidate one particular task (and all related)
But of course it depends on tasks graph, it may cause something similar to full rebuild
Kotlin compiler has own incremental mode, so gradle will run this task (because it’s invalid), but under the hood kotlin tries to do incremental compilation, but maybe something may be improved, would be nice to provide reproducible example when you expect incremental compilation but getting recompilation of all kotlin files in the project and report it