forbidden-apis: apply plugin: 'de.thetaphi.forbiddenapis' is very slow.
allprojects {
apply plugin: 'de.thetaphi.forbiddenapis'
}
adds 25s to the configuration time of a multi-module build with about 500 modules.
The reason for this is that ForbiddenApisPlugin.java is compiling the plugin-init.groovy script for every single apply
call.
You should instead re-implement the plugin-init.groovy
functionality in Java or switch the ForbiddenApisPlugin
to Groovy.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (13 by maintainers)
Commits related to this issue
- Compile and run the script only once. This should fix issue #116 — committed to policeman-tools/forbidden-apis by uschindler 7 years ago
- Improvement for #116: Compile script to a class that is reused for each invocation instead of an instance (according to Groovy guidelines) — committed to policeman-tools/forbidden-apis by uschindler 7 years ago
- Simplification: Don't use a binding at all (#116) — committed to policeman-tools/forbidden-apis by uschindler 7 years ago
- Issues/116: Compile the Groovy script only once when loading the plugin class (#117) Compile the Groovy script only once when loading the Gradle plugin class. This closes #116 — committed to centic9/forbidden-apis by uschindler 7 years ago
- Improvement for #116: Compile script to a class that is reused for each invocation instead of an instance (according to Groovy guidelines) — committed to centic9/forbidden-apis by uschindler 7 years ago
- Simplification: Don't use a binding at all (#116) — committed to centic9/forbidden-apis by uschindler 7 years ago
Thanks for the explanation. We are planning to make that easier in the future, as we’ve seen some other projects as well who are stuck on Maven, but still want to provide a Gradle plugin.
For several reasons I will not add precompiled Groovy code at the moment (not compatible to the setup of compiling the plugin for 3 build systems + CLI in one single artifact).
The only idea would be to only parse the groovy script once and reuse the compiled class. That should be easy to implement.