sbt/sbt — pull request #1203 by eed3si9n (2014-03-21 21:34:50+00:00)
Title: Unifies AutoPlugin and RootPlugin (resend)

I'm resending #1195 since target branch needs to be changed to 0.13.

* Separates `def select` into `def trigger` and `def requires`.
* Setting `trigger = noTrigger` and `requires = empty` makes a plugin an opt-in "root".
* This now allows an opt-in plugin that lists required plugins that it can depend on.

For proof of concept (for non-breakage and the new feature) see the scripted test:

* [Q.scala](https://github.com/eed3si9n/sbt/blob/f8bedf4012a5c44cb159abe2c816702767219d0b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala)
* [build.sbt](https://github.com/eed3si9n/sbt/blob/f8bedf4012a5c44cb159abe2c816702767219d0b/sbt/src/sbt-test/project/auto-plugins/build.sbt)

This adds an opt-in plugin with requirements named `S`:

```scala
// This is an opt-in plugin with a requirement
// Unless explicitly loaded by the build user, this will not be activated.
object S extends AutoPlugin
{
def requires = Q
def trigger = noTrigger

override def projectSettings = Seq(
del in q += " S"
)
}
```

The build user just needs to bring in `S` to grab its dependency `Q`:

```scala
// with S selected, Q is loaded automatically, which in turn selects R
lazy val projE = project.addPlugins(S)

...

val optInValue = (del in projE in q).value
same(optInValue, " Q S R", "del in projE in q")
```

bringing in `Q` transitively "enables" `R`. As expected, all three plugins are topologically sorted (required first).