mirror of https://github.com/sbt/sbt.git
bspWorkspace is a setting
This commit is contained in:
parent
f3bce7e976
commit
2c8a322bd8
|
|
@ -1941,7 +1941,7 @@ object Defaults extends BuildCommon {
|
|||
},
|
||||
compilerReporter := {
|
||||
new BuildServerReporter(
|
||||
buildTargetIdentifier.value,
|
||||
bspTargetIdentifier.value,
|
||||
maxErrors.value,
|
||||
streams.value.log,
|
||||
foldMappers(sourcePositionMappers.value),
|
||||
|
|
|
|||
|
|
@ -339,8 +339,9 @@ object Keys {
|
|||
val closeClassLoaders = settingKey[Boolean]("Close classloaders in run and test when the task completes.").withRank(DSetting)
|
||||
val allowZombieClassLoaders = settingKey[Boolean]("Allow a classloader that has previously been closed by `run` or `test` to continue loading classes.")
|
||||
|
||||
val buildTargetIdentifier = settingKey[BuildTargetIdentifier]("Id for BSP build target.").withRank(DSetting)
|
||||
val bspWorkspace = taskKey[Map[BuildTargetIdentifier, Scope]]("Mapping of BSP build targets to sbt scopes").withRank(DTask)
|
||||
val bspTargetIdentifier = settingKey[BuildTargetIdentifier]("Id for BSP build target.").withRank(DSetting)
|
||||
val bspWorkspace = settingKey[Map[BuildTargetIdentifier, Scope]]("Mapping of BSP build targets to sbt scopes").withRank(DSetting)
|
||||
val bspInternalDependencyConfigurations = settingKey[Seq[(ProjectRef, Set[String])]]("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)
|
||||
val bspBuildTarget = taskKey[BuildTarget]("Description of the BSP build targets").withRank(DTask)
|
||||
val bspBuildTargetSources = inputKey[Unit]("").withRank(DTask)
|
||||
|
|
@ -351,7 +352,6 @@ object Keys {
|
|||
val bspBuildTargetCompileItem = taskKey[Int]("").withRank(DTask)
|
||||
val bspBuildTargetScalacOptions = inputKey[Unit]("").withRank(DTask)
|
||||
val bspBuildTargetScalacOptionsItem = taskKey[ScalacOptionsItem]("").withRank(DTask)
|
||||
val bspInternalDependencyConfigurations = settingKey[Seq[(ProjectRef, Set[String])]]("The project configurations that this configuration depends on, possibly transitivly").withRank(DTask)
|
||||
|
||||
val useCoursier = settingKey[Boolean]("Use Coursier for dependency resolution.").withRank(BSetting)
|
||||
val csrCacheDirectory = settingKey[File]("Coursier cache directory. Uses -Dsbt.coursier.home or Coursier's default.").withRank(CSetting)
|
||||
|
|
|
|||
|
|
@ -34,13 +34,14 @@ object BuildServerProtocol {
|
|||
)
|
||||
|
||||
lazy val globalSettings: Seq[Def.Setting[_]] = Seq(
|
||||
bspWorkspace := Def.taskDyn {
|
||||
val structure = Keys.buildStructure.value
|
||||
val scopes: Seq[Scope] = structure.allProjectRefs.flatMap { ref =>
|
||||
bspWorkspace := Def.settingDyn {
|
||||
val loadedBuild = Keys.loadedBuild.value
|
||||
val scopes: Seq[Scope] = loadedBuild.allProjectRefs.flatMap {
|
||||
case (ref, _) =>
|
||||
bspTargetConfigs.toSeq.map(name => Scope.Global.in(ref, ConfigKey(name)))
|
||||
}
|
||||
Def.task {
|
||||
val targetIds = scopes.map(_ / Keys.buildTargetIdentifier).join.value
|
||||
Def.setting {
|
||||
val targetIds = scopes.map(_ / Keys.bspTargetIdentifier).join.value
|
||||
targetIds.zip(scopes).toMap
|
||||
}
|
||||
}.value,
|
||||
|
|
@ -111,14 +112,14 @@ object BuildServerProtocol {
|
|||
|
||||
// This will be scoped to Compile, Test, etc
|
||||
lazy val configSettings: Seq[Def.Setting[_]] = Seq(
|
||||
buildTargetIdentifier := {
|
||||
bspTargetIdentifier := {
|
||||
val ref = thisProjectRef.value
|
||||
val c = configuration.value
|
||||
toId(ref, c)
|
||||
},
|
||||
bspBuildTarget := buildTargetTask.value,
|
||||
bspBuildTargetSourcesItem := {
|
||||
val id = buildTargetIdentifier.value
|
||||
val id = bspTargetIdentifier.value
|
||||
val dirs = unmanagedSourceDirectories.value
|
||||
val managed = managedSources.value
|
||||
val items = (dirs.toVector map { dir =>
|
||||
|
|
@ -190,7 +191,7 @@ object BuildServerProtocol {
|
|||
)
|
||||
|
||||
private def buildTargetTask: Def.Initialize[Task[BuildTarget]] = Def.taskDyn {
|
||||
val buildTargetIdentifier = Keys.buildTargetIdentifier.value
|
||||
val buildTargetIdentifier = Keys.bspTargetIdentifier.value
|
||||
val thisProject = Keys.thisProject.value
|
||||
val thisProjectRef = Keys.thisProjectRef.value
|
||||
val thisConfig = Keys.configuration.value
|
||||
|
|
@ -212,7 +213,7 @@ object BuildServerProtocol {
|
|||
(dep, configs) <- Keys.bspInternalDependencyConfigurations.value
|
||||
config <- configs
|
||||
if (dep != thisProjectRef || config != thisConfig.name) && bspTargetConfigs.contains(config)
|
||||
} yield Keys.buildTargetIdentifier.in(dep, ConfigKey(config))
|
||||
} yield Keys.bspTargetIdentifier.in(dep, ConfigKey(config))
|
||||
val capabilities = BuildTargetCapabilities(canCompile = true, canTest = false, canRun = false)
|
||||
val tags = BuildTargetTag.fromConfig(configuration.name)
|
||||
Def.task {
|
||||
|
|
@ -231,7 +232,7 @@ object BuildServerProtocol {
|
|||
}
|
||||
|
||||
private def scalacOptionsTask: Def.Initialize[Task[ScalacOptionsItem]] = Def.taskDyn {
|
||||
val target = Keys.buildTargetIdentifier.value
|
||||
val target = Keys.bspTargetIdentifier.value
|
||||
val scalacOptions = Keys.scalacOptions.value
|
||||
val classDirectory = Keys.classDirectory.value
|
||||
val externalDependencyClasspath = Keys.externalDependencyClasspath.value
|
||||
|
|
@ -254,7 +255,7 @@ object BuildServerProtocol {
|
|||
}
|
||||
|
||||
private def dependencySourcesItemTask: Def.Initialize[Task[DependencySourcesItem]] = Def.task {
|
||||
val targetId = Keys.buildTargetIdentifier.value
|
||||
val targetId = Keys.bspTargetIdentifier.value
|
||||
val updateReport = Keys.updateClassifiers.value
|
||||
val sources = for {
|
||||
configuration <- updateReport.configurations.view
|
||||
|
|
|
|||
Loading…
Reference in New Issue