Skip to content

Instantly share code, notes, and snippets.

@mallman

mallman/ammonite.sbt

Last active Sep 8, 2017
Embed
What would you like to do?
SBT Ammonite integration
val ammoniteVersion = "1.0.2"
lazy val Ammonite = config("ammonite-internal").extend(Test).hide
ivyConfigurations += Ammonite
inConfig(Ammonite)(Defaults.configSettings)
resourceDirectories in Ammonite += (resourceDirectory in Test).value
fork in (Ammonite, run) := true
val log4jVersion = "2.8.2"
libraryDependencies ++= Seq(
"com.lihaoyi" % "ammonite" % ammoniteVersion % Ammonite cross CrossVersion.full,
"org.apache.logging.log4j" % "log4j-api" % log4jVersion % Ammonite,
"org.apache.logging.log4j" % "log4j-core" % log4jVersion % Ammonite,
"org.apache.logging.log4j" % "log4j-1.2-api" % log4jVersion % Ammonite,
"org.apache.logging.log4j" % "log4j-slf4j-impl" % log4jVersion % Ammonite
)
lazy val amm = inputKey[Unit]("Runs the Ammonite REPL.")
amm := { (runMain in Ammonite).partialInput(" ammonite.Main").evaluated }
outputStrategy in Ammonite := Some(StdoutOutput)
connectInput in (Ammonite, run) := true
interp.load.ivy(
"com.lihaoyi" %
s"ammonite-shell_${scala.util.Properties.versionNumberString}" %
ammonite.Constants.version
)
@
val shellSession = ammonite.shell.ShellSession()
import shellSession._
import ammonite.ops._
import ammonite.shell._
ammonite.shell.Configure(interp, repl, wd)
val localInitPath = cwd / ".amm_init.sc"
if (exists(localInitPath)) { repl.load.exec(localInitPath) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment