@@ -87,6 +87,7 @@ object Build {
8787 lazy val dotr =
8888 inputKey[Unit ](" run compiled binary using the correct classpath, or the user supplied classpath" )
8989
90+
9091 // Compiles the documentation and static site
9192 lazy val genDocs = taskKey[Unit ](" run dottydoc to generate static documentation site" )
9293
@@ -523,8 +524,8 @@ object Build {
523524 }
524525 },
525526 run := dotc.evaluated,
526- dotc := runCompilerMain(false ).evaluated,
527- repl := runCompilerMain(true ).evaluated,
527+ dotc := runCompilerMain().evaluated,
528+ repl := runCompilerMain(repl = true ).evaluated,
528529
529530 // enable verbose exception messages for JUnit
530531 testOptions in Test += Tests .Argument (
@@ -618,16 +619,22 @@ object Build {
618619 }
619620 )
620621
621- def runCompilerMain (repl : Boolean ) = Def .inputTaskDyn {
622+ def runCompilerMain (repl : Boolean = false ) = Def .inputTaskDyn {
622623 val dottyLib = packageAll.value(" dotty-library" )
623624 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" )
625627
626628 val main =
627629 if (repl) " dotty.tools.repl.Main"
630+ else if (decompile) " dotty.tools.dotc.decompiler.Main"
628631 else " dotty.tools.dotc.Main"
629632
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)
631638
632639 (runMain in Compile ).toTask(fullArgs.mkString(" " , " " , " " ))
633640 }
0 commit comments