`aggregate` can now be used inside a .sbt file (#2683)

(cherry picked from commit b92e5773f7)
This commit is contained in:
kenji yoshida 2016-07-27 23:35:16 +09:00 committed by GitHub
parent 480a2f3040
commit 0c086a7761
7 changed files with 22 additions and 2 deletions

View File

@ -1,7 +1,7 @@
package sbt
package internal
import sbt.internal.util.RangePosition
import sbt.internal.util.{ Eval, RangePosition }
import sbt.librarymanagement.Configuration
@ -61,5 +61,8 @@ object DslEntry {
case class DslConfigs(cs: Seq[Configuration]) extends ProjectManipulation {
override val toFunction: Project => Project = _.configs(cs: _*)
}
/** this represents an `aggregate()` in the sbt DSL */
case class DslAggregate(refs: Seq[Eval[ProjectReference]]) extends ProjectManipulation {
override val toFunction: Project => Project = _.aggregate(refs: _*)
}
}

View File

@ -0,0 +1,5 @@
[@xuwei-k]: https://github.com/xuwei-k
### Improvements
- Add the ability to call aggregate for the current project inside a build sbt file. By [@xuwei-k][@xuwei-k]

View File

@ -1,6 +1,7 @@
package sbt
import sbt.internal.DslEntry
import sbt.internal.util.Eval
object syntax extends syntax
@ -51,6 +52,8 @@ abstract class syntax extends IOSyntax0 with sbt.std.TaskExtra with sbt.internal
def enablePlugins(ps: AutoPlugin*): DslEntry = DslEntry.DslEnablePlugins(ps)
def disablePlugins(ps: AutoPlugin*): DslEntry = DslEntry.DslDisablePlugins(ps)
def configs(cs: Configuration*): DslEntry = DslEntry.DslConfigs(cs)
// avoid conflict with `sbt.Keys.aggregate`
def aggregateProjects(refs: Eval[ProjectReference]*): DslEntry = DslEntry.DslAggregate(refs)
}
// Todo share this this io.syntax

View File

@ -0,0 +1,3 @@
aggregateProjects(
RootProject(file("projA"))
)

View File

@ -0,0 +1 @@
class A

View File

@ -0,0 +1,3 @@
name := "projA"
scalaVersion := "2.11.8"

View File

@ -0,0 +1,2 @@
> compile
$ exists projA/target/scala-2.11/classes/A.class