@@ -18,6 +18,9 @@ import dotty.tools.sbtplugin.DottyPlugin.autoImport._
18
18
import dotty .tools .sbtplugin .DottyIDEPlugin .{ prepareCommand , runProcess }
19
19
import dotty .tools .sbtplugin .DottyIDEPlugin .autoImport ._
20
20
21
+ import sbtbuildinfo .BuildInfoPlugin
22
+ import sbtbuildinfo .BuildInfoPlugin .autoImport ._
23
+
21
24
/* In sbt 0.13 the Build trait would expose all vals to the shell, where you
22
25
* can use them in "set a := b" like expressions. This re-exposes them.
23
26
*/
@@ -85,6 +88,13 @@ object Build {
85
88
// Only available in vscode-dotty
86
89
lazy val unpublish = taskKey[Unit ](" Unpublish a package" )
87
90
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
+
88
98
// Settings shared by the build (scoped in ThisBuild). Used in build.sbt
89
99
lazy val thisBuildSettings = Def .settings(
90
100
organization := dottyOrganization,
@@ -789,6 +799,32 @@ object Build {
789
799
790
800
runTask(Runtime , mainClass, allArgs : _* )
791
801
}.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
792
828
).disablePlugins(ScriptedPlugin )
793
829
794
830
lazy val `dotty-bench` = project.in(file(" bench" )).asDottyBench(NonBootstrapped )
0 commit comments