-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove AutoPlugin triggers from plugins. #389
Conversation
With the current triggers, all plugins are enabled by enabling any other (since all end up triggering on UniversalPlugin). After removing the triggers, we can still include all plugins via JavaAppPackaging.
Not yet complete; universal/publish test fails because |
I see this could be a problem if you rely on enabling only a single plugin. I will look into more detail this week |
This is one potential method. However, there is no "enable deployment settings for all plugins" option any more. The downside of creating a plugin that depends on all xxxDeployPlugin plugins, is that one can then (unexpectedly) enable xxxPlugin transitively. Making these extra plugins auto-trigger means it is harder to disable them all (have to specify each one manually), but it is an option... |
Deployment/publishing settings should be provided by a plugin which depends on the appropriate parent plugin. Replaces deploymentSettings which requires all plugins to be configured.
I do like the notion that having the plugins auto-trigger off of dependencies. How dangerous is including them with a trigger in practice? Currently native packager includes almost all settings in one single sequence or another. The difference now is that you can manually enable/disable plugins (by hierarchy). I do like the new tests that only test specific plugins. That should be the case no matter what we do. Again, would love to hear more about what issues you're facing. |
It's not so much an issue, as what I would see as a "principle of least astonishment" failure: enablePlugins(SbtNativePackager)
> plugins
In file:/Users/gary/snp-test/
sbt.plugins.IvyPlugin: enabled in snp-test
sbt.plugins.JvmPlugin: enabled in snp-test
sbt.plugins.CorePlugin: enabled in snp-test
sbt.plugins.JUnitXmlReportPlugin: enabled in snp-test
com.typesafe.sbt.SbtNativePackager: enabled in snp-test
com.typesafe.sbt.packager.archetypes.AkkaAppPackaging
com.typesafe.sbt.packager.archetypes.JavaAppPackaging
com.typesafe.sbt.packager.archetypes.JavaServerAppPackaging
com.typesafe.sbt.packager.debian.DebianPlugin: enabled in snp-test
com.typesafe.sbt.packager.debian.JDebPackaging
com.typesafe.sbt.packager.docker.DockerPlugin: enabled in snp-test
com.typesafe.sbt.packager.linux.LinuxPlugin: enabled in snp-test
com.typesafe.sbt.packager.rpm.RpmPlugin: enabled in snp-test
com.typesafe.sbt.packager.universal.UniversalPlugin: enabled in snp-test
com.typesafe.sbt.packager.windows.WindowsPlugin: enabled in snp-test All well and good. But I would expect that enablePlugins(DockerPlugin)
> plugins
In file:/Users/gary/snp-test/
sbt.plugins.IvyPlugin: enabled in snp-test
sbt.plugins.JvmPlugin: enabled in snp-test
sbt.plugins.CorePlugin: enabled in snp-test
sbt.plugins.JUnitXmlReportPlugin: enabled in snp-test
com.typesafe.sbt.SbtNativePackager: enabled in snp-test
com.typesafe.sbt.packager.archetypes.AkkaAppPackaging
com.typesafe.sbt.packager.archetypes.JavaAppPackaging
com.typesafe.sbt.packager.archetypes.JavaServerAppPackaging
com.typesafe.sbt.packager.debian.DebianPlugin: enabled in snp-test
com.typesafe.sbt.packager.debian.JDebPackaging
com.typesafe.sbt.packager.docker.DockerPlugin: enabled in snp-test
com.typesafe.sbt.packager.linux.LinuxPlugin: enabled in snp-test
com.typesafe.sbt.packager.rpm.RpmPlugin: enabled in snp-test
com.typesafe.sbt.packager.universal.UniversalPlugin: enabled in snp-test
com.typesafe.sbt.packager.windows.WindowsPlugin: enabled in snp-test The result is exactly the same, and I think this may surprise people. In addition, the SbtNativePackager plugin seems to be treated as the "entrypoint" to the hierarchy, but it's not clear that the archetypes are an alternative entrypoint, not a mixin, e.g.: enablePlugins(SbtNativePackager)
enablePlugins(JavaAppPackaging)
disablePlugins(WindowsPlugin)
[error] sbt.AutoPluginException: Error determining plugins for project 'snp-test' in /Users/gary/snp-test:
[error] Failed to sort List(sbt.plugins.CorePlugin, com.typesafe.sbt.packager.archetypes.JavaAppPackaging, sbt.plugins.IvyPlugin, com.typesafe.sbt.packager.rpm.RpmPlugin, com.typesafe.sbt.packager.debian.DebianPlugin, com.typesafe.sbt.packager.docker.DockerPlugin, sbt.plugins.JvmPlugin, com.typesafe.sbt.packager.universal.UniversalPlugin, com.typesafe.sbt.packager.linux.LinuxPlugin, sbt.plugins.JUnitXmlReportPlugin, com.typesafe.sbt.SbtNativePackager) topologically This might be fixable with renaming and updated documentation, but I'm not sure whether this is sufficient, or if the hierarchy should be updated. But perhaps I should be filing issues instead of pull requests... (but the attached code was interesting so far as it showed some assumptions in the deployment settings when it was implemented). |
@@ -109,3 +108,12 @@ object RpmPlugin extends AutoPlugin { | |||
)) | |||
} | |||
|
|||
object RpmDeployPlugin extends AutoPlugin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably just be part of the RPM plugin (similarly for Debian/Universal/Windows etc.). The reason we didn't do this initially was because these settings were more experimental. Having used them in several projects, we can just embed them in the raw plugins now, in my opinion.
OK, so I wrote a huge wall of text that got deleted. However, let me throw my thoughts down again, more coherently. User stories we should support:
SO, my hierrachy proposal is the following (assuming deployment settings get unified with underlying plugins):
I think this may offer the best of all worlds in the sense of:
WDYT? |
And I assume (Linux, Windows, Docker) -> UniversalPlugin (no trigger)? That seems reasonable to me. Without triggers, (Universal, Linux, Debian, JDeb, Rpm, Windows, Docker) are a directed tree with plugins enabled from the leaves, with Universal at the base of everything. And (NativePackager, _XYZ_Archetype) depend on the leaves of the first tree. Also, this means that NativePackager should probably have its actual (non-dependency) functionality moved to UniversalPlugin. As the AutoPlugin trigger feature currently stands, excessive use of triggers causes a large community of plugins which get enabled as a body, no matter which individual in the community was actually explicitly enabled. I wonder if there's room for another feature, |
@jsuereth The one downside of your proposal is that one cannot depend on the Java App archetype without also enabling all the plugins. It is quite minor, for a problem which most people probably won't care about. But an example of a plugin which might do this: https://github.com/gilt/sbt-newrelic/pull/10 I see though that one cannot infinitely split functionality into different plugins, without fragmenting users' knowledge of how to use the project. |
I'm with @jsuereth suggestion. The So the only thing left to do for this PR would be to move the |
Okay. I'll merge this one as I would like to release another milestone. |
Remove AutoPlugin triggers from plugins.
With the current triggers, all plugins are enabled by enabling any other
(since all end up triggering on UniversalPlugin). After removing the
triggers, we can still include all plugins via JavaAppPackaging.