@@ -87,6 +87,7 @@ object Build {
87
87
lazy val dotr =
88
88
inputKey[Unit ](" run compiled binary using the correct classpath, or the user supplied classpath" )
89
89
90
+
90
91
// Compiles the documentation and static site
91
92
lazy val genDocs = taskKey[Unit ](" run dottydoc to generate static documentation site" )
92
93
@@ -523,8 +524,8 @@ object Build {
523
524
}
524
525
},
525
526
run := dotc.evaluated,
526
- dotc := runCompilerMain(false ).evaluated,
527
- repl := runCompilerMain(true ).evaluated,
527
+ dotc := runCompilerMain().evaluated,
528
+ repl := runCompilerMain(repl = true ).evaluated,
528
529
529
530
// enable verbose exception messages for JUnit
530
531
testOptions in Test += Tests .Argument (
@@ -618,16 +619,22 @@ object Build {
618
619
}
619
620
)
620
621
621
- def runCompilerMain (repl : Boolean ) = Def .inputTaskDyn {
622
+ def runCompilerMain (repl : Boolean = false ) = Def .inputTaskDyn {
622
623
val dottyLib = packageAll.value(" dotty-library" )
623
624
val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
624
- val args = args0.filter(arg => arg != " -repl" )
625
+ val decompile = args0.contains(" -decompile" )
626
+ val args = args0.filter(arg => arg != " -repl" || arg != " -decompile" )
625
627
626
628
val main =
627
629
if (repl) " dotty.tools.repl.Main"
630
+ else if (decompile) " dotty.tools.dotc.decompiler.Main"
628
631
else " dotty.tools.dotc.Main"
629
632
630
- val fullArgs = main :: insertClasspathInArgs(args, dottyLib)
633
+ val extraClasspath =
634
+ if (decompile && ! args.contains(" -classpath" )) dottyLib + " :."
635
+ else dottyLib
636
+
637
+ val fullArgs = main :: insertClasspathInArgs(args, extraClasspath)
631
638
632
639
(runMain in Compile ).toTask(fullArgs.mkString(" " , " " , " " ))
633
640
}
0 commit comments