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