Open Vampire opened 6 years ago
I just use it to get the publish life-cycle tasks. But thinking about it, it kinda makes sense to check if a publish
task already exists.
As far as I remember there is a maybeCreate
for tasks or so that creates if not available yet. But I'm not sure whether this works properly if one is applied first or the other.
Yeah the problems can arise when the publish plugin gets added after this plugin then. I would need to check how the gradle team creates the tasks. As far as I know they use a new temp
task mechanic since gradle 4 for the lifecycle tasks.
If you don't want the publish lifecycle task, but only attach your task to it if it is applied (before or after) you could do it with reactive coding like project.pluginMangager.withPlugin('publishing') { ... }
.
If you want to always have their lifecyle task to attach to, it is maybe ok to apply the plugin.
As I said, I just skimmed over and wondered. :-)
One could also imagine that a Gradle plugin can add a repository type for the publishing plugin, so that the full facilities of the publishing plugin are used and not just the lifecycle tasks. :-)
Yeah I did this in my other plugin https://github.com/wooga/atlas-paket. I tried with this plugin to have a as much gradle-lishous experience as possible without moving the whole world to get it to work :) The gradle guys don't make it easy sometimes.
Complain to them, so they can make it easier. :-)
May I ask why you apply the publishing plugin in your plugin? Its facilities are nowhere used, are they?