diff --git a/.travis.yml b/.travis.yml index baba3f965..c1f30d82f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,30 +1,31 @@ -sudo: false language: scala -dist: trusty # https://travis-ci.community/t/error-installing-oraclejdk8-expected-feature-release-number-in-range-of-9-to-14-but-got-8/3766/7 scala: - 2.11.12 - 2.12.10 - 2.13.1 jdk: - - oraclejdk8 + - openjdk8 - openjdk11 + - openjdk12 env: global: - ENCRYPTION_ID: "9eb27d59440e" before_script: - echo "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG, TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST, TRAVIS_BRANCH=$TRAVIS_BRANCH" +# caching scala stuff based on +# https://www.scala-sbt.org/1.x/docs/Travis-CI-with-sbt.html +before_cache: + # Tricks to avoid unnecessary cache updates + - rm -fv $HOME/.ivy2/.sbt.ivy.lock + - find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete + - find $HOME/.sbt -name "*.lock" -print -delete cache: directories: - # caching scala stuff based on - # http://www.scala-sbt.org/0.13/docs/Travis-CI-with-sbt.html#%28Experimental%29+Reusing+Ivy+cache + - $HOME/.cache/coursier - $HOME/.ivy2/cache - - $HOME/.sbt/boot/ + - $HOME/.sbt script: - scripts/ci-build - # cleanup travis trick from - # http://www.scala-sbt.org/0.13/docs/Travis-CI-with-sbt.html#%28Experimental%29+Reusing+Ivy+cache - - find $HOME/.sbt -name "*.lock" -delete - - find $HOME/.ivy2 -name "ivydata-*.properties" -delete after_success: - scripts/api-doc - scripts/coveralls diff --git a/project/BuildSettings.scala b/project/BuildSettings.scala index f23a6069c..d47df4dff 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -30,28 +30,57 @@ import sbtunidoc.ScalaUnidocPlugin.autoImport._ object BasicSettings extends AutoPlugin { override def trigger = allRequirements + val `scalacOptions2.11.x` = Seq( + "-Ywarn-adapted-args", + "-Ywarn-inaccessible", + "-Ywarn-infer-any", + "-Ywarn-nullary-override", + "-Ywarn-dead-code", + "-Ywarn-nullary-unit", + "-Ywarn-numeric-widen", + "-Xmax-classfile-name", "254", + "-language:higherKinds" + ) + + val `scalacOptions2.12.x` = Seq( + "-Xlint:adapted-args", + "-Ywarn-inaccessible", + "-Ywarn-infer-any", + "-Xlint:nullary-override", + "-Xlint:nullary-unit", + "-Xmax-classfile-name", "254", + "-language:higherKinds" + ) + + val `scalacOptions2.13.x` = Seq( + "-Xlint:adapted-args", + "-Xlint:inaccessible", + "-Xlint:infer-any", + "-Xlint:nullary-override", + "-Xlint:nullary-unit" + ) + + val scalacOptionsCommon = Seq( + "-unchecked", + "-deprecation", + "-feature", + "-encoding", "utf8", + "-Xfatal-warnings", + "-Xlint" + ) + override def projectSettings = Seq( organization := "com.mohiva", version := "6.1.1", resolvers ++= Dependencies.resolvers, - scalaVersion := Dependencies.Versions.scalaVersion, - crossScalaVersions := Dependencies.Versions.crossScala, - scalacOptions ++= Seq( - "-deprecation", // Emit warning and location for usages of deprecated APIs. - "-feature", // Emit warning and location for usages of features that should be imported explicitly. - "-unchecked", // Enable additional warnings where generated code depends on assumptions. - "-Xfatal-warnings", // Fail the compilation if there are any warnings. - "-Xlint", // Enable recommended additional warnings., - "-Xlint:inaccessible", // Warn about inaccessible types in method signatures. - "-Ywarn-dead-code", // Warn when dead code is identified. - "-Ywarn-numeric-widen" // Warn when numerics are widened. - ), + scalaVersion := "2.13.1", + crossVersion := CrossVersion.full, scalacOptions ++= { - if(Util.priorTo213(scalaVersion.value)) Seq( - "-language:higherKinds", - "-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver. - "-Ywarn-nullary-override" // Warn when non-nullary overrides nullary, e.g. def foo() over def foo. - ) else Nil + scalacOptionsCommon ++ (scalaBinaryVersion.value match { + case "2.11" => `scalacOptions2.11.x` + case "2.12" => `scalacOptions2.12.x` + case "2.13" => `scalacOptions2.13.x` + }) }, scalacOptions in Test ~= { options: Seq[String] => options filterNot (_ == "-Ywarn-dead-code") // Allow dead code in tests (to support using mockito). @@ -214,12 +243,14 @@ object Publish extends AutoPlugin { ) } +////******************************* +//// Helpers +////******************************* object Util { - def priorTo213(scalaVersion: String): Boolean = CrossVersion.partialVersion(scalaVersion) match { case Some((2, minor)) if minor < 13 => true case _ => false } - } + diff --git a/project/Dependencies.scala b/project/Dependencies.scala index bc1ff5b69..08bea52a8 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -16,12 +16,6 @@ import sbt._ object Dependencies { - - object Versions { - val crossScala = Seq("2.13.1", "2.12.10", "2.11.12") - val scalaVersion = crossScala.head - } - val resolvers = Seq( "Atlassian Releases" at "https://maven.atlassian.com/public/" ) diff --git a/project/build.properties b/project/build.properties index 133a8f197..8e682c526 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.17 +sbt.version=0.13.18 diff --git a/project/plugins.sbt b/project/plugins.sbt index 819a7a631..8daf6d427 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,7 +3,7 @@ logLevel := Level.Warn addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.3") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") @@ -18,3 +18,5 @@ addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.2") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.3") + +addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.2.0")