@@ -18,6 +18,9 @@ import dotty.tools.sbtplugin.DottyPlugin.autoImport._
1818import dotty .tools .sbtplugin .DottyIDEPlugin .{ prepareCommand , runProcess }
1919import dotty .tools .sbtplugin .DottyIDEPlugin .autoImport ._
2020
21+ import sbtbuildinfo .BuildInfoPlugin
22+ import sbtbuildinfo .BuildInfoPlugin .autoImport ._
23+
2124/* In sbt 0.13 the Build trait would expose all vals to the shell, where you
2225 * can use them in "set a := b" like expressions. This re-exposes them.
2326 */
@@ -85,6 +88,13 @@ object Build {
8588 // Only available in vscode-dotty
8689 lazy val unpublish = taskKey[Unit ](" Unpublish a package" )
8790
91+ // Settings used to configure the test language server
92+ lazy val ideTestsCompilerVersion = taskKey[String ](" Compiler version to use in IDE tests" )
93+ lazy val ideTestsCompilerArguments = taskKey[Seq [String ]](" Compiler arguments to use in IDE tests" )
94+ lazy val ideTestsSourceDirectories = taskKey[Seq [File ]](" Source directories to use in IDE tests" )
95+ lazy val ideTestsDependencyClasspath = taskKey[Seq [File ]](" Dependency classpath to use in IDE tests" )
96+ lazy val ideTestsClassDirectory = taskKey[File ](" Class directory to use in IDE tests" )
97+
8898 // Settings shared by the build (scoped in ThisBuild). Used in build.sbt
8999 lazy val thisBuildSettings = Def .settings(
90100 organization := dottyOrganization,
@@ -789,6 +799,32 @@ object Build {
789799
790800 runTask(Runtime , mainClass, allArgs : _* )
791801 }.dependsOn(compile in (`vscode-dotty`, Compile )).evaluated
802+ ).
803+ settings(
804+ ideTestsCompilerVersion := (version in `dotty-compiler`).value,
805+ ideTestsCompilerArguments := (scalacOptions in `dotty-compiler`).value,
806+ ideTestsSourceDirectories := Seq ((baseDirectory in ThisBuild ).value / " out" / " ide-tests" / " src" ),
807+ ideTestsDependencyClasspath := {
808+ val dottyLib = (classDirectory in `dotty-library-bootstrapped` in Compile ).value
809+ val scalaLib =
810+ (dependencyClasspath in `dotty-library-bootstrapped` in Compile )
811+ .value
812+ .map(_.data)
813+ .filter(_.getName.matches(" scala-library.*\\ .jar" ))
814+ .toList
815+ dottyLib :: scalaLib
816+ },
817+ ideTestsClassDirectory := (baseDirectory in ThisBuild ).value / " out" / " ide-tests" / " out" ,
818+ buildInfoKeys in Test := Seq [BuildInfoKey ](
819+ ideTestsCompilerVersion,
820+ ideTestsCompilerArguments,
821+ ideTestsSourceDirectories,
822+ ideTestsDependencyClasspath,
823+ ideTestsClassDirectory
824+ ),
825+ buildInfoPackage in Test := " dotty.tools.languageserver.util.server" ,
826+ BuildInfoPlugin .buildInfoScopedSettings(Test ),
827+ BuildInfoPlugin .buildInfoDefaultSettings
792828 ).disablePlugins(ScriptedPlugin )
793829
794830 lazy val `dotty-bench` = project.in(file(" bench" )).asDottyBench(NonBootstrapped )
0 commit comments