fix BSP on custom configs

This commit is contained in:
Adrien Piquerez 2020-10-05 10:17:32 +02:00
parent 7dff879b6a
commit af4deaaab1
1 changed files with 18 additions and 6 deletions

View File

@ -577,11 +577,22 @@ object BuildServerProtocol {
} }
private def internalDependencyConfigurationsSetting = Def.settingDyn { private def internalDependencyConfigurationsSetting = Def.settingDyn {
val directDependencies = Keys.internalDependencyConfigurations.value.map { val allScopes = bspWorkspace.value.map { case (_, scope) => scope }.toSet
case (project, rawConfigs) => val directDependencies = Keys.internalDependencyConfigurations.value
val configs = rawConfigs.flatMap(_.split(",")).map(name => ConfigKey(name.trim)) .map {
(project, configs) case (project, rawConfigs) =>
} val configs = rawConfigs
.flatMap(_.split(","))
.map(name => ConfigKey(name.trim))
.filter { config =>
val scope = Scope.Global.in(project, config)
allScopes.contains(scope)
}
(project, configs)
}
.filter {
case (_, configs) => configs.nonEmpty
}
val ref = Keys.thisProjectRef.value val ref = Keys.thisProjectRef.value
val thisConfig = Keys.configuration.value val thisConfig = Keys.configuration.value
val transitiveDependencies = for { val transitiveDependencies = for {
@ -589,7 +600,8 @@ object BuildServerProtocol {
config <- configs if dep != ref || config.name != thisConfig.name config <- configs if dep != ref || config.name != thisConfig.name
} yield Keys.bspInternalDependencyConfigurations.in(dep, config) } yield Keys.bspInternalDependencyConfigurations.in(dep, config)
Def.setting { Def.setting {
val allDependencies = directDependencies ++ transitiveDependencies.join.value.flatten val allDependencies = directDependencies ++
transitiveDependencies.join.value.flatten
allDependencies allDependencies
.groupBy(_._1) .groupBy(_._1)
.mapValues { deps => .mapValues { deps =>