Skip to content

Commit 25401d0

Browse files
authored
allow to run the repl with the stdlib in the classpath (#24437)
Note that there is an issue in sbt that prevents me from getting the path to the stdlib and pass it to the `Compile/run` task. Otherwise, with this PR, we are now able to call `scala3-repl/run` and start the REPL. It also forks the JVM since the REPL classloading is a bit weird...
2 parents 31e7f7c + 9a8f193 commit 25401d0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

project/Build.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,15 @@ object Build {
18891889
s"-Ddotty.tools.dotc.semanticdb.test=${(ThisBuild / baseDirectory).value/"tests"/"semanticdb"}",
18901890
)
18911891
},
1892+
run / fork := true,
1893+
excludeDependencies += "org.scala-lang" %% "scala3-library",
1894+
excludeDependencies += "org.scala-lang" % "scala-library",
1895+
Compile / run := {
1896+
//val classpath = s"-classpath ${(`scala-library-bootstrapped` / Compile / packageBin).value}"
1897+
// TODO: We should use the val above instead of `-usejavacp` below. SBT crashes we we have a val and we call toTask
1898+
// with it as a parameter. THIS IS NOT A LEGIT USE CASE OF THE `-usejavacp` FLAG.
1899+
(Compile / run).toTask(" -usejavacp").value
1900+
},
18921901
)
18931902

18941903
// ==============================================================================================

0 commit comments

Comments
 (0)