Merge pull request #178 from eed3si9n/wip/fatal-warnings

-Xfatal-warnings
This commit is contained in:
eugene yokota 2018-09-20 01:42:32 -04:00 committed by GitHub
commit 7f9ffb7e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 24 additions and 23 deletions

View File

@ -14,15 +14,6 @@ def commonSettings: Seq[Setting[_]] = Seq(
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
crossScalaVersions := Seq(scala211, scala212),
scalacOptions := {
val old = scalacOptions.value
scalaVersion.value match {
case sv if sv.startsWith("2.10") =>
old diff List("-Xfuture", "-Ywarn-unused", "-Ywarn-unused-import")
case sv if sv.startsWith("2.11") => old ++ List("-Ywarn-unused", "-Ywarn-unused-import")
case _ => old ++ List("-Ywarn-unused", "-Ywarn-unused-import", "-YdisableFlatCpCaching")
}
},
scalacOptions in console in Compile -= "-Ywarn-unused-import",
scalacOptions in console in Test -= "-Ywarn-unused-import",
publishArtifact in Compile := true,
@ -110,8 +101,13 @@ lazy val utilLogging = (project in internalPath / "util-logging")
crossScalaVersions := Seq(scala210, scala211, scala212),
name := "Util Logging",
libraryDependencies ++=
Seq(jline, log4jApi, log4jCore, disruptor, sjsonnewScalaJson.value, scalaReflect.value),
Seq(jline, log4jApi, log4jCore, disruptor, sjsonnewScalaJson.value, scalaReflect.value,
compilerPlugin(silencerPlugin), silencerLib),
libraryDependencies ++= Seq(scalaCheck, scalaTest),
Compile / scalacOptions ++= (scalaVersion.value match {
case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates")
case _ => List()
}),
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
contrabandFormatsForType in generateContrabands in Compile := { tpe =>
val old = (contrabandFormatsForType in generateContrabands in Compile).value

View File

@ -4,13 +4,14 @@
package sbt.internal.util
import sbt.util._
import com.github.ghik.silencer.silent
/**
* A filter logger is used to delegate messages but not the logging level to another logger. This means
* that messages are logged at the higher of the two levels set by this logger and its delegate.
*/
class FilterLogger(delegate: AbstractLogger) extends BasicLogger {
override lazy val ansiCodesSupported = delegate.ansiCodesSupported
@silent override lazy val ansiCodesSupported = delegate.ansiCodesSupported
def trace(t: => Throwable): Unit = {
if (traceEnabled)
delegate.trace(t)

View File

@ -4,11 +4,12 @@
package sbt.internal.util
import sbt.util._
import com.github.ghik.silencer.silent
/** Promotes the simple Logger interface to the full AbstractLogger interface. */
class FullLogger(delegate: Logger) extends BasicLogger {
@deprecated("No longer used.", "1.0.0")
override val ansiCodesSupported: Boolean = delegate.ansiCodesSupported
@silent override val ansiCodesSupported: Boolean = delegate.ansiCodesSupported
def trace(t: => Throwable): Unit = {
if (traceEnabled)

View File

@ -4,13 +4,14 @@
package sbt.internal.util
import sbt.util._
import com.github.ghik.silencer.silent
// note that setting the logging level on this logger has no effect on its behavior, only
// on the behavior of the delegates.
class MultiLogger(delegates: List[AbstractLogger]) extends BasicLogger {
@deprecated("No longer used.", "1.0.0")
override lazy val ansiCodesSupported = delegates exists supported
private[this] def supported = (_: AbstractLogger).ansiCodesSupported
@silent private[this] def supported = (_: AbstractLogger).ansiCodesSupported
override def setLevel(newLevel: Level.Value): Unit = {
super.setLevel(newLevel)

View File

@ -1,5 +1,7 @@
package sbt.internal.util
import scala.language.experimental.macros
sealed trait SourcePosition
sealed trait FilePosition extends SourcePosition {
@ -22,7 +24,6 @@ final case class RangePosition(path: String, range: LineRange) extends FilePosit
object SourcePosition {
/** Creates a SourcePosition by using the enclosing position of the invocation of this method.
* @see [[scala.reflect.macros.Enclosures#enclosingPosition]]
* @return SourcePosition
*/
def fromEnclosing(): SourcePosition = macro SourcePositionMacro.fromEnclosingImpl

View File

@ -7,7 +7,7 @@ object Dependencies {
val scala211 = "2.11.12"
val scala212 = "2.12.6"
private val ioVersion = "1.2.0"
private val ioVersion = "1.2.1"
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
@ -58,4 +58,6 @@ object Dependencies {
val log4jApi = "org.apache.logging.log4j" % "log4j-api" % log4jVersion
val log4jCore = "org.apache.logging.log4j" % "log4j-core" % log4jVersion
val disruptor = "com.lmax" % "disruptor" % "3.3.6"
val silencerPlugin = "com.github.ghik" %% "silencer-plugin" % "1.2"
val silencerLib = "com.github.ghik" %% "silencer-lib" % "1.2" % Provided
}

View File

@ -1 +1 @@
sbt.version=1.2.1
sbt.version=1.2.3

View File

@ -1,3 +1,3 @@
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.7")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.0")
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.8")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.1")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.9")

View File

@ -4,7 +4,6 @@
package sbt.util
import java.io.File
import java.io.FileNotFoundException
import scala.util.control.NonFatal
import sbt.io.{ Hash, IO }
import sjsonnew.{ Builder, JsonFormat, Unbuilder, deserializationError }

View File

@ -46,7 +46,7 @@ class CacheSpec extends FlatSpec {
}
cache(store)("someKey") match {
case Hit(read) => assert(read === value)
case Hit(read) => assert(read === value); ()
case Miss(_) => fail
}
}
@ -63,7 +63,7 @@ class CacheSpec extends FlatSpec {
}
cache(store)(key) match {
case Hit(read) => assert(read === value)
case Hit(read) => assert(read === value); ()
case Miss(_) => fail
}
}

View File

@ -69,7 +69,7 @@ class SingletonCacheSpec extends FlatSpec {
cache.write(store, value)
val read = cache.read(store)
assert(read === value)
assert(read === value); ()
}
}
@ -80,7 +80,7 @@ class SingletonCacheSpec extends FlatSpec {
cache.write(store, value)
val read = cache.read(store)
assert(read === value)
assert(read === value); ()
}
}