Skip to content
Permalink
Browse files

Switch to scala 2.13.0

  • Loading branch information...
alexarchambault committed Jun 14, 2019
1 parent 4e9441b commit 34c404acc0a0b2034361b8cde30bc10933091ca6
@@ -46,7 +46,7 @@ jobs:
- scala: 2.12.8
- scala: 2.12.8
jdk: openjdk11
- scala: 2.13.0-M5
- scala: 2.13.0
- name: "Website"
script: amm scripts/site.sc --publishLocal true
- stage: release
@@ -74,7 +74,7 @@ lazy val interpreter = project
.settings(
shared,
libraryDependencies ++= Seq(
Deps.scalatags,
Deps.scalatags.value,
// picked by jboss-logging, that metabrowse transitively depends on
Deps.slf4jNop
),
@@ -118,7 +118,7 @@ lazy val `scala-kernel-api` = project
generatePropertyFile("almond/almond.properties"),
generateDependenciesFile,
libraryDependencies ++= Seq(
Deps.ammoniteRepl,
Deps.ammoniteRepl.value,
Deps.jvmRepr
)
)
@@ -136,7 +136,7 @@ lazy val `scala-interpreter` = project
Nil
}
},
libraryDependencies += "org.fusesource.jansi" % "jansi" % "1.18",
libraryDependencies += Deps.jansi,
crossVersion := CrossVersion.full,
testSettings
)
@@ -184,7 +184,7 @@ lazy val `almond-spark` = project
.settings(
shared,
libraryDependencies ++= Seq(
Deps.ammoniteRepl % "provided",
Deps.ammoniteRepl.value % "provided",
Deps.ammoniteSpark,
Deps.argonautShapeless,
Deps.sparkSql.value % "provided"
@@ -158,56 +158,60 @@ object ScalaInterpreterTests extends TestSuite {

"completion" - {

// Completions are tested in more detail in Ammonite too.
// Compared to it, we filter out stuff that contains '$', and pay
// particular attention to the position parameter that it returns
// (the Jupyter UI will replace some of the user code with a completion
// using that parameter).

* - {
val code = "repl.la"
val expectedRes = Completion(5, 7, Seq("lastException"))
val res = interpreter.complete(code, code.length)
assert(res == expectedRes)
}
// disabled in 2.13 until we can use https://github.com/lihaoyi/Ammonite/pull/973
if (!scala.util.Properties.versionNumberString.startsWith("2.13.")) {

// Completions are tested in more detail in Ammonite too.
// Compared to it, we filter out stuff that contains '$', and pay
// particular attention to the position parameter that it returns
// (the Jupyter UI will replace some of the user code with a completion
// using that parameter).

* - {
val code = "repl.la"
val expectedRes = Completion(5, 7, Seq("lastException"))
val res = interpreter.complete(code, code.length)
assert(res == expectedRes)
}

* - {
val code = "Lis"
val expectedRes = Completion(0, 3, Seq("List"))
val alternativeExpectedRes = Completion(0, 3, Seq("scala.List"))
val res0 = interpreter.complete(code, code.length)
val res = res0.copy(
completions = res0.completions.filter(expectedRes.completions.toSet)
)
val alternativeRes = res0.copy(
completions = res0.completions.filter(alternativeExpectedRes.completions.toSet)
)
assert(res == expectedRes || alternativeRes == alternativeExpectedRes)
}
* - {
val code = "Lis"
val expectedRes = Completion(0, 3, Seq("List"))
val alternativeExpectedRes = Completion(0, 3, Seq("scala.List"))
val res0 = interpreter.complete(code, code.length)
val res = res0.copy(
completions = res0.completions.filter(expectedRes.completions.toSet)
)
val alternativeRes = res0.copy(
completions = res0.completions.filter(alternativeExpectedRes.completions.toSet)
)
assert(res == expectedRes || alternativeRes == alternativeExpectedRes)
}

* - {
val code = "HashM"

val extraCompletions =
if (isScala211 || isScala212)
Seq("scala.collection.parallel.immutable.HashMapCombiner")
else
Nil

val expectedRes = Completion(
0,
5,
Seq(
"java.util.HashMap",
"scala.collection.immutable.HashMap",
"scala.collection.mutable.HashMap"
) ++ extraCompletions
)
val res0 = interpreter.complete(code, code.length)
val res = res0.copy(
completions = res0.completions.filter(expectedRes.completions.toSet)
)
assert(res == expectedRes)
* - {
val code = "HashM"

val extraCompletions =
if (isScala211 || isScala212)
Seq("scala.collection.parallel.immutable.HashMapCombiner")
else
Nil

val expectedRes = Completion(
0,
5,
Seq(
"java.util.HashMap",
"scala.collection.immutable.HashMap",
"scala.collection.mutable.HashMap"
) ++ extraCompletions
)
val res0 = interpreter.complete(code, code.length)
val res = res0.copy(
completions = res0.completions.filter(expectedRes.completions.toSet)
)
assert(res == expectedRes)
}
}

}
@@ -6,22 +6,34 @@ import sbt.Keys.{scalaBinaryVersion, scalaVersion}
object Deps {

object Versions {
def ammonite = "1.6.7"
def ammonite = setting {
val sv = scalaVersion.value
if (sv.startsWith("2.11.")) "1.6.7"
else "1.6.8"
}
def caseApp = "2.0.0-M9"
}

def ammoniteRepl = ("com.lihaoyi" % "ammonite-repl" % Versions.ammonite).cross(CrossVersion.full)
def ammoniteRepl = setting(("com.lihaoyi" % "ammonite-repl" % Versions.ammonite.value).cross(CrossVersion.full))
def ammoniteSpark = "sh.almond" %% "ammonite-spark" % "0.4.2"
def argonautShapeless = "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M10"
def caseAppAnnotations = "com.github.alexarchambault" %% "case-app-annotations" % "2.0.0-M6"
def caseApp = "com.github.alexarchambault" %% "case-app" % "2.0.0-M6"
def argonautShapeless = "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M11"
def caseAppAnnotations = "com.github.alexarchambault" %% "case-app-annotations" % Versions.caseApp
def caseApp = "com.github.alexarchambault" %% "case-app" % Versions.caseApp
def directories = "io.github.soc" % "directories" % "11"
def fs2 = "co.fs2" %% "fs2-core" % "1.0.4"
def fs2 = "co.fs2" %% "fs2-core" % "1.1.0-M1"
def jansi = "org.fusesource.jansi" % "jansi" % "1.18"
def jeromq = "org.zeromq" % "jeromq" % "0.5.1"
def jvmRepr = "com.github.jupyter" % "jvm-repr" % "0.4.0"
def metabrowseServer = "org.scalameta" %% "metabrowse-server" % "0.2.2"
def scalaReflect = setting("org.scala-lang" % "scala-reflect" % scalaVersion.value)
def scalaRx = "com.lihaoyi" %% "scalarx" % "0.4.0"
def scalatags = "com.lihaoyi" %% "scalatags" % "0.6.8"
def scalatags = setting {
val sv = scalaVersion.value
val ver =
if (sv.startsWith("2.11.")) "0.6.8"
else "0.7.0"
"com.lihaoyi" %% "scalatags" % ver
}
def slf4jNop = "org.slf4j" % "slf4j-nop" % "1.7.26"

def sparkSql20 = "org.apache.spark" %% "spark-sql" % "2.0.2" // no need to bump that version much, to ensure we don't rely on too new stuff
@@ -34,10 +46,10 @@ object Deps {
}

def utest = setting {
val sbv = scalaBinaryVersion.value
val sv = scalaVersion.value
val ver =
if (sbv == "2.13.0-M5") "0.6.6"
else "0.6.7"
if (sv.startsWith("2.11.")) "0.6.7"
else "0.6.9"
"com.lihaoyi" %% "utest" % ver
}

@@ -9,8 +9,8 @@ object Mima {
.replace("-RC", "-")
.forall(c => c == '.' || c == '-' || c.isDigit)

def binaryCompatibilityVersions: Set[String] =
Seq("git", "tag", "--merged", "HEAD^", "--contains", "v0.3.1")
def binaryCompatibilityVersions(contains: String): Set[String] =
Seq("git", "tag", "--merged", "HEAD^", "--contains", contains)
.!!
.linesIterator
.map(_.trim)
@@ -10,7 +10,7 @@ object Settings {

def scala211 = "2.11.12"
def scala212 = "2.12.8"
def scala213 = "2.13.0-M5"
def scala213 = "2.13.0"

lazy val isAtLeast212 = Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
@@ -49,7 +49,7 @@ object Settings {
}

lazy val shared = Seq(
scalaVersion := scala212,
scalaVersion := scala213,
crossScalaVersions := Seq(scala213, scala212, "2.12.7", "2.12.6", scala211),
scalacOptions ++= Seq(
// see http://tpolecat.github.io/2017/04/25/scalac-flags.html
@@ -183,7 +183,7 @@ object Settings {
lazy val exportVersionsSetting: Setting[_] = {
exportVersions := {
val ver = version.value
val ammoniteVer = Deps.Versions.ammonite
val ammoniteVer = Deps.Versions.ammonite.value
val scalaVer = scalaVersion.value
val outputDir = target.value

@@ -207,17 +207,14 @@ object Settings {

lazy val mima = Seq(
MimaPlugin.autoImport.mimaPreviousArtifacts := {
val sbv = scalaBinaryVersion.value
val isSimpleVersion = CrossVersion.partialVersion(sbv) match {
case Some((maj, min)) => s"$maj.$min" == sbv
case _ => true // ???
val sv = scalaVersion.value
val contains =
if (sv.startsWith("2.13.")) "4e9441b9"
else "v0.3.1"

Mima.binaryCompatibilityVersions(contains).map { ver =>
(organization.value % moduleName.value % ver).cross(crossVersion.value)
}
if (isSimpleVersion)
Mima.binaryCompatibilityVersions.map { ver =>
(organization.value % moduleName.value % ver).cross(crossVersion.value)
}
else
Set.empty
}
)

@@ -5,7 +5,9 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.."

export FORCE_SIMPLE_VERSION=1

sbt \
# let's switch back to the default scala version once the libs in the
# examples are fine with 2.13.0
sbt ++2.12.8 \
interpreter-api/exportVersions \
publishLocal

@@ -4,8 +4,10 @@ import java.nio.file._

import $file.website.Website, Website.{Mdoc, Relativize, Util}

val sbtCmd = Seq("sbt", "++2.12.8")

lazy val version = Util.cached("version") {
Util.outputOf(Seq("sbt", "export channels/version"))
Util.outputOf(sbtCmd ++ Seq("export channels/version"))
.linesIterator
.map(_.trim)
.filter(_.nonEmpty)
@@ -25,7 +27,7 @@ lazy val latestRelease = Util.cached("latest-release") {


lazy val scalaVersion = Util.cached("scala-version") {
Util.outputOf(Seq("sbt", "export channels/scalaVersion"))
Util.outputOf(sbtCmd ++ Seq("export channels/scalaVersion"))
.linesIterator
.map(_.trim)
.filter(_.nonEmpty)
@@ -34,7 +36,7 @@ lazy val scalaVersion = Util.cached("scala-version") {
}

lazy val ammoniteVersion = Util.cached("ammonite-version") {
Util.runCmd(Seq("sbt", "interpreter-api/exportVersions"))
Util.runCmd(sbtCmd ++ Seq("interpreter-api/exportVersions"))
new String(Files.readAllBytes(Paths.get("modules/shared/interpreter-api/target/ammonite-version")), "UTF-8").trim
}

@@ -66,7 +68,8 @@ def main(publishLocal: Boolean = false, npmInstall: Boolean = false, yarnRunBuil
assert(!(watch && relativize), "Cannot specify both --watch and --relativize")

if (publishLocal)
Util.runCmd(Seq("sbt", "set version in ThisBuild := \"" + version + "\"", "interpreter-api/publishLocal", "jupyter-api/publishLocal", "scala-kernel-api/publishLocal", "almond-spark/publishLocal"))
// Staying in scala 2.12 for mdoc for now
Util.runCmd(sbtCmd ++ Seq("set version in ThisBuild := \"" + version + "\"", "interpreter-api/publishLocal", "jupyter-api/publishLocal", "scala-kernel-api/publishLocal", "almond-spark/publishLocal"))

// be sure to adjust that
val websiteDir = new File("docs/website")

0 comments on commit 34c404a

Please sign in to comment.
You can’t perform that action at this time.