Skip to content

Commit ca8943a

Browse files
committed
Fix dotr -tasty
1 parent 53e24a5 commit ca8943a

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

dist/bin/dotc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ case "$1" in
8282
# Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
8383
-Oshort) addJava "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" && shift ;;
8484
-repl) PROG_NAME="$ReplMain" && shift ;;
85-
-tasty) PROG_NAME="$FromTasty" && shift ;;
85+
-tasty) addScala "-Yretain-trees" && PROG_NAME="$FromTasty" && shift ;;
8686
-compile) PROG_NAME="$CompilerMain" && shift ;;
8787
-run) PROG_NAME="$ReplMain" && shift ;;
8888
-bootcp) bootcp=true && shift ;;

project/Build.scala

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)