summaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-06-02 15:30:39 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-06-02 15:30:39 +1000
commit0bc7146b5bd8b8b0bcc1a0363ba4b42a58287260 (patch)
tree8cb8aab3bb1d4a35c05a29956b4b02e6cd84e51c /build.sbt
parent70f0b1ded880ec9b3a9478d02f1898fcfeee230c (diff)
downloadscala-0bc7146b5bd8b8b0bcc1a0363ba4b42a58287260.tar.gz
scala-0bc7146b5bd8b8b0bcc1a0363ba4b42a58287260.tar.bz2
scala-0bc7146b5bd8b8b0bcc1a0363ba4b42a58287260.zip
[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 ```
Diffstat (limited to 'build.sbt')
-rw-r--r--build.sbt7
1 files changed, 6 insertions, 1 deletions
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)