Tapchicoma
04/29/2022, 12:17 PMproject.pluginManager.apply(JavaPlugin::class.java)
project.plugins.apply(JavaPlugin::class.java)
Tapchicoma
04/29/2022, 12:17 PMjava-library
plugin uses first one 🤔Gabriel Feo
04/29/2022, 12:20 PMWhile not deprecated, it is preferred to use the methods of this interface or thehttps://docs.gradle.org/current/javadoc/org/gradle/api/plugins/PluginAware.html#apply-groovy.lang.Closure-than use the plugin container.plugin manager
Tapchicoma
04/29/2022, 12:33 PMPluginManager
calls doApply
via apply
and PluginContainer
calls PluginManager.addImperativePlugin
which also calls inside doApply
So seems there is no difference 🤷♂️Javi
04/29/2022, 12:56 PMChris Lee
04/29/2022, 2:03 PMpluginManager.apply(...)
plugins.withType<...>
…as there is no withType equivalent on pluginManager.Chris Lee
04/29/2022, 3:25 PMorg.gradle.kotlin.dsl.apply
allows removal of ‘.java’, e.g. project.pluginManager.apply(JavaPlugin::class)
Chris Lee
04/29/2022, 3:27 PMoverride fun apply(project: Project): Unit = project.run { }
Chris Lee
04/29/2022, 3:40 PMapply<BasePlugin>()
efemoney
05/12/2022, 7:26 AMplugins.withType(<type::class>)
vs pluginManager.withPlugin("<id>")
?
Well behaved plugins should set up some extensions or tasks or some other model and be done. You shouldnt need the actual plugin instance for anything (most of the time). Imo, its becoming more consistent by recommending to use the plugin manager together with ids 🤷