After I implemented Gradle in our big project, bui...
# random
e
After I implemented Gradle in our big project, building time went from 1s to 13-26s. Asking on the Gradle forum, everything boils down to
compileJava
which on Netbeans/Idea turns out to be blazing fast. There have been some suggestions, like divide the project into modules and activate build cache, but all of this appears to be light patches that only smoothes the problem (because every modification seems likely to trigger a full recompile anyway at module-level). My big question is why Gradle (and company) lags so behind in terms of performances..
t
Just to clarify - are you comparing doing compilation in your IDE vs using Gradle?
e
yes
g
1s for incremental build time?
e
yes
g
Have you checked build scans of your build?
e
apparently IDEs will recompile just the very modified class (or very few), Gradle trigger full-recompilations or a couple of thousands
t
You’re not really comparing apples to apples there though. Try doing a full rebuild in your IDE
e
I'm comparing developing environment conditions
I really dont care if it's incremental or not within the IDE, the point the matters is the time to run the app after some sources modifications
t
Except that Gradle isn’t a development environment, it’s a build too
e
semantics, I think you know what I meant
t
I do know what you mean, and I’m trying to explain the differences. They are not doing the same job so you can’t reasonably compare them
e
I know, Gradle is much more, but for my simple case, building the application and running it, they are doing the same
I'm seriously evaluating restricting Gradle usage just to: - flatMap all the dependencies under a single folder - run tests - building RCs and Releases and for all the dev in between plain project has anyone ever consider something similar?
t
I’m not sure what your workflow is now, but the typical usage I see is that actual development is handled inside your IDE with its internal compiler, everything else managed by Gradle
g
Incremental compilation for Java works in Gradle and if it doesn’t work, there is some bug
Maybe your build is just not reproducible for some reason, any way I would check build scan
e
I cant believe I'm the first one to experience problems with incremental compilation
anyway, the
.\gradlew compileJava --info
is clear, this is the output of a single
String
modification inside a class constructor:
Task ':compileJava' is not up-to-date because:
Input property 'source' file D:\DEVELOPMENT\EMM-Check\src\main\java\ec\gui\dialogs\vrserver\EC_VrClientListener.java has changed.
Created classpath snapshot for incremental compilation in 0.008 secs. 2061 duplicate classes found in classpath (see all with --debug).
Class dependency analysis for incremental compilation took 0.076 secs.
Full recompilation is required because 'EC_VrClientListener.java' was changed. Analysis took 0.087 secs.
g
okay, so it’s full recompilation
of course you not the first, but there are many reasons for that
e
it looks so
g
What exactly did you change in this file?
also, which version of Gradle it is?
last one 5.5.1
g
why a plain project without build tool is much faster?
I think it’s a wrong question. Because apparently you comparing full recompilation with incremental one. The right question is “why incremental compilation doesn;’t work”
e
I cant argue that
g
what about this thing with public constant?
e
I tried a super bare class, nothing changed
g
even with private method change? (as the most encapsulated change)
e
just tried, with private methods seems working
Task ':compileJava' is not up-to-date because:
Input property 'source' file D:\DEVELOPMENT\EMM-Check\src\main\java\ec\utils\code\EC_CodeCount.java has changed. Created classpath snapshot for incremental compilation in 0.007 secs. 2061 duplicate classes found in classpath (see all with --debug). Class dependency analysis for incremental compilation took 0.079 secs. Compiling with JDK Java compiler API. Incremental compilation of 1 classes completed in 0.225 secs. :compileJava (Thread[Execution worker for ':',5,main]) completed. Took 0.468 secs. BUILD SUCCESSFUL in 1s 1 actionable task: 1 executed
so, actually the right question would be, why incremental compilation is much more effective on plain projects
g
no, question is still the same
but more specific “why incremental compilation doesn’t work with specific change”
👍 1
c
It’s very easy to defeat incremental compilation by accident and not easy to track. Whenever your build generates some
Config.java
,
Version.java
or captures the current git branch or sha, chances are high that you’re being hit with full rebuilds.
g
True, but if it works with private method change than it probably not the case, but anyway worth to investigate
e
@gildor exaclty my though.. now my big problem is how to investigate..
compileJava
seems like a black box
g
for sure. I would reproduce it and report an issue