@@ -522,8 +522,8 @@ object Build {
522
522
}
523
523
},
524
524
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,
527
527
528
528
// enable verbose exception messages for JUnit
529
529
testOptions in Test += Tests .Argument (
@@ -617,11 +617,24 @@ object Build {
617
617
}
618
618
)
619
619
620
- def runCompilerMain (main : String ) = Def .inputTaskDyn {
620
+ def runCompilerMain (otherArgs : List [ String ] ) = Def .inputTaskDyn {
621
621
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" )
623
624
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 ::: {
625
638
val (beforeCp, fromCp) = args.span(_ != " -classpath" )
626
639
val classpath = fromCp.drop(1 ).headOption.fold(dottyLib)(_ + " :" + dottyLib)
627
640
beforeCp ::: " -classpath" :: classpath :: fromCp.drop(2 )
0 commit comments