mirror of https://github.com/sbt/sbt.git
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:
commit
abaece6c96
|
|
@ -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: _*)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
name := "projA"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
name := "projB"
|
||||
|
||||
dependsOn(LocalProject("projA"))
|
||||
|
|
@ -0,0 +1 @@
|
|||
> check
|
||||
Loading…
Reference in New Issue