Skip to content

Commit 3e5625c

Browse files
committed
Add -with-compiler to dotc
1 parent 3df0b19 commit 3e5625c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

dist/bin/dotc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ source "$PROG_HOME/bin/common"
2929

3030
default_java_opts="-Xmx768m -Xms768m"
3131
bootcp=true
32+
withCompiler=true
3233

3334
CompilerMain=dotty.tools.dotc.Main
3435
DecompilerMain=dotty.tools.dotc.decompiler.Main
@@ -89,6 +90,7 @@ case "$1" in
8990
-nobootcp) unset bootcp && shift ;;
9091
-colors) colors=true && shift ;;
9192
-no-colors) unset colors && shift ;;
93+
-with-compiler) jvm_cp_args="$PSEP$DOTTY_COMP" && shift ;;
9294

9395
# break out -D and -J options and add them to JAVA_OPTS as well
9496
# so they reach the JVM in time to do some good. The -D options

project/Build.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,20 +639,22 @@ object Build {
639639

640640
def runCompilerMain(repl: Boolean = false) = Def.inputTaskDyn {
641641
val dottyLib = packageAll.value("dotty-library")
642+
lazy val dottyCompiler = packageAll.value("dotty-compiler")
642643
val args0: List[String] = spaceDelimited("<arg>").parsed.toList
643644
val decompile = args0.contains("-decompile")
644645
val debugFromTasty = args0.contains("-Ythrough-tasty")
645-
val args = args0.filter(arg => arg != "-repl" && arg != "-decompile" && arg != "-Ythrough-tasty")
646+
val args = args0.filter(arg => arg != "-repl" && arg != "-decompile" &&
647+
arg != "-with-compiler" && arg != "-Ythrough-tasty")
646648

647649
val main =
648650
if (repl) "dotty.tools.repl.Main"
649651
else if (decompile) "dotty.tools.dotc.decompiler.Main"
650652
else if (debugFromTasty) "dotty.tools.dotc.fromtasty.Debug"
651653
else "dotty.tools.dotc.Main"
652654

653-
val extraClasspath =
654-
if (decompile && !args.contains("-classpath")) dottyLib + ":."
655-
else dottyLib
655+
var extraClasspath = dottyLib
656+
if (decompile && !args.contains("-classpath")) extraClasspath += ":."
657+
if (args0.contains("-with-compiler")) extraClasspath += s":$dottyCompiler"
656658

657659
val fullArgs = main :: insertClasspathInArgs(args, extraClasspath)
658660

0 commit comments

Comments
 (0)