Merge pull request #2913 from eed3si9n/fport/2653

[fport] dependsOn can now be used inside a .sbt file for a subproject
This commit is contained in:
eugene yokota 2017-01-14 08:19:42 -05:00 committed by GitHub
commit abaece6c96
7 changed files with 30 additions and 0 deletions

View File

@ -58,6 +58,10 @@ object DslEntry {
case class DslDisablePlugins(plugins: Seq[AutoPlugin]) extends ProjectManipulation {
override val toFunction: Project => Project = _.disablePlugins(plugins: _*)
}
/** Represents registering an internal dependency for the current project */
case class DslDependsOn(cs: Seq[Eval[ClasspathDep[ProjectReference]]]) extends ProjectManipulation {
override val toFunction: Project => Project = _.dependsOn(cs: _*)
}
/** Represents registering a set of configurations with the current project. */
case class DslConfigs(cs: Seq[Configuration]) extends ProjectManipulation {
override val toFunction: Project => Project = _.configs(cs: _*)

View File

@ -0,0 +1,9 @@
[@anatolydwnld]: https://github.com/anatolydwnld
### Fixes with compatibility implications
### Improvements
- Add the ability to call dependsOn for the current project inside a build sbt file. By [@anatolydwnld][@anatolydwnld]
### Bug fixes

View File

@ -52,6 +52,7 @@ 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)
def dependsOn(deps: Eval[ClasspathDep[ProjectReference]]*): DslEntry = DslEntry.DslDependsOn(deps)
// avoid conflict with `sbt.Keys.aggregate`
def aggregateProjects(refs: Eval[ProjectReference]*): DslEntry = DslEntry.DslAggregate(refs)
}

View File

@ -0,0 +1,11 @@
val projA = project in file("projA")
val projB = project in file("projB")
lazy val check = taskKey[Unit]("Verifies expected build behavior")
check := {
val projBDeps = (dependencyClasspath in (projB, Compile)).value.map(_.data)
val assertion = projBDeps.filter(_.getAbsolutePath.contains("projA")).nonEmpty
assert(assertion, "Unable to find projA classes in projB's dependency list")
}

View File

@ -0,0 +1 @@
name := "projA"

View File

@ -0,0 +1,3 @@
name := "projB"
dependsOn(LocalProject("projA"))

View File

@ -0,0 +1 @@
> check