Migrate plugin to use Gradle's task configuration avoidance APIs
saguinav opened this issue · 3 comments
Gradle recommends to use the task configuration avoidance APIs whenever tasks are created in custom plugins.
In a nutshell, the API allows builds to avoid the cost of creating and configuring tasks during Gradle’s configuration phase when those tasks will never be executed. For example, when running a compile task, other unrelated tasks, like code quality, testing and publishing tasks, will not be executed, so any time spent creating and configuring those tasks is unnecessary. The configuration avoidance API avoids configuring tasks if they will not needed during the course of a build, which can have a significant impact on total configuration time.
See more info here.
Please let me know if you are interested in getting this issue resolved. I would be very happy to contribute.
Thanks in advance!
This part of the README.MD
file should also be updated by such a PR:
tasks.withType(Test) { --> use configureEach here
jacoco.includeNoLocationClasses = true
}
I would greatly appreciate contribution to this project.
Although, I had some doubts recently when resolving similar issue https://github.com/arturdm/jacoco-android-gradle-plugin/pull/63/files - whether the plugin should still support previous APIs or not. I went with the support approach.
There's a nice section about backward compatibility in the docs you've sent.
I was also thinking of adding tests that would check if it works with a matrix of different Android plugin and Gradle versions but didn't have time unfortunately.
But according to Android gradle plugin docs the minimum required version of Gradle for the latest Android plugin is already at 4.10.1+ so maybe the plugin should just state that it requires later versions and the plugin could drop obsolete API completely.
@arturdm I would suggest not to bother too much about older versions. In our libs we have released a major version update that breaks compatibility and uses only gradle 4.9+ and AGP 3.3+.