@@ -522,8 +522,8 @@ object Build {
522522 }
523523 },
524524 run := dotc.evaluated,
525- dotc := runCompilerMain(" dotty.tools.dotc.Main " ).evaluated,
526- repl := runCompilerMain(" dotty.tools. repl.Main " ).evaluated,
525+ dotc := runCompilerMain(Nil ).evaluated,
526+ repl := runCompilerMain(List ( " - repl" ) ).evaluated,
527527
528528 // enable verbose exception messages for JUnit
529529 testOptions in Test += Tests .Argument (
@@ -617,11 +617,24 @@ object Build {
617617 }
618618 )
619619
620- def runCompilerMain (main : String ) = Def .inputTaskDyn {
620+ def runCompilerMain (otherArgs : List [ String ] ) = Def .inputTaskDyn {
621621 val dottyLib = packageAll.value(" dotty-library" )
622- val args : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
622+ val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList ++ otherArgs
623+ val args = args0.filter(arg => arg != " -tasty" && arg != " -repl" )
623624
624- val fullArgs = main :: {
625+ val repl = args0.contains(" -repl" )
626+ val tasty = args0.contains(" -tasty" )
627+
628+ val main =
629+ if (repl) " dotty.tools.repl.Main"
630+ else if (tasty) " dotty.tools.dotc.FromTasty"
631+ else " dotty.tools.dotc.Main"
632+
633+ val extraArgs =
634+ if (tasty && ! args.contains(" -Yretain-trees" )) List (" -Yretain-trees" )
635+ else Nil
636+
637+ val fullArgs = main :: extraArgs ::: {
625638 val (beforeCp, fromCp) = args.span(_ != " -classpath" )
626639 val classpath = fromCp.drop(1 ).headOption.fold(dottyLib)(_ + " :" + dottyLib)
627640 beforeCp ::: " -classpath" :: classpath :: fromCp.drop(2 )
0 commit comments