mirror of https://github.com/sbt/sbt.git
[2.x] fix dependency parsing for bsp
This commit is contained in:
parent
2d2d5136ef
commit
50a6eb801f
|
|
@ -22,9 +22,9 @@ private[sbt] object InternalDependencies {
|
|||
((ref -> allConfigs) +:
|
||||
projectDependencies.flatMap { case ClasspathDep.ResolvedClasspathDependency(p, rawConfigs) =>
|
||||
val configs = rawConfigs.getOrElse("*->compile").split(";").flatMap { config =>
|
||||
config.split("->") match {
|
||||
case Array(n, c) if applicableConfigs.contains(n) => Some(c)
|
||||
case Array(n) if applicableConfigs.contains(n) =>
|
||||
config.split("->", 2).map(_.trim) match {
|
||||
case Array(n, c) if c.nonEmpty && applicableConfigs.contains(n) => Some(c)
|
||||
case Array(n) if applicableConfigs.contains(n) =>
|
||||
// "test" is equivalent to "compile->test"
|
||||
Some("compile")
|
||||
case _ => None
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ lazy val b = project.in(file("b")).dependsOn(c)
|
|||
|
||||
lazy val c = project.in(file("c"))
|
||||
|
||||
lazy val d = project.in(file("d")).dependsOn(b % "test -> test")
|
||||
|
||||
lazy val e = project.in(file("e")).dependsOn(b % "test ->")
|
||||
|
||||
def getConfigs(key: SettingKey[Seq[(ProjectRef, Set[ConfigKey])]]):
|
||||
Def.Initialize[Map[String, Set[String]]] =
|
||||
Def.setting(key.value.map { case (p, c) => p.project -> c.map(_.name) }.toMap)
|
||||
|
|
@ -16,4 +20,16 @@ TaskKey[Unit]("check") := {
|
|||
"c" -> Set("compile")
|
||||
)
|
||||
assert(testDeps == expected)
|
||||
|
||||
val spacedTestDeps = getConfigs(d / Test / bspInternalDependencyConfigurations).value
|
||||
val spacedExpected = Map(
|
||||
"d" -> Set("compile", "test"),
|
||||
"b" -> Set("compile", "test"),
|
||||
"c" -> Set("compile")
|
||||
)
|
||||
assert(spacedTestDeps == spacedExpected, spacedTestDeps)
|
||||
|
||||
val emptyTargetDeps = getConfigs(e / Test / bspInternalDependencyConfigurations).value
|
||||
val emptyTargetExpected = Map("e" -> Set("compile", "test"))
|
||||
assert(emptyTargetDeps == emptyTargetExpected, emptyTargetDeps)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue