Permalink
Browse files

Take compiler flags using the option `-scalac-option`

This commit adds the ability for the kernel to take any number of scalac
compiler flags given by `--scalac-option -Xopt1 --scalac-option -Yopt2`
etc.

It's not very pretty but at least it's possible to do things like enable
`-Ypartial-unification`.
  • Loading branch information...
jeremyrsmith committed May 3, 2017
1 parent 9f265e9 commit 18d5bfb389ef15a63ef54724dcf8d00a586fe560
@@ -13,14 +13,14 @@ import com.typesafe.scalalogging.LazyLogging
case class JupyterScalaApp(
id: String = "scala",
name: String = "Scala",
scalacOption: List[String] = Nil,
// @ExtraName("d")
// dependency: List[String],
// @ExtraName("r")
// repository: List[String],
@Recurse
options: ServerAppOptions
) extends App with LazyLogging {
def readFully(is: InputStream) = {
val buffer = new ByteArrayOutputStream()
@@ -95,7 +95,7 @@ case class JupyterScalaApp(
name = name,
"scala",
new InterpreterKernel {
def apply() = new Interp
def apply() = new Interp(scalacOption)
},
mainJar,
isJar = true,
@@ -13,7 +13,7 @@ import jupyter.kernel.interpreter.Interpreter.IsComplete
import scala.util.Try
class Interp extends jupyter.kernel.interpreter.Interpreter with LazyLogging {
class Interp(scalacOptions: List[String]) extends jupyter.kernel.interpreter.Interpreter with LazyLogging {
def defaultPredef = true
@@ -95,6 +95,8 @@ class Interp extends jupyter.kernel.interpreter.Interpreter with LazyLogging {
interp.init()
interp.compiler.compiler.settings.processArguments(scalacOptions, processAll = true)
private def capturingOutput[T](t: => T): T =
Capture(
currentPublish.map(p => p.stdout(_)),

0 comments on commit 18d5bfb

Please sign in to comment.