File: Quiet.scala

package info (click to toggle)
scala 2.11.12-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 62,828 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,250; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (31 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sbt._
import Keys._

object Quiet {
  // Workaround SBT issue described:
  //
  //   https://github.com/scala/scala-dev/issues/100
  def silenceScalaBinaryVersionWarning = ivyConfiguration := {
    ivyConfiguration.value match {
      case c: InlineIvyConfiguration =>
        val delegate = c.log
        val logger = new Logger {
          override def trace(t: => Throwable): Unit = delegate.trace(t)
          override def log(level: sbt.Level.Value, message: => String): Unit = {
            level match {
              case sbt.Level.Warn =>
                val message0 = message
                val newLevel = if (message.contains("differs from Scala binary version in project"))
                  delegate.log(sbt.Level.Debug, message)
                else
                  delegate.log(level, message)
              case _ => delegate.log(level, message)
            }
          }
          override def success(message: => String): Unit = delegate.success(message)
        }
        new InlineIvyConfiguration(c.paths, c.resolvers, c.otherResolvers, c.moduleConfigurations, c.localOnly, c.lock, c.checksums, c.resolutionCacheDir, c.updateOptions, logger)
      case x => x
    }
  }
}