mirror of https://github.com/sbt/sbt.git
Rename `addPlugins` to `enablePlugins` to better represent what it does.
This is to disambiguate between `addSbtPlugin` and `enablePlugins` for autoplugins.
This commit is contained in:
parent
1c3231f017
commit
51ee5048f0
|
|
@ -41,11 +41,11 @@ Steps for users:
|
||||||
|
|
||||||
For example, given plugins Web and Javascript (perhaps provided by plugins added with addSbtPlugin),
|
For example, given plugins Web and Javascript (perhaps provided by plugins added with addSbtPlugin),
|
||||||
|
|
||||||
<Project>.addPlugins( Web && Javascript )
|
<Project>.enablePlugins( Web && Javascript )
|
||||||
|
|
||||||
will activate `MyPlugin` defined above and have its settings automatically added. If the user instead defines
|
will activate `MyPlugin` defined above and have its settings automatically added. If the user instead defines
|
||||||
|
|
||||||
<Project>.addPlugins( Web && Javascript ).disablePlugins(MyPlugin)
|
<Project>.enablePlugins( Web && Javascript ).disablePlugins(MyPlugin)
|
||||||
|
|
||||||
then the `MyPlugin` settings (and anything that activates only when `MyPlugin` is activated) will not be added.
|
then the `MyPlugin` settings (and anything that activates only when `MyPlugin` is activated) will not be added.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,8 +145,8 @@ sealed trait Project extends ProjectDefinition[ProjectReference]
|
||||||
def setSbtFiles(files: File*): Project = copy(auto = AddSettings.append( AddSettings.clearSbtFiles(auto), AddSettings.sbtFiles(files: _*)) )
|
def setSbtFiles(files: File*): Project = copy(auto = AddSettings.append( AddSettings.clearSbtFiles(auto), AddSettings.sbtFiles(files: _*)) )
|
||||||
|
|
||||||
/** Sets the [[AutoPlugin]]s of this project.
|
/** Sets the [[AutoPlugin]]s of this project.
|
||||||
A [[AutoPlugin]] is a common label that is used by plugins to determine what settings, if any, to add to a project. */
|
A [[AutoPlugin]] is a common label that is used by plugins to determine what settings, if any, to enable on a project. */
|
||||||
def addPlugins(ns: Plugins*): Project = setPlugins(ns.foldLeft(plugins)(Plugins.and))
|
def enablePlugins(ns: Plugins*): Project = setPlugins(ns.foldLeft(plugins)(Plugins.and))
|
||||||
|
|
||||||
/** Disable the given plugins on this project. */
|
/** Disable the given plugins on this project. */
|
||||||
def disablePlugins(ps: AutoPlugin*): Project =
|
def disablePlugins(ps: AutoPlugin*): Project =
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
// disablePlugins(Q) will prevent R from being auto-added
|
// disablePlugins(Q) will prevent R from being auto-added
|
||||||
lazy val projA = project.addPlugins(A, B).disablePlugins(Q)
|
lazy val projA = project.enablePlugins(A, B).disablePlugins(Q)
|
||||||
|
|
||||||
// without B, Q is not added
|
// without B, Q is not added
|
||||||
lazy val projB = project.addPlugins(A)
|
lazy val projB = project.enablePlugins(A)
|
||||||
|
|
||||||
// with both A and B, Q is selected, which in turn selects R, but not S
|
// with both A and B, Q is selected, which in turn selects R, but not S
|
||||||
lazy val projC = project.addPlugins(A, B)
|
lazy val projC = project.enablePlugins(A, B)
|
||||||
|
|
||||||
// with no natures defined, nothing is auto-added
|
// with no natures defined, nothing is auto-added
|
||||||
lazy val projD = project
|
lazy val projD = project
|
||||||
|
|
||||||
// with S selected, Q is loaded automatically, which in turn selects R
|
// with S selected, Q is loaded automatically, which in turn selects R
|
||||||
lazy val projE = project.addPlugins(S)
|
lazy val projE = project.enablePlugins(S)
|
||||||
|
|
||||||
check := {
|
check := {
|
||||||
val adel = (del in projA).?.value // should be None
|
val adel = (del in projA).?.value // should be None
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,5 @@ object A extends AutoPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
object B extends Build {
|
object B extends Build {
|
||||||
lazy val extra = project.addPlugins(bN)
|
lazy val extra = project.enablePlugins(bN)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue