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]],
|
definitionClasspath: Seq[Attributed[File]],
|
||||||
resolvers: Option[Vector[Resolver]],
|
resolvers: Option[Vector[Resolver]],
|
||||||
report: Option[UpdateReport],
|
report: Option[UpdateReport],
|
||||||
scalacOptions: Seq[String]
|
scalacOptions: Seq[String],
|
||||||
|
unmanagedSources: Seq[File],
|
||||||
|
managedSources: Seq[File]
|
||||||
) {
|
) {
|
||||||
val classpath: Seq[Attributed[File]] = definitionClasspath ++ dependencyClasspath
|
val classpath: Seq[Attributed[File]] = definitionClasspath ++ dependencyClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
object PluginData {
|
object PluginData {
|
||||||
private[sbt] def apply(dependencyClasspath: Def.Classpath): 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 {
|
object EvaluateTask {
|
||||||
|
|
|
||||||
|
|
@ -1164,12 +1164,16 @@ private[sbt] object Load {
|
||||||
val prod = (Configurations.Runtime / exportedProducts).value
|
val prod = (Configurations.Runtime / exportedProducts).value
|
||||||
val cp = (Configurations.Runtime / fullClasspath).value
|
val cp = (Configurations.Runtime / fullClasspath).value
|
||||||
val opts = (Configurations.Compile / scalacOptions).value
|
val opts = (Configurations.Compile / scalacOptions).value
|
||||||
|
val managedSrcs = (Configurations.Compile / managedSources).value
|
||||||
|
val unmanagedSrcs = (Configurations.Compile / unmanagedSources).value
|
||||||
PluginData(
|
PluginData(
|
||||||
removeEntries(cp, prod),
|
removeEntries(cp, prod),
|
||||||
prod,
|
prod,
|
||||||
Some(fullResolvers.value.toVector),
|
Some(fullResolvers.value.toVector),
|
||||||
Some(update.value),
|
Some(update.value),
|
||||||
opts
|
opts,
|
||||||
|
unmanagedSrcs,
|
||||||
|
managedSrcs
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
scalacOptions += "-Wconf:cat=unused-nowarn:s",
|
scalacOptions += "-Wconf:cat=unused-nowarn:s",
|
||||||
|
|
@ -1225,7 +1229,7 @@ private[sbt] object Load {
|
||||||
loadPluginDefinition(
|
loadPluginDefinition(
|
||||||
dir,
|
dir,
|
||||||
config,
|
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 =
|
def buildPlugins(dir: File, s: State, config: LoadBuildConfiguration): LoadedPlugins =
|
||||||
|
|
@ -1417,6 +1421,8 @@ final case class LoadBuildConfiguration(
|
||||||
data.internalClasspath,
|
data.internalClasspath,
|
||||||
Some(data.resolvers),
|
Some(data.resolvers),
|
||||||
Some(data.updateReport),
|
Some(data.updateReport),
|
||||||
|
Nil,
|
||||||
|
Nil,
|
||||||
Nil
|
Nil
|
||||||
)
|
)
|
||||||
case None => PluginData(globalPluginClasspath)
|
case None => PluginData(globalPluginClasspath)
|
||||||
|
|
|
||||||
|
|
@ -131,11 +131,16 @@ object BuildServerProtocol {
|
||||||
case (id, loadedBuildUnit) =>
|
case (id, loadedBuildUnit) =>
|
||||||
val base = loadedBuildUnit.localBase
|
val base = loadedBuildUnit.localBase
|
||||||
val sbtFiles = configurationSources(base)
|
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 =
|
val sbtFilesItems =
|
||||||
sbtFiles.map(f => SourceItem(f.toURI, SourceItemKind.File, generated = false))
|
sbtFiles.map(f => SourceItem(f.toURI, SourceItemKind.File, generated = false))
|
||||||
val defDirItem = SourceItem(defDir.toURI, SourceItemKind.Directory, generated = false)
|
SourcesItem(id, (unmanagedSources ++ managedSources ++ sbtFilesItems).toVector)
|
||||||
SourcesItem(id, (defDirItem +: sbtFilesItems).toVector)
|
|
||||||
}
|
}
|
||||||
val result = SourcesResult((items ++ buildItems).toVector)
|
val result = SourcesResult((items ++ buildItems).toVector)
|
||||||
s.respondEvent(result)
|
s.respondEvent(result)
|
||||||
|
|
@ -874,7 +879,7 @@ object BuildServerProtocol {
|
||||||
}
|
}
|
||||||
def warnIfBuildsNonEmpty(method: String, log: Logger): Unit = {
|
def warnIfBuildsNonEmpty(method: String, log: Logger): Unit = {
|
||||||
if (builds.nonEmpty)
|
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