gradle-lint-plugin
gradle-lint-plugin copied to clipboard
Linting takes too long to integrate into the build as a regular task :(
Yesterday I was experimenting with integrating gradle-lint into our build as a side-project, and it seemed to be taking a while for the build to run for some reason. I eventually ended up just cleaning the project and starting a fresh build, and the results of ./gradlew clean -x test --profile were that the build took over 3 hours.
Breakdown of the 3 hours:
-
Task execution: 1 hour 44 min
- FindBugs: 1 hour 20 min, turns out to be a bug when you have a large number of dependencies, so we removed it from the project for now.
- Actual compilation / other checks: 20 min
-
Dependency resolution: 39 min
-
The top of the report does have some particularly bad times:
Dependencies Duration :module1:tests 4m0.73s :module2:detachedConfiguration13 1m29.50s :module3:detachedConfiguration6 55.059s :module4:detachedConfiguration4 54.028s :module5:detachedConfiguration35 50.031s ... :release:detachedConfiguration29 40.228s :release:detachedConfiguration21 37.340s :release:detachedConfiguration18 36.260s :release:detachedConfiguration15 36.249s :release:detachedConfiguration20 35.598s Then there is an additional flood of many, many of these "detachedConfigurations" things (I spotted some which were literally over 9000), each taking around 5ms, but the sheer number of them must just add up to the 39 minutes.
-
-
Additional lost time not reported by Gradle: ~40 min. This is a total mystery as they have not reported where the additional time went.
Debugging, I see things like this:
13:14:30.700 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'com.acme:common:7.6-SNAPSHOT' in resolver cache 'artifactory-maven-resolver44'
So this module is being looked up in the artifact server, and then is not found. This creates a lot of unnecessary HTTP traffic, which appears to repeat over and over. The module in question doesn't even need to go to the artifact server, though, because it's a sub-project which is inside the current project. So I guess that might be the bug - local projects should be accessed locally, not looked up via the artifact server.