mirror of
https://github.com/sbt/sbt.git
synced 2026-10-06 10:03:56 +02:00
aggregate can now be used inside a .sbt file (#2683)
(cherry picked from commit b92e5773f7)
This commit is contained in:
@@ -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: _*)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
aggregateProjects(
|
||||
RootProject(file("projA"))
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
class A
|
||||
@@ -0,0 +1,3 @@
|
||||
name := "projA"
|
||||
|
||||
scalaVersion := "2.11.8"
|
||||
@@ -0,0 +1,2 @@
|
||||
> compile
|
||||
$ exists projA/target/scala-2.11/classes/A.class
|
||||
Reference in New Issue
Block a user