I have a vague memory from reading gradle docs tha...
# community-support
m
I have a vague memory from reading gradle docs that convention plugins (defined as
.kt
files in a
buildSrc/
-type location, exposed to consuming builds) are preferred over binary plugins (defined as
.gradle
files in that same consuming build) for performance reasons, but I'm not able to find those references in those docs now - does my memory serve me correctly here?
Copy code
If multiple—but not all—subprojects use the script, refactor it into a custom plugin inside buildSrc and apply it only to the relevant subprojects. This reduces configuration time and avoids code duplication.
t
https://docs.gradle.org/current/userguide/plugins.html#sec:build_script_plugins > Script plugins are useful for quick experiments but not recommended for production builds.
m
Thank you! Sorry it's difficult to navigate through the (vey thorough!) doc site at times
v
A
.gradle
file is never a binary plugin, it is either a precompiled Groovy DSL script plugin or a Groovy DSL build script or a legacy script plugin. A convention plugin can be a binary plugin in any JVM language, or a precompiled Kotlin DSL script plugin, or a precompiled Groovy DSL script plugin, or any other form you like, even a legacy script plugin (which you should never use, the things you use with "apply from"), "convention plugin" just means that it is a plugin that employs your conventions where you apply it. A
.kt
file with a plugin in it is a binary plugin written in Kotlin. So as your terminology is heavily mixed up, it is hard to answer your question as - at least to me - it is unclear what exactly you tried to ask.
👆 1
m
Apologies for the terminology mixup. Clarification: by "binary plugin", I meant
precompiled Groovy DSL script plugin
It seems from the docs and your guidance, though, my memory served me well:
Copy code
even a legacy script plugin (which you should never use, the things you use with "apply from")
Thanks for the information!
v
precompiled Groovy DSL script plugin != legacy script plugin
A precompiled Groovy DSL script plugin is like a precompiled Kotlin DSL script plugin. You have it in
buildSrc
or some included build or even standalone and published. The script is merely syntax sugar and in the end you get a binary plugin out of them.
The legacy script plugins, no matter whether Groovy DSL or Kotlin DSL, that you apply with "apply from" have many quirks and should be avoided whenever possible, that is not so much a performance topic.
👍 1
1
m
Thanks for the additional context, much appreciated
👌 1