From 0bc7146b5bd8b8b0bcc1a0363ba4b42a58287260 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 2 Jun 2015 15:30:39 +1000 Subject: [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 ``` --- build.sbt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 553c217d4a..e960a4c3d2 100644 --- a/build.sbt +++ b/build.sbt @@ -192,7 +192,12 @@ lazy val interactive = configureAsSubproject(project) .dependsOn(compiler) lazy val repl = configureAsSubproject(project) - .settings(libraryDependencies += jlineDep) + .settings( + libraryDependencies += jlineDep, + connectInput in run := true, + outputStrategy in run := Some(StdoutOutput), + run <<= (run in Compile).partialInput(" -usejavacp") // Automatically add this so that `repl/run` works without additional arguments. + ) .settings(disableDocsAndPublishingTasks: _*) .dependsOn(compiler) -- cgit v1.2.3