Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Commit 0bc7146

Browse files
committed
[sbt] Allow the REPL to be run from the SBT build
- Tell SBT to that we're forking an interactive process - Automatically add `-usejavacp` so the REPL adds the classes from the system classloader to the compilers classpath. JLine seems to be working from within this setup. ``` % sbt Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384m; support was removed in 8.0 [info] Loading global plugins from /Users/jason/.sbt/0.13/plugins [info] Loading project definition from /Users/jason/code/scala2/project [info] *** Welcome to the sbt build definition for Scala! *** [info] This build definition has an EXPERIMENTAL status. If you are not [info] interested in testing or working on the build itself, please use [info] the Ant build definition for now. Check README.md for more information. > repl/run [info] Running scala.tools.nsc.MainGenericRunner -usejavacp Welcome to Scala version 2.11.6-SNAPSHOT-20150528-131650-70f0b1ded8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_25). Type in expressions to have them evaluated. Type :help for more information. scala> 1 + 1 res0: Int = 2 (reverse-i-search)`1': 1 + 1 ```
1 parent 70f0b1d commit 0bc7146

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

build.sbt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ lazy val interactive = configureAsSubproject(project)
192192
.dependsOn(compiler)
193193

194194
lazy val repl = configureAsSubproject(project)
195-
.settings(libraryDependencies += jlineDep)
195+
.settings(
196+
libraryDependencies += jlineDep,
197+
connectInput in run := true,
198+
outputStrategy in run := Some(StdoutOutput),
199+
run <<= (run in Compile).partialInput(" -usejavacp") // Automatically add this so that `repl/run` works without additional arguments.
200+
)
196201
.settings(disableDocsAndPublishingTasks: _*)
197202
.dependsOn(compiler)
198203

0 commit comments

Comments
 (0)