Merge pull request #5782 from adpi2/feature/bsp-enabled

Add bspEnabled setting
This commit is contained in:
eugene yokota 2020-08-27 10:55:48 -04:00 committed by GitHub
commit 1b99049fbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -386,7 +386,8 @@ object Keys {
val exportPipelining = settingKey[Boolean]("Product early output so downstream subprojects can do pipelining.").withRank(BSetting)
val bspConfig = taskKey[Unit]("Create or update the BSP connection files").withRank(DSetting)
val bspTargetIdentifier = settingKey[BuildTargetIdentifier]("Id for BSP build target.").withRank(DSetting)
val bspEnabled = settingKey[Boolean]("Enable/Disable BSP for this build, project or configuration")
val bspTargetIdentifier = settingKey[BuildTargetIdentifier]("Build target identifier of a project and configuration.").withRank(DSetting)
val bspWorkspace = settingKey[Map[BuildTargetIdentifier, Scope]]("Mapping of BSP build targets to sbt scopes").withRank(DSetting)
val bspInternalDependencyConfigurations = settingKey[Seq[(ProjectRef, Set[ConfigKey])]]("The project configurations that this configuration depends on, possibly transitivly").withRank(DSetting)
val bspWorkspaceBuildTargets = taskKey[Seq[BuildTarget]]("List all the BSP build targets").withRank(DTask)

View File

@ -39,6 +39,7 @@ object BuildServerProtocol {
sbtVersion.value,
(ThisBuild / baseDirectory).value
),
bspEnabled := true,
bspWorkspace := bspWorkspaceSetting.value,
bspWorkspaceBuildTargets := Def.taskDyn {
val workspace = Keys.bspWorkspace.value
@ -246,7 +247,15 @@ object BuildServerProtocol {
.map(_ / Keys.bspTargetIdentifier)
.join
.value
targetIds.zip(scopes).toMap
val bspEnabled = scopes
.map(_ / Keys.bspEnabled)
.join
.value
val result = for {
(targetId, scope, bspEnabled) <- (targetIds, scopes, bspEnabled).zipped
if bspEnabled
} yield targetId -> scope
result.toMap
}
}