novoda/gradle-static-analysis-plugin

Use @ParallelizableTask for all static analysis

zegnus opened this issue · 3 comments

I would like to explore if we can run the static analysis in parallel with @ParallelizableTask, there is this post in Medium that describes what needs to be done https://medium.com/@dpreussler/speed-up-your-android-gradle-build-baa329cdb836 with the objective of speeding up the build process

The static analysis plugin does not run the analysis itself, it merely coordinates other plugins. If PMD/Checkstyle/Findbugs/KtLint/Detekt/Lint had that annotation, then they would already run in parallel. As of Gradle 4.9, they don't. I don't think it's generally safe to perform the hacks Danny suggests in his Medium post on tasks we don't control directly, especially in a plugin. Doing so in your own project might be worth the risk, but we don't want to risk breaking people's builds by forcing on them a hack to get an incubating feature.

The only "real" task the plugin creates, and controls, is evaluateViolations which is currently not marked as such. We could add the annotation on that one after we've checked it's not breaking any project that happens to use it (at least internally).

My two cents? As for the static analysis tasks themselves you should likely apply the hacks in the project build files, rather that in this plugin. Once the parallelisation becomes stable, assuming Gradle won't annotate their tasks themselves, then we could consider an option to have the hack for people that want it via the plugin (or, another plugin).

@ParallelizableTask have been removed on Gradle 4.0
https://discuss.gradle.org/t/parallelizabletask-is-removed-in-gradle-4-0/22970

It's been replaced by the Worker API

Anyway I agree this plugin shouldn't do this kind of hacks. In any case if it's possible to do the hack it would be times better to do the PR to the original plugin and fix it properly.

closing