Update Scala version.

This commit is contained in:
Greg Burd 2019-09-25 12:14:54 -04:00
parent c94ce2c952
commit 8a83f70fc7
5 changed files with 137 additions and 16 deletions

36
.gitignore vendored Normal file
View file

@ -0,0 +1,36 @@
stasis-test/original/
*.class
*.log
gh-pages/
.secrets
idea/
.bloop
.metals
repos.tar.gz
# sbt specific
.cache
.history
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
# Scala-IDE specific
.scala_dependencies
.worksheet
.idea
.idea.bak/
intellij/out
*~
docs/xx.md

View file

@ -2,10 +2,73 @@ import Dependencies._
def scala211 = "2.11.12" def scala211 = "2.11.12"
def scala212 = "2.12.9" def scala212 = "2.12.9"
def scala213 = "2.13" def scala213 = "2.13.1"
organization := "io.stasis"
name := "stasis" name := "stasis"
def scalacOptionsForVersion(version: String): Seq[String] = {
// format: off
val defaultOpts = Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding", "utf-8", // Specify character encoding used by source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
"-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:nullary-unit", // Warn when nullary methods return Unit.
"-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object.
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused.
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused.
)
val versionOpts: Seq[String] = CrossVersion.partialVersion(version) match {
case Some((2, major)) if major < 13 => Seq(
"-Xlint:by-name-right-associative", // By-name parameter of right associative operator.
"-Xlint:unsound-match", // Pattern match may not be typesafe.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
"-Xfuture", // Turn on future language features.
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
"-Ypartial-unification", // Enable partial unification in type constructor inference
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
)
case _ => Seq()
}
defaultOpts ++ versionOpts
// format: on
}
addCompilerPlugin(
("org.typelevel" %% "kind-projector" % "0.10.3").cross(CrossVersion.binary),
)
inThisBuild( inThisBuild(
Seq( Seq(
organization := "io.stasis", organization := "io.stasis",
@ -22,14 +85,10 @@ inThisBuild(
url("https://greg.burd.me") url("https://greg.burd.me")
) )
), ),
scalaVersion := scala212, scalaVersion := scala213,
crossScalaVersions := List(scala213, scala212, scala211), crossScalaVersions := List(scala213, scala212, scala211),
resolvers += Resolver.sonatypeRepo("releases"), resolvers += Resolver.sonatypeRepo("releases"),
scalacOptions ++= Seq( scalacOptions ++= scalacOptionsForVersion(scalaVersion.value),
"-unchecked"
, "-deprecation"
// , "-Xfatal-warnings"
),
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
scalatest.value % Test, scalatest.value % Test,
scalacheck % Test, scalacheck % Test,
@ -196,3 +255,9 @@ lazy val buildInfoSettings: Seq[Def.Setting[_]] = Seq(
buildInfoPackage := "io.stasis", buildInfoPackage := "io.stasis",
buildInfoObject := "Versions" buildInfoObject := "Versions"
) )
// Filter out compiler flags to make the repl experience functional...
val badConsoleFlags = Seq("-Xfatal-warnings", "-Ywarn-unused:imports")
scalacOptions in (Compile, console) ~= (_.filterNot(badConsoleFlags.contains(_)))
enablePlugins(ScalafmtPlugin, JavaAppPackaging, GhpagesPlugin, MicrositesPlugin, TutPlugin)

View file

@ -5,9 +5,9 @@ import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
object Dependencies { object Dependencies {
val metaconfigV = "0.8.3" val metaconfigV = "0.8.3"
val scalametaV = "4.0.0" val scalametaV = "4.2.3"
val scalatestV = "3.2.0-SNAP10" val scalatestV = "3.2.0-M1"
val scalacheckV = "1.13.5" val scalacheckV = "1.14.1"
val coursier = "1.0.3" val coursier = "1.0.3"
val scalapb = Def.setting { val scalapb = Def.setting {

View file

@ -1 +1 @@
sbt.version = 1.2.8 sbt.version = 1.3.2

View file

@ -2,20 +2,40 @@ logLevel := Level.Warn
resolvers ++= Seq( resolvers ++= Seq(
Classpaths.sbtPluginReleases, Classpaths.sbtPluginReleases,
"Local Maven Repository" at Path.userHome.asFile.toURI.toURL + ".m2/repository",
"Local Ivy2 Cache Repository" at Path.userHome.asFile.toURI.toURL + ".ivy2/cache",
Resolver.sonatypeRepo("snapshots"),
Resolver.typesafeRepo("releases"), Resolver.typesafeRepo("releases"),
Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("releases"),
Resolver.bintrayIvyRepo("jetbrains", "sbt-plugins") Resolver.bintrayIvyRepo("jetbrains", "sbt-plugins")
) )
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.7")
// Use the Dotty compiler for Scala code.
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.4")
// Makes our code tidy
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.5")
// Revolver allows us to use re-start and work a lot faster!
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
// Native Packager allows us to create standalone jar
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.4.1")
// Documentation plugins
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.12")
addSbtPlugin("com.47deg" % "sbt-microsites" % "0.9.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "1.2.7") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "1.2.7")
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.6.0-RC4")
// Other, TBD
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.4")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.7")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2") addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3") //coursier.util.Properties.version) // "2.0.0-RC2-3" addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3") //coursier.util.Properties.version) // "2.0.0-RC2-3"
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.7") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.7")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.18") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.18")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.4")