mirror of https://github.com/sbt/sbt.git
Adapt -Wunused
This commit is contained in:
parent
95a82adffc
commit
0458e8063d
13
build.sbt
13
build.sbt
|
|
@ -368,10 +368,7 @@ lazy val utilLogging = (project in file("internal") / "util-logging")
|
|||
),
|
||||
libraryDependencies ++= Seq(scalacheck % "test", scalatest % "test"),
|
||||
Compile / generateContrabands / contrabandCodecsDependencies := List(sjsonNewCore.value),
|
||||
Compile / scalacOptions ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates")
|
||||
case _ => List()
|
||||
}),
|
||||
Compile / scalacOptions ++= Seq("-Wunused:imports,implicits,nowarn"),
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -479,7 +476,7 @@ lazy val testingProj = (project in file("testing"))
|
|||
sjsonNewScalaJson.value,
|
||||
sjsonNewCore.value,
|
||||
),
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
Compile / scalacOptions += "-Wunused:imports,implicits,nowarn",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -576,7 +573,7 @@ lazy val runProj = (project in file("run"))
|
|||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Run",
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
Compile / scalacOptions += "-Wunused:imports,implicits,nowarn",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -699,7 +696,7 @@ lazy val protocolProj = (project in file("protocol"))
|
|||
testedBaseSettings,
|
||||
name := "Protocol",
|
||||
libraryDependencies ++= Seq(sjsonNewScalaJson.value, sjsonNewCore.value, ipcSocket),
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
Compile / scalacOptions += "-Wunused:imports,implicits,nowarn",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
@ -746,7 +743,7 @@ lazy val commandProj = (project in file("main-command"))
|
|||
sjsonNewScalaJson.value,
|
||||
templateResolverApi
|
||||
),
|
||||
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||
Compile / scalacOptions += "-Wunused:imports,implicits,nowarn",
|
||||
Compile / managedSourceDirectories +=
|
||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
Compile / generateContrabands / sourceManaged := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||
|
|
|
|||
|
|
@ -13,11 +13,9 @@ import sbt.util._
|
|||
import sbt.internal.util.appmacro.StringTypeTag
|
||||
import java.io.{ File, PrintWriter }
|
||||
import sbt.io.Using
|
||||
import scala.annotation.nowarn
|
||||
|
||||
class ManagedLoggerSpec extends AnyFlatSpec with Matchers {
|
||||
val context = LoggerContext()
|
||||
@nowarn
|
||||
// TODO create a new appender for testing purposes - 3/12/21
|
||||
val asyncStdout = ConsoleAppender()
|
||||
def newLogger(name: String): ManagedLogger = context.logger(name, None, None)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import sbt.internal.inc.ModuleUtilities
|
|||
import sbt.internal.client.NetworkClient
|
||||
import DefaultParsers._
|
||||
|
||||
import Function.tupled
|
||||
import Command.applyEffect
|
||||
import BasicCommandStrings._
|
||||
import CommandUtil._
|
||||
|
|
@ -35,7 +34,6 @@ import BasicKeys._
|
|||
import java.io.File
|
||||
|
||||
import sbt.io.IO
|
||||
import sbt.util.Level
|
||||
|
||||
import scala.Function.tupled
|
||||
import scala.collection.mutable.ListBuffer
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import sbt.util.{ ActionCacheStore, Level }
|
|||
import scala.annotation.nowarn
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
import xsbti.VirtualFile
|
||||
import sbt.librarymanagement.Configuration
|
||||
|
||||
object BasicKeys {
|
||||
val historyPath = AttributeKey[Option[File]](
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
|
|||
import java.util.concurrent.{ ConcurrentHashMap, LinkedBlockingQueue, TimeUnit }
|
||||
|
||||
import sbt.BasicCommandStrings.{ DashDashDetachStdio, DashDashServer, Shutdown, TerminateAction }
|
||||
import sbt.internal.client.NetworkClient.Arguments
|
||||
import sbt.internal.langserver.{ LogMessageParams, MessageType, PublishDiagnosticsParams }
|
||||
import sbt.internal.protocol._
|
||||
import sbt.internal.util.{ ConsoleAppender, ConsoleOut, Signals, Terminal, Util }
|
||||
|
|
|
|||
|
|
@ -433,6 +433,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
}
|
||||
}
|
||||
|
||||
@nowarn
|
||||
private def getFileEvents(
|
||||
configs: Seq[Config],
|
||||
logger: Logger,
|
||||
|
|
@ -986,11 +987,13 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
def arguments(logger: Logger): Arguments = new Arguments(logger, inputs())
|
||||
end Config
|
||||
|
||||
@nowarn
|
||||
private def getStartMessage(key: ScopedKey[_])(implicit e: Extracted): StartMessage = Some {
|
||||
lazy val default = key.get(watchStartMessage).getOrElse(Watch.defaultStartWatch)
|
||||
key.get(deprecatedWatchingMessage).map(Left(_)).getOrElse(Right(default))
|
||||
}
|
||||
|
||||
@nowarn
|
||||
private def getTriggerMessage(
|
||||
key: ScopedKey[_]
|
||||
)(implicit e: Extracted): TriggerMessage = {
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ object HouseRulesPlugin extends AutoPlugin {
|
|||
|
||||
private implicit final class AnyWithIfScala[A](val __x: A) {
|
||||
def ifScala2x(p: Long => Boolean) =
|
||||
Def.setting(scalaPartV.value collect { case (2, y) if p(y) => __x })
|
||||
Def.setting(scalaPartV.value.collect { case (2, y) if p(y) => __x })
|
||||
def ifScala3x(p: Long => Boolean) =
|
||||
Def.setting(scalaPartV.value collect { case (3, y) if p(y) => __x })
|
||||
Def.setting(scalaPartV.value.collect { case (3, y) if p(y) => __x })
|
||||
def ifScalaLte(v: Long) = ifScala2x(_ <= v)
|
||||
def ifScalaGte(v: Long) = ifScala2x(_ >= v)
|
||||
def ifScala211OrMinus = ifScalaLte(11)
|
||||
|
|
|
|||
|
|
@ -52,16 +52,14 @@ final class Fork(val commandName: String, val runnerClass: Option[String]) {
|
|||
* command.
|
||||
*/
|
||||
def fork(config: ForkOptions, arguments: Seq[String]): Process = {
|
||||
import config.{ envVars => env, _ }
|
||||
import config.*
|
||||
val executable = Fork.javaCommand(javaHome, commandName).getAbsolutePath
|
||||
val preOptions = makeOptions(runJVMOptions, bootJars, arguments)
|
||||
val (classpathEnv, options) = Fork.fitClasspath(preOptions)
|
||||
val command = executable +: options
|
||||
|
||||
val environment: List[(String, String)] = env.toList ++
|
||||
(classpathEnv map { value =>
|
||||
Fork.ClasspathEnvKey -> value
|
||||
})
|
||||
val environment: List[(String, String)] = envVars.toList ++
|
||||
classpathEnv.map(value => Fork.ClasspathEnvKey -> value)
|
||||
val jpb =
|
||||
if (Fork.shouldUseArgumentsFile(options))
|
||||
new JProcessBuilder(executable, Fork.createArgumentsFile(options))
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ final class TestLogging(
|
|||
|
||||
class TestLogger(val logging: TestLogging) extends TestsListener {
|
||||
import TestLogger._
|
||||
import logging.{ global => log, logTest, managed }
|
||||
import logging.{ global, logTest, managed }
|
||||
import sbt.protocol.testing.codec.JsonProtocol._
|
||||
|
||||
def doInit(): Unit = managed.logEvent(Level.Info, TestInitEvent())
|
||||
|
|
@ -135,8 +135,8 @@ class TestLogger(val logging: TestLogging) extends TestsListener {
|
|||
managed.logEvent(Level.Info, EndTestGroupEvent(name, result))
|
||||
|
||||
def endGroup(name: String, t: Throwable): Unit = {
|
||||
log.trace(t)
|
||||
log.error(s"Could not run test $name: $t")
|
||||
global.trace(t)
|
||||
global.error(s"Could not run test $name: $t")
|
||||
managed.logEvent(
|
||||
Level.Info,
|
||||
EndTestGroupErrorEvent(name, (t.getMessage + t.getStackTrace.toString).mkString("\n"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue