Closed mdedetrich closed 7 months ago
There's sbt plugin best practice called Provide default values in globalSettings
, which states
If the default value of your settings or task does not transitively depend on a project-level settings (such as
baseDirectory
,compile
, etc), define it inglobalSettings
.
What I should've added there is that such settings or tasks should not be specified in projectSettings
. If you're eventually going to define the keys at project-level, then I don't know if makes much difference in defining a globally scoped one. For example,
requireCapability := Osgi.requireCapabilityTask(),
Given that Osgi.requireCapabilityTask()
doesn't depend on any other settings, it would be most flexible if that definition remained at the global level, and unspecified anywhere else. That way the build user can override it either at ThisBuild
level or at subproject level.
What I should've added there is that such settings or tasks should not be specified in projectSettings. If you're eventually going to define the keys at project-level, then I don't know if makes much difference in defining a globally scoped one. For example,
Yup these nuances/peculiarities I think I understand by now, I just made a mistake and didn't realize that Osgi.requireCapabilityTask()
didn't depend on any other setting/task.
@eed3si9n I have just updated the PR with this fix (I also made Osgi.requireCapabilityTask
a lazy val since it was a zero arg def before), let me know if I missed anything else.
Keys that are created/introduced by a plugin (i.e.
OsgiKeys
) should have their default values set inglobalSettings
with a zero like value otherwise it can cause issues with other sbt plugins/IDE's/editors.