mirror of https://github.com/sbt/sbt.git
Record build sources in PluginData for BSP
This commit is contained in:
parent
111cc5f473
commit
0bd736be2a
|
|
@ -143,14 +143,16 @@ final case class PluginData(
|
|||
definitionClasspath: Seq[Attributed[File]],
|
||||
resolvers: Option[Vector[Resolver]],
|
||||
report: Option[UpdateReport],
|
||||
scalacOptions: Seq[String]
|
||||
scalacOptions: Seq[String],
|
||||
unmanagedSources: Seq[File],
|
||||
managedSources: Seq[File]
|
||||
) {
|
||||
val classpath: Seq[Attributed[File]] = definitionClasspath ++ dependencyClasspath
|
||||
}
|
||||
|
||||
object PluginData {
|
||||
private[sbt] def apply(dependencyClasspath: Def.Classpath): PluginData =
|
||||
PluginData(dependencyClasspath, Nil, None, None, Nil)
|
||||
PluginData(dependencyClasspath, Nil, None, None, Nil, Nil, Nil)
|
||||
}
|
||||
|
||||
object EvaluateTask {
|
||||
|
|
|
|||
|
|
@ -1164,12 +1164,16 @@ private[sbt] object Load {
|
|||
val prod = (Configurations.Runtime / exportedProducts).value
|
||||
val cp = (Configurations.Runtime / fullClasspath).value
|
||||
val opts = (Configurations.Compile / scalacOptions).value
|
||||
val managedSrcs = (Configurations.Compile / managedSources).value
|
||||
val unmanagedSrcs = (Configurations.Compile / unmanagedSources).value
|
||||
PluginData(
|
||||
removeEntries(cp, prod),
|
||||
prod,
|
||||
Some(fullResolvers.value.toVector),
|
||||
Some(update.value),
|
||||
opts
|
||||
opts,
|
||||
unmanagedSrcs,
|
||||
managedSrcs
|
||||
)
|
||||
},
|
||||
scalacOptions += "-Wconf:cat=unused-nowarn:s",
|
||||
|
|
@ -1225,7 +1229,7 @@ private[sbt] object Load {
|
|||
loadPluginDefinition(
|
||||
dir,
|
||||
config,
|
||||
PluginData(config.globalPluginClasspath, Nil, None, None, Nil)
|
||||
PluginData(config.globalPluginClasspath, Nil, None, None, Nil, Nil, Nil)
|
||||
)
|
||||
|
||||
def buildPlugins(dir: File, s: State, config: LoadBuildConfiguration): LoadedPlugins =
|
||||
|
|
@ -1417,6 +1421,8 @@ final case class LoadBuildConfiguration(
|
|||
data.internalClasspath,
|
||||
Some(data.resolvers),
|
||||
Some(data.updateReport),
|
||||
Nil,
|
||||
Nil,
|
||||
Nil
|
||||
)
|
||||
case None => PluginData(globalPluginClasspath)
|
||||
|
|
|
|||
|
|
@ -131,11 +131,16 @@ object BuildServerProtocol {
|
|||
case (id, loadedBuildUnit) =>
|
||||
val base = loadedBuildUnit.localBase
|
||||
val sbtFiles = configurationSources(base)
|
||||
val defDir = projectStandard(base)
|
||||
val pluginData = loadedBuildUnit.unit.plugins.pluginData
|
||||
val unmanagedSources = pluginData.unmanagedSources.map(
|
||||
f => SourceItem(f.toURI, SourceItemKind.File, generated = false)
|
||||
)
|
||||
val managedSources = pluginData.managedSources.map(
|
||||
f => SourceItem(f.toURI, SourceItemKind.File, generated = true)
|
||||
)
|
||||
val sbtFilesItems =
|
||||
sbtFiles.map(f => SourceItem(f.toURI, SourceItemKind.File, generated = false))
|
||||
val defDirItem = SourceItem(defDir.toURI, SourceItemKind.Directory, generated = false)
|
||||
SourcesItem(id, (defDirItem +: sbtFilesItems).toVector)
|
||||
SourcesItem(id, (unmanagedSources ++ managedSources ++ sbtFilesItems).toVector)
|
||||
}
|
||||
val result = SourcesResult((items ++ buildItems).toVector)
|
||||
s.respondEvent(result)
|
||||
|
|
@ -874,7 +879,7 @@ object BuildServerProtocol {
|
|||
}
|
||||
def warnIfBuildsNonEmpty(method: String, log: Logger): Unit = {
|
||||
if (builds.nonEmpty)
|
||||
log.warn(s"$method is a no-op for SBT targets: ${builds.keys.mkString("[", ",", "]")}")
|
||||
log.warn(s"$method is a no-op for build.sbt targets: ${builds.keys.mkString("[", ",", "]")}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue