mirror of https://github.com/sbt/sbt.git
Use nowarn annotation
This commit is contained in:
parent
61056e17b3
commit
22d12f6618
26
build.sbt
26
build.sbt
|
|
@ -106,16 +106,12 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings(
|
|||
crossScalaVersions := List(scala212, scala213),
|
||||
publishArtifact in Test := false,
|
||||
fork in run := true,
|
||||
libraryDependencies ++= {
|
||||
if (autoScalaLibrary.value) List(silencerLib)
|
||||
else Nil
|
||||
},
|
||||
)
|
||||
def commonSettings: Seq[Setting[_]] =
|
||||
commonBaseSettings :+
|
||||
addCompilerPlugin(kindProjector)
|
||||
def utilCommonSettings: Seq[Setting[_]] =
|
||||
commonBaseSettings :+ (crossScalaVersions := (scala212 :: scala213 :: Nil))
|
||||
baseSettings :+ (crossScalaVersions := (scala212 :: scala213 :: Nil))
|
||||
|
||||
def minimalSettings: Seq[Setting[_]] =
|
||||
commonSettings ++ customCommands ++
|
||||
|
|
@ -329,10 +325,6 @@ val logicProj = (project in file("internal") / "util-logic")
|
|||
testedBaseSettings,
|
||||
name := "Logic",
|
||||
mimaSettings,
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||
case _ => List()
|
||||
}),
|
||||
)
|
||||
|
||||
// defines Java structures used across Scala versions, such as the API structures and relationships extracted by
|
||||
|
|
@ -382,10 +374,6 @@ lazy val utilLogging = (project in file("internal") / "util-logging")
|
|||
scalaReflect.value
|
||||
),
|
||||
libraryDependencies ++= Seq(scalacheck % "test", scalatest % "test"),
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||
case _ => List()
|
||||
}),
|
||||
Compile / scalacOptions ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates")
|
||||
case _ => List()
|
||||
|
|
@ -622,10 +610,6 @@ lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux"))
|
|||
baseSettings,
|
||||
name := "Scripted sbt Redux",
|
||||
libraryDependencies ++= Seq(launcherInterface % "provided"),
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||
case _ => List()
|
||||
}),
|
||||
mimaSettings,
|
||||
scriptedSbtReduxMimaSettings,
|
||||
)
|
||||
|
|
@ -753,10 +737,6 @@ lazy val commandProj = (project in file("main-command"))
|
|||
testedBaseSettings,
|
||||
name := "Command",
|
||||
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi),
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||
case _ => List()
|
||||
}),
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
managedSourceDirectories in Compile +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -932,10 +912,6 @@ lazy val mainProj = (project in file("main"))
|
|||
case v if v.startsWith("2.12.") => List()
|
||||
case _ => List(scalaPar)
|
||||
}),
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||
case _ => List()
|
||||
}),
|
||||
managedSourceDirectories in Compile +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import sbt.util._
|
||||
import com.github.ghik.silencer.silent
|
||||
import scala.annotation.nowarn
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
@silent override lazy val ansiCodesSupported = delegate.ansiCodesSupported
|
||||
@nowarn override lazy val ansiCodesSupported = delegate.ansiCodesSupported
|
||||
def trace(t: => Throwable): Unit = {
|
||||
if (traceEnabled)
|
||||
delegate.trace(t)
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import sbt.util._
|
||||
import com.github.ghik.silencer.silent
|
||||
import scala.annotation.nowarn
|
||||
|
||||
// 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
|
||||
@silent private[this] def supported = (_: AbstractLogger).ansiCodesSupported
|
||||
@nowarn private[this] def supported = (_: AbstractLogger).ansiCodesSupported
|
||||
|
||||
override def setLevel(newLevel: Level.Value): Unit = {
|
||||
super.setLevel(newLevel)
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@ import org.scalatest._
|
|||
import sbt.util._
|
||||
import java.io.{ File, PrintWriter }
|
||||
import sbt.io.Using
|
||||
import com.github.ghik.silencer.silent
|
||||
import scala.annotation.nowarn
|
||||
|
||||
class ManagedLoggerSpec extends FlatSpec with Matchers {
|
||||
val context = LoggerContext(useLog4J = true)
|
||||
@silent
|
||||
@nowarn
|
||||
val asyncStdout = new ConsoleAppenderFromLog4J("asyncStdout", LogExchange.asyncStdout)
|
||||
def newLogger(name: String): ManagedLogger = context.logger(name, None, None)
|
||||
"ManagedLogger" should "log to console" in {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
package sbt.internal.util
|
||||
package logic
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.annotation.{ nowarn, tailrec }
|
||||
import Formula.{ And, True }
|
||||
|
||||
/*
|
||||
|
|
@ -152,7 +152,7 @@ object Logic {
|
|||
if (contradictions.nonEmpty) Some(new InitialContradictions(contradictions)) else None
|
||||
}
|
||||
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
private[this] def checkAcyclic(clauses: Clauses): Option[CyclicNegation] = {
|
||||
val deps = dependencyMap(clauses)
|
||||
// println(s"deps = $deps")
|
||||
|
|
|
|||
|
|
@ -11,13 +11,14 @@ package compiler
|
|||
import scala.language.reflectiveCalls
|
||||
import org.scalacheck._
|
||||
import Prop._
|
||||
import scala.tools.nsc.Settings
|
||||
import scala.tools.nsc.reporters.StoreReporter
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
class EvalTest extends Properties("eval") {
|
||||
private[this] lazy val reporter = new StoreReporter
|
||||
import reporter.{ ERROR, Info }
|
||||
private[this] lazy val reporter = new StoreReporter(new Settings())
|
||||
import reporter.ERROR
|
||||
private[this] lazy val eval = new Eval(_ => reporter, None)
|
||||
|
||||
property("inferred integer") = forAll { (i: Int) =>
|
||||
|
|
@ -100,7 +101,7 @@ val p = {
|
|||
("Has errors" |: is.nonEmpty) &&
|
||||
all(is.toSeq.map(validPosition(line, src)): _*)
|
||||
}
|
||||
private[this] def validPosition(line: Int, src: String)(i: Info) = {
|
||||
private[this] def validPosition(line: Int, src: String)(i: StoreReporter.Info) = {
|
||||
val nme = i.pos.source.file.name
|
||||
(label("Severity", i.severity) |: (i.severity == ERROR)) &&
|
||||
(label("Line", i.pos.line) |: (i.pos.line == line)) &&
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ package sbt
|
|||
|
||||
import java.io.File
|
||||
|
||||
import com.github.ghik.silencer.silent
|
||||
import sbt.internal.inc.classpath.{ ClassLoaderCache => IncClassLoaderCache }
|
||||
import sbt.internal.classpath.ClassLoaderCache
|
||||
import sbt.internal.server.ServerHandler
|
||||
import sbt.internal.util.AttributeKey
|
||||
import sbt.librarymanagement.ModuleID
|
||||
import sbt.util.Level
|
||||
import scala.annotation.nowarn
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
object BasicKeys {
|
||||
|
|
@ -41,7 +41,7 @@ object BasicKeys {
|
|||
"The function that constructs the command prompt from the current build state for a given terminal.",
|
||||
10000
|
||||
)
|
||||
@silent val watch =
|
||||
@nowarn val watch =
|
||||
AttributeKey[Watched]("watched", "Continuous execution configuration.", 1000)
|
||||
val serverPort =
|
||||
AttributeKey[Int]("server-port", "The port number used by server command.", 10000)
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ import sjsonnew.support.scalajson.unsafe.Converter
|
|||
import xsbti.compile.TastyFiles
|
||||
import xsbti.{ FileConverter, Position }
|
||||
|
||||
import scala.annotation.nowarn
|
||||
import scala.collection.immutable.ListMap
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.Try
|
||||
|
|
@ -4083,7 +4084,7 @@ object Classpaths {
|
|||
ivyRepo.allowInsecureProtocol
|
||||
} catch { case _: NoSuchMethodError => false }
|
||||
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
private[this] def bootRepository(repo: xsbti.Repository): Resolver = {
|
||||
import xsbti.Predefined
|
||||
repo match {
|
||||
|
|
@ -4346,7 +4347,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
|||
// I tried "Def.spaceDelimited().parsed" (after importing Def.parserToInput)
|
||||
// but it broke actions/run-task
|
||||
// Maybe it needs to be defined inside a Def.inputTask?
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
def inputTask[T](f: TaskKey[Seq[String]] => Initialize[Task[T]]): Initialize[InputTask[T]] =
|
||||
InputTask.apply(Def.value((s: State) => Def.spaceDelimited()))(f)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import sbt.librarymanagement.{ Resolver, UpdateReport }
|
|||
import sbt.std.Transform.DummyTaskMap
|
||||
import sbt.util.{ Logger, Show }
|
||||
|
||||
import scala.annotation.nowarn
|
||||
import scala.Console.RED
|
||||
import scala.concurrent.duration.Duration
|
||||
|
||||
|
|
@ -154,7 +155,7 @@ object EvaluateTask {
|
|||
import Keys.state
|
||||
import std.Transform
|
||||
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
lazy private val sharedProgress = new TaskTimings(reportOnShutdown = true)
|
||||
def taskTimingProgress: Option[ExecuteProgress[Task]] =
|
||||
if (SysProp.taskTimingsOnShutdown) Some(sharedProgress)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import sbt.io.syntax._
|
|||
import sbt.util.{ Level, Logger, Show }
|
||||
import xsbti.compile.CompilerCache
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.annotation.{ nowarn, tailrec }
|
||||
import scala.concurrent.ExecutionContext
|
||||
import scala.concurrent.duration.Duration
|
||||
import scala.util.control.NonFatal
|
||||
|
|
@ -271,7 +271,7 @@ object BuiltinCommands {
|
|||
def ScriptCommands: Seq[Command] =
|
||||
Seq(ignore, exit, Script.command, setLogLevel, early, act, nop)
|
||||
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
def DefaultCommands: Seq[Command] =
|
||||
Seq(
|
||||
multi,
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@
|
|||
|
||||
package sbt.internal
|
||||
|
||||
import scala.annotation.nowarn
|
||||
|
||||
// https://github.com/scala/scala-parallel-collections/issues/22
|
||||
private[sbt] object CompatParColls {
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
val Converters = {
|
||||
import Compat._
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,13 +11,14 @@ package internal
|
|||
import java.nio.file.Path
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
import com.github.ghik.silencer.silent
|
||||
import sbt.{ ProjectRef, State, Watched }
|
||||
import sbt.internal.io.{ EventMonitor, Source, WatchState => WS }
|
||||
import sbt.internal.util.AttributeKey
|
||||
import sbt.nio.file.Glob
|
||||
|
||||
@silent
|
||||
import scala.annotation.nowarn
|
||||
|
||||
@nowarn
|
||||
private[internal] trait DeprecatedContinuous {
|
||||
protected type StartMessage =
|
||||
Option[Either[WS => String, (Int, ProjectRef, Seq[String]) => Option[String]]]
|
||||
|
|
@ -59,7 +60,7 @@ private[internal] trait DeprecatedContinuous {
|
|||
}
|
||||
}
|
||||
|
||||
@silent
|
||||
@nowarn
|
||||
private[sbt] object DeprecatedContinuous {
|
||||
private[sbt] val taskDefinitions: Seq[Def.Setting[_]] = Seq(
|
||||
sbt.Keys.watchTransitiveSources := sbt.Defaults.watchTransitiveSourcesTask.value,
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ import sbt.internal.util.complete.DefaultParsers.validID
|
|||
import sbt.internal.util.Types.some
|
||||
import sbt.internal.util.{ AttributeKey, Relation }
|
||||
import sbt.librarymanagement.Configuration
|
||||
import scala.annotation.nowarn
|
||||
|
||||
object KeyIndex {
|
||||
def empty: ExtendableKeyIndex = new KeyIndex0(emptyBuildIndex)
|
||||
@com.github.ghik.silencer.silent
|
||||
|
||||
@nowarn
|
||||
def apply(
|
||||
known: Iterable[ScopedKey[_]],
|
||||
projects: Map[URI, Set[String]],
|
||||
|
|
@ -26,7 +28,8 @@ object KeyIndex {
|
|||
import sbt.internal.CompatParColls.Converters._
|
||||
known.par.foldLeft(base(projects, configurations)) { _ add _ }
|
||||
}
|
||||
@com.github.ghik.silencer.silent
|
||||
|
||||
@nowarn
|
||||
def aggregate(
|
||||
known: Iterable[ScopedKey[_]],
|
||||
extra: BuildUtil[_],
|
||||
|
|
|
|||
|
|
@ -16,11 +16,10 @@ import java.net.URI
|
|||
import graph.{ Module, ModuleGraph }
|
||||
import sbt.io.IO
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.annotation.{ nowarn, tailrec }
|
||||
import scala.util.parsing.json.{ JSONArray, JSONObject }
|
||||
import com.github.ghik.silencer.silent
|
||||
|
||||
@silent object TreeView {
|
||||
@nowarn object TreeView {
|
||||
def createJson(graph: ModuleGraph): String = {
|
||||
val trees = graph.roots
|
||||
.map(module => processSubtree(graph, module))
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ package server
|
|||
import java.net.URI
|
||||
import java.nio.file._
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.annotation.{ nowarn, tailrec }
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.concurrent.{ ExecutionContext, Future }
|
||||
import scala.reflect.NameTransformer
|
||||
|
|
@ -259,7 +259,7 @@ private[sbt] object Definition {
|
|||
result.future
|
||||
}
|
||||
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
def lspDefinition(
|
||||
jsonDefinition: JValue,
|
||||
requestId: String,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import sbt.nio.file.{ AllPass, FileAttributes, Glob, RecursiveGlob }
|
|||
import sbt.std.TaskExtra._
|
||||
import sjsonnew.JsonFormat
|
||||
|
||||
import scala.annotation.nowarn
|
||||
import scala.collection.immutable.VectorBuilder
|
||||
|
||||
private[sbt] object Settings {
|
||||
|
|
@ -269,7 +270,7 @@ private[sbt] object Settings {
|
|||
* @return a task definition that retrieves the input files and their file stamps scoped to the
|
||||
* input key.
|
||||
*/
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
private[sbt] def fileStamps(scopedKey: Def.ScopedKey[_]): Def.Setting[_] = {
|
||||
import sbt.internal.CompatParColls.Converters._
|
||||
val scope = scopedKey.scope
|
||||
|
|
|
|||
|
|
@ -114,7 +114,5 @@ object Dependencies {
|
|||
|
||||
val hedgehog = "qa.hedgehog" %% "hedgehog-sbt" % "0.6.1"
|
||||
val disruptor = "com.lmax" % "disruptor" % "3.4.2"
|
||||
val silencerPlugin = ("com.github.ghik" % "silencer-plugin" % "1.7.1").cross(CrossVersion.full)
|
||||
val silencerLib = ("com.github.ghik" % "silencer-lib" % "1.7.1").cross(CrossVersion.full)
|
||||
val kindProjector = ("org.typelevel" % "kind-projector" % "0.11.3").cross(CrossVersion.full)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ object Util {
|
|||
"-language:existentials",
|
||||
"-language:postfixOps",
|
||||
"-Yrangepos",
|
||||
"-Wconf:cat=unused-nowarn:s",
|
||||
),
|
||||
Compile / doc / scalacOptions -= "-Xlint",
|
||||
Compile / doc / scalacOptions -= "-Xfatal-warnings",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import sbt.internal.io.Resources
|
|||
import sbt.internal.scripted._
|
||||
import RemoteSbtCreatorProp._
|
||||
|
||||
import scala.annotation.nowarn
|
||||
import scala.collection.parallel.ForkJoinTaskSupport
|
||||
import scala.collection.{ GenSeq, mutable }
|
||||
import scala.util.control.NonFatal
|
||||
|
|
@ -482,7 +483,7 @@ class ScriptedRunner {
|
|||
instances: Int
|
||||
) = run(baseDir, bufferLog, tests, logger, launchOpts, prescripted, prop, instances, true)
|
||||
|
||||
@com.github.ghik.silencer.silent
|
||||
@nowarn
|
||||
private[this] def run(
|
||||
baseDir: File,
|
||||
bufferLog: Boolean,
|
||||
|
|
|
|||
Loading…
Reference in New Issue