2014-12-18 13:57:05 +01:00
|
|
|
import sbt._
|
|
|
|
|
import Keys._
|
2017-07-01 04:08:30 +02:00
|
|
|
import sbt.contraband.ContrabandPlugin.autoImport._
|
2014-12-18 13:57:05 +01:00
|
|
|
|
|
|
|
|
object Dependencies {
|
2018-02-06 17:02:45 +01:00
|
|
|
// WARNING: Please Scala update versions in PluginCross.scala too
|
2020-08-12 03:06:57 +02:00
|
|
|
val scala212 = "2.12.12"
|
|
|
|
|
val scala213 = "2.13.3"
|
2020-01-10 14:41:55 +01:00
|
|
|
val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up")
|
2017-01-15 07:44:05 +01:00
|
|
|
val baseScalaVersion = scala212
|
2020-01-10 14:41:55 +01:00
|
|
|
def nightlyVersion = sys.props.get("sbt.build.version")
|
2014-12-18 23:40:20 +01:00
|
|
|
|
2015-09-14 09:27:22 +02:00
|
|
|
// sbt modules
|
2020-09-06 10:50:52 +02:00
|
|
|
private val ioVersion = nightlyVersion.getOrElse("1.4.0-M8")
|
2018-10-02 17:24:28 +02:00
|
|
|
private val lmVersion =
|
2020-09-22 05:47:34 +02:00
|
|
|
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.4.0-M3")
|
|
|
|
|
val zincVersion = nightlyVersion.getOrElse("1.4.0-M13")
|
2016-11-23 17:19:22 +01:00
|
|
|
|
|
|
|
|
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
|
|
|
|
|
2017-07-16 00:09:40 +02:00
|
|
|
private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion
|
2019-04-28 23:27:10 +02:00
|
|
|
private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion
|
2016-11-23 16:17:34 +01:00
|
|
|
|
2020-05-28 06:59:10 +02:00
|
|
|
val launcherVersion = "1.1.4"
|
2018-04-07 00:36:10 +02:00
|
|
|
val launcherInterface = "org.scala-sbt" % "launcher-interface" % launcherVersion
|
|
|
|
|
val rawLauncher = "org.scala-sbt" % "launcher" % launcherVersion
|
2016-11-23 18:29:52 +01:00
|
|
|
val testInterface = "org.scala-sbt" % "test-interface" % "1.0"
|
2020-06-22 20:38:48 +02:00
|
|
|
val ipcSocket = "org.scala-sbt.ipcsocket" % "ipcsocket" % "1.1.0"
|
2016-11-23 16:17:34 +01:00
|
|
|
|
2017-06-26 12:38:37 +02:00
|
|
|
private val compilerInterface = "org.scala-sbt" % "compiler-interface" % zincVersion
|
|
|
|
|
private val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion
|
2016-11-23 18:29:52 +01:00
|
|
|
private val compilerApiInfo = "org.scala-sbt" %% "zinc-apiinfo" % zincVersion
|
|
|
|
|
private val compilerBridge = "org.scala-sbt" %% "compiler-bridge" % zincVersion
|
|
|
|
|
private val zinc = "org.scala-sbt" %% "zinc" % zincVersion
|
|
|
|
|
private val zincCompile = "org.scala-sbt" %% "zinc-compile" % zincVersion
|
2019-04-18 09:14:04 +02:00
|
|
|
private val zincCompileCore = "org.scala-sbt" %% "zinc-compile-core" % zincVersion
|
2016-11-23 17:19:22 +01:00
|
|
|
|
2020-01-10 14:41:55 +01:00
|
|
|
def getSbtModulePath(key: String) = {
|
2016-11-23 17:19:22 +01:00
|
|
|
val localProps = new java.util.Properties()
|
|
|
|
|
IO.load(localProps, file("project/local.properties"))
|
2020-01-10 14:41:55 +01:00
|
|
|
val path = Option(localProps.getProperty(key)).orElse(sys.props.get(key))
|
|
|
|
|
path.foreach(f => println(s"Using $key=$f"))
|
2016-11-23 17:19:22 +01:00
|
|
|
path
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-10 14:41:55 +01:00
|
|
|
lazy val sbtIoPath = getSbtModulePath("sbtio.path")
|
|
|
|
|
lazy val sbtUtilPath = getSbtModulePath("sbtutil.path")
|
|
|
|
|
lazy val sbtLmPath = getSbtModulePath("sbtlm.path")
|
|
|
|
|
lazy val sbtZincPath = getSbtModulePath("sbtzinc.path")
|
2016-11-23 17:19:22 +01:00
|
|
|
|
2019-04-18 09:14:04 +02:00
|
|
|
def addSbtModule(
|
|
|
|
|
path: Option[String],
|
|
|
|
|
projectName: String,
|
|
|
|
|
moduleId: ModuleID,
|
|
|
|
|
c: Option[Configuration] = None
|
2020-01-10 14:41:55 +01:00
|
|
|
) = (p: Project) => {
|
2019-04-18 09:14:04 +02:00
|
|
|
val m = moduleId.withConfigurations(c.map(_.name))
|
2016-11-23 17:19:22 +01:00
|
|
|
path match {
|
2019-05-13 19:59:58 +02:00
|
|
|
case Some(f) =>
|
2020-01-10 14:41:55 +01:00
|
|
|
p.dependsOn(ClasspathDependency(ProjectRef(file(f), projectName), c.map(_.name)))
|
|
|
|
|
case None => p.settings(libraryDependencies += m, dependencyOverrides += m)
|
2016-11-23 17:19:22 +01:00
|
|
|
}
|
2019-04-18 09:14:04 +02:00
|
|
|
}
|
2016-11-23 17:19:22 +01:00
|
|
|
|
2020-01-10 14:41:55 +01:00
|
|
|
def addSbtIO = addSbtModule(sbtIoPath, "io", sbtIO)
|
2017-06-26 12:38:37 +02:00
|
|
|
|
2020-01-10 14:41:55 +01:00
|
|
|
def addSbtLmCore = addSbtModule(sbtLmPath, "lmCore", libraryManagementCore)
|
|
|
|
|
def addSbtLmIvy = addSbtModule(sbtLmPath, "lmIvy", libraryManagementIvy)
|
|
|
|
|
def addSbtLmIvyTest = addSbtModule(sbtLmPath, "lmIvy", libraryManagementIvy, Some(Test))
|
|
|
|
|
|
2020-04-22 22:43:11 +02:00
|
|
|
def addSbtCompilerInterface = addSbtModule(sbtZincPath, "compilerInterfaceJVM", compilerInterface)
|
|
|
|
|
def addSbtCompilerClasspath = addSbtModule(sbtZincPath, "zincClasspathJVM2_12", compilerClasspath)
|
|
|
|
|
def addSbtCompilerApiInfo = addSbtModule(sbtZincPath, "zincApiInfoJVM2_12", compilerApiInfo)
|
|
|
|
|
def addSbtCompilerBridge = addSbtModule(sbtZincPath, "compilerBridgeJVM2_12", compilerBridge)
|
|
|
|
|
def addSbtZinc = addSbtModule(sbtZincPath, "zincJVM2_12", zinc)
|
|
|
|
|
def addSbtZincCompile = addSbtModule(sbtZincPath, "zincCompileJVM2_12", zincCompile)
|
|
|
|
|
def addSbtZincCompileCore = addSbtModule(sbtZincPath, "zincCompileCoreJVM2_12", zincCompileCore)
|
2020-01-10 14:41:55 +01:00
|
|
|
|
2020-09-15 04:44:16 +02:00
|
|
|
val lmCoursierShaded = "io.get-coursier" %% "lm-coursier-shaded" % "2.0.0-RC6-9"
|
2020-01-10 14:41:55 +01:00
|
|
|
|
2020-06-09 06:42:56 +02:00
|
|
|
def sjsonNew(n: String) =
|
|
|
|
|
Def.setting("com.eed3si9n" %% n % "0.9.0") // contrabandSjsonNewVersion.value
|
2020-01-10 14:41:55 +01:00
|
|
|
val sjsonNewScalaJson = sjsonNew("sjson-new-scalajson")
|
|
|
|
|
val sjsonNewMurmurhash = sjsonNew("sjson-new-murmurhash")
|
2019-12-08 00:49:13 +01:00
|
|
|
|
2020-06-22 16:08:25 +02:00
|
|
|
val jline = "org.scala-sbt.jline" % "jline" % "2.14.7-sbt-5e51b9d4f9631ebfa29753ce4accc57808e7fd6b"
|
Support scala 2.13 console in thin client
In order to make the console task work with scala 2.13 and the thin
client, we need to provide a way for the scala repl to use an sbt
provided jline3 terminal instead of the default terminal typically built
by the repl. We also need to put jline 3 higher up in the classloading
hierarchy to ensure that two versions of jline 3 are not loaded (which
makes it impossible to share the sbt terminal with the scala terminal).
One impact of this change is the decoupling of the version of
jline-terminal used by the in process scala console and the version
of jline-terminal specified by the scala version itself. It is possible
to override this by setting the `useScalaReplJLine` flag to true. When
that is set, the scala REPL will run in a fully isolated classloader. That
will ensure that the versions are consistent. It will, however, for sure
break the thin client and may interfere with the embedded shell ui.
As part of this work, I also discovered that jline 3 Terminal.getSize is
very slow. In jline 2, the terminal attributes were automatically cached with a
timeout of, I think, 1 second so it wasn't a big deal to call
Terminal.getAttributes. The getSize method in jline 3 is not cached and
it shells out to run a tty command. This caused a significant
performance regression in sbt because when progress is enabled, we call
Terminal.getSize whenever we log any messages. I added caching of
getSize at the TerminalImpl level to address this. The timeout is 1
second, which seems responsive enough for most use cases. We could also
move the calculation onto a background thread and have it periodically
updated, but that seems like overkill.
2020-07-20 19:12:04 +02:00
|
|
|
val jline3Version = "3.16.0" // Once the base jline version is upgraded, we can use the official jline-terminal
|
|
|
|
|
val jline3Terminal = "org.scala-sbt.jline3" % "jline-terminal" % s"$jline3Version-sbt-211a082ed6326908dc84ca017ce4430728f18a8a"
|
|
|
|
|
val jline3Jansi = "org.jline" % "jline-terminal-jansi" % jline3Version
|
Fix switching between raw and canonical input
There were a number of issues with swithcing between raw and canonical
issues that affected both the server and the thin client. These were
reported in #5863 and #5856. In both cases, there were issues with
reading input or having the input be displayed. Debugging those issues
revealed a number of issues with how we were using the jline 3 system
terminal and the hybrid interaction with the jline 2 terminal. This
commit eliminates all of our internal jline 2 usage. The only remaining
jline 2 usage is that we create and override the global terminal for the
scala console for scala versions < 2.13. By moving away from jline 2, I
was also able to fix #5828, which reported that the home, end and delete
keys were not working.
One of the big issues that this commit addresses is that the
NetworkClient was always performing blocking reads on System.in. This
was problematic because it turns out that you can't switch between raw
and canonical modes when there is a read present. To fix this, the
server now sends a message to the client when it wants to read bytes and
only then does the client create a background thread to read a single
byte.
I also figured out how to set the terminal type properly for the thin
client on windows where we had been manually setting the capabilities to
ansi, which only worked for some keys. This fix required switching to
the WindowsInputStream that I introduced in a prior commit. Before we
were using the jline 2 wrapped input stream which was converting some
system events, like home and end, to the wrong escape sequence mappings.
The remainder of the commit is mostly just converting from jline 2 apis
to jline 3 apis.
I verified that tab completions, the scala console, the ammonite console
and a run task that read from System.in all work with both the server
and the thin client on mac, linux and windows after these changes.
Fixes #5828, #5863, #5856
2020-09-21 00:27:08 +02:00
|
|
|
val jline3JNA = "org.jline" % "jline-terminal-jna" % jline3Version
|
Support scala 2.13 console in thin client
In order to make the console task work with scala 2.13 and the thin
client, we need to provide a way for the scala repl to use an sbt
provided jline3 terminal instead of the default terminal typically built
by the repl. We also need to put jline 3 higher up in the classloading
hierarchy to ensure that two versions of jline 3 are not loaded (which
makes it impossible to share the sbt terminal with the scala terminal).
One impact of this change is the decoupling of the version of
jline-terminal used by the in process scala console and the version
of jline-terminal specified by the scala version itself. It is possible
to override this by setting the `useScalaReplJLine` flag to true. When
that is set, the scala REPL will run in a fully isolated classloader. That
will ensure that the versions are consistent. It will, however, for sure
break the thin client and may interfere with the embedded shell ui.
As part of this work, I also discovered that jline 3 Terminal.getSize is
very slow. In jline 2, the terminal attributes were automatically cached with a
timeout of, I think, 1 second so it wasn't a big deal to call
Terminal.getAttributes. The getSize method in jline 3 is not cached and
it shells out to run a tty command. This caused a significant
performance regression in sbt because when progress is enabled, we call
Terminal.getSize whenever we log any messages. I added caching of
getSize at the TerminalImpl level to address this. The timeout is 1
second, which seems responsive enough for most use cases. We could also
move the calculation onto a background thread and have it periodically
updated, but that seems like overkill.
2020-07-20 19:12:04 +02:00
|
|
|
val jline3Reader = "org.jline" % "jline-reader" % jline3Version
|
2020-06-30 17:57:57 +02:00
|
|
|
val jansi = "org.fusesource.jansi" % "jansi" % "1.18"
|
2019-08-19 08:34:07 +02:00
|
|
|
val scalatest = "org.scalatest" %% "scalatest" % "3.0.8"
|
2018-09-29 22:01:37 +02:00
|
|
|
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.0"
|
2020-07-08 01:52:52 +02:00
|
|
|
val specs2 = "org.specs2" %% "specs2-junit" % "4.10.0"
|
2016-11-23 18:29:52 +01:00
|
|
|
val junit = "junit" % "junit" % "4.11"
|
2019-10-21 02:42:52 +02:00
|
|
|
val scalaVerify = "com.eed3si9n.verify" %% "verify" % "0.2.0"
|
2016-08-22 08:38:46 +02:00
|
|
|
val templateResolverApi = "org.scala-sbt" % "template-resolver" % "0.1"
|
2016-11-23 16:17:34 +01:00
|
|
|
|
2020-06-27 07:14:35 +02:00
|
|
|
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.3.0"
|
2020-01-10 14:41:55 +01:00
|
|
|
val scalaParsers = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
|
|
|
|
|
val scalaReflect = Def.setting("org.scala-lang" % "scala-reflect" % scalaVersion.value)
|
2017-07-28 06:08:27 +02:00
|
|
|
|
|
|
|
|
// specify all of log4j modules to prevent misalignment
|
2020-01-10 14:41:55 +01:00
|
|
|
def log4jModule = (n: String) => "org.apache.logging.log4j" % n % "2.11.2"
|
|
|
|
|
val log4jApi = log4jModule("log4j-api")
|
|
|
|
|
val log4jCore = log4jModule("log4j-core")
|
|
|
|
|
val log4jSlf4jImpl = log4jModule("log4j-slf4j-impl")
|
|
|
|
|
val log4jModules = Vector(log4jApi, log4jCore, log4jSlf4jImpl)
|
2017-10-20 17:26:23 +02:00
|
|
|
|
2020-08-07 21:49:39 +02:00
|
|
|
val caffeine = "com.github.ben-manes.caffeine" % "caffeine" % "2.8.5"
|
2019-04-21 04:06:52 +02:00
|
|
|
|
|
|
|
|
val hedgehog = "hedgehog" %% "hedgehog-sbt" % "0.1.0"
|
2019-12-08 00:49:13 +01:00
|
|
|
val disruptor = "com.lmax" % "disruptor" % "3.4.2"
|
|
|
|
|
val silencerPlugin = "com.github.ghik" %% "silencer-plugin" % "1.4.2"
|
|
|
|
|
val silencerLib = "com.github.ghik" %% "silencer-lib" % "1.4.2" % Provided
|
2014-12-18 13:57:05 +01:00
|
|
|
}
|