@@ -77,6 +77,7 @@ object DottyBuild extends Build {
77
77
dependsOn(`dotty-library`).
78
78
dependsOn(`dotty-interfaces`).
79
79
settings(
80
+ addCommandAlias(" run" , " dotty-compiler/run" ) ++
80
81
addCommandAlias(" dotc" , " dotty-compiler/dotc" ) ++
81
82
addCommandAlias(" repl" , " dotty-compiler/repl" ) ++
82
83
addCommandAlias(
@@ -180,6 +181,28 @@ object DottyBuild extends Build {
180
181
)
181
182
}.evaluated,
182
183
184
+ // Override run to be able to run compiled classfiles
185
+ run := {
186
+ val args : Seq [String ] = spaceDelimited(" <arg>" ).parsed
187
+ val java : String = Process (" which" :: " java" :: Nil ) !!
188
+ val scalaLib = (dependencyClasspath in Runtime , packageAll)
189
+ .map { (attList, _) =>
190
+ attList
191
+ .map(_.data.getAbsolutePath)
192
+ .find(_.contains(" scala-library" ))
193
+ .toList.mkString(" :" )
194
+ }.value
195
+
196
+ if (java == " " )
197
+ println(" Couldn't find java executable on path, please install java to a default location" )
198
+ else if (scalaLib == " " ) {
199
+ println(" Couldn't find scala-library on classpath, please run using script in bin dir instead" )
200
+ } else {
201
+ val dottyLib = packageAll.value(" dotty-library" )
202
+ s """ $java -classpath .: $dottyLib: $scalaLib ${args.mkString(" " )}""" !
203
+ }
204
+ },
205
+
183
206
// Set run baseDir to be root of project, makes dotc saner
184
207
baseDirectory in run := baseDirectory.value / " .." ,
185
208
dotc := Def .inputTaskDyn {
0 commit comments