mirror of https://github.com/sbt/sbt.git
reduce compiler warnings
This commit is contained in:
parent
b37bad6644
commit
36a16673c0
11
build.sbt
11
build.sbt
|
|
@ -686,9 +686,11 @@ lazy val commandProj = (project in file("main-command"))
|
||||||
testedBaseSettings,
|
testedBaseSettings,
|
||||||
name := "Command",
|
name := "Command",
|
||||||
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi),
|
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",
|
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
||||||
// Removing -Xfatal-warnings is necessary because BasicKeys contains a Key for a deprecated class.
|
|
||||||
Compile / scalacOptions -= "-Xfatal-warnings",
|
|
||||||
managedSourceDirectories in Compile +=
|
managedSourceDirectories in Compile +=
|
||||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||||
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||||
|
|
@ -863,7 +865,10 @@ lazy val mainProj = (project in file("main"))
|
||||||
log4jDependencies ++
|
log4jDependencies ++
|
||||||
Seq(scalaCacheCaffeine, lmCoursierShaded)
|
Seq(scalaCacheCaffeine, lmCoursierShaded)
|
||||||
},
|
},
|
||||||
Compile / scalacOptions -= "-Xfatal-warnings",
|
libraryDependencies ++= (scalaVersion.value match {
|
||||||
|
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
|
||||||
|
case _ => List()
|
||||||
|
}),
|
||||||
managedSourceDirectories in Compile +=
|
managedSourceDirectories in Compile +=
|
||||||
baseDirectory.value / "src" / "main" / "contraband-scala",
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||||
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ package sbt
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
import com.github.ghik.silencer.silent
|
||||||
import sbt.internal.inc.classpath.{ ClassLoaderCache => IncClassLoaderCache }
|
import sbt.internal.inc.classpath.{ ClassLoaderCache => IncClassLoaderCache }
|
||||||
import sbt.internal.classpath.ClassLoaderCache
|
import sbt.internal.classpath.ClassLoaderCache
|
||||||
import sbt.internal.server.ServerHandler
|
import sbt.internal.server.ServerHandler
|
||||||
|
|
@ -34,7 +35,7 @@ object BasicKeys {
|
||||||
"The function that constructs the command prompt from the current build state.",
|
"The function that constructs the command prompt from the current build state.",
|
||||||
10000
|
10000
|
||||||
)
|
)
|
||||||
val watch =
|
@silent val watch =
|
||||||
AttributeKey[Watched]("watched", "Continuous execution configuration.", 1000)
|
AttributeKey[Watched]("watched", "Continuous execution configuration.", 1000)
|
||||||
val serverPort =
|
val serverPort =
|
||||||
AttributeKey[Int]("server-port", "The port number used by server command.", 10000)
|
AttributeKey[Int]("server-port", "The port number used by server command.", 10000)
|
||||||
|
|
|
||||||
|
|
@ -3641,6 +3641,7 @@ object Classpaths {
|
||||||
ivyRepo.descriptorOptional
|
ivyRepo.descriptorOptional
|
||||||
} catch { case _: NoSuchMethodError => false }
|
} catch { case _: NoSuchMethodError => false }
|
||||||
|
|
||||||
|
@com.github.ghik.silencer.silent
|
||||||
private[this] def bootRepository(repo: xsbti.Repository): Resolver = {
|
private[this] def bootRepository(repo: xsbti.Repository): Resolver = {
|
||||||
import xsbti.Predefined
|
import xsbti.Predefined
|
||||||
repo match {
|
repo match {
|
||||||
|
|
@ -3878,6 +3879,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
// I tried "Def.spaceDelimited().parsed" (after importing Def.parserToInput)
|
// I tried "Def.spaceDelimited().parsed" (after importing Def.parserToInput)
|
||||||
// but it broke actions/run-task
|
// but it broke actions/run-task
|
||||||
// Maybe it needs to be defined inside a Def.inputTask?
|
// Maybe it needs to be defined inside a Def.inputTask?
|
||||||
|
@com.github.ghik.silencer.silent
|
||||||
def inputTask[T](f: TaskKey[Seq[String]] => Initialize[Task[T]]): Initialize[InputTask[T]] =
|
def inputTask[T](f: TaskKey[Seq[String]] => Initialize[Task[T]]): Initialize[InputTask[T]] =
|
||||||
InputTask.apply(Def.value((s: State) => Def.spaceDelimited()))(f)
|
InputTask.apply(Def.value((s: State) => Def.spaceDelimited()))(f)
|
||||||
|
|
||||||
|
|
@ -3947,7 +3949,7 @@ trait BuildCommon {
|
||||||
/**
|
/**
|
||||||
* Allows a String to be used where a `NameFilter` is expected.
|
* Allows a String to be used where a `NameFilter` is expected.
|
||||||
* Asterisks (`*`) in the string are interpreted as wildcards.
|
* Asterisks (`*`) in the string are interpreted as wildcards.
|
||||||
* All other characters must match exactly. See [[sbt.io.GlobFilter]].
|
* All other characters must match exactly. See GlobFilter.
|
||||||
*/
|
*/
|
||||||
implicit def globFilter(expression: String): NameFilter = GlobFilter(expression)
|
implicit def globFilter(expression: String): NameFilter = GlobFilter(expression)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ object EvaluateTask {
|
||||||
import Keys.state
|
import Keys.state
|
||||||
import std.Transform
|
import std.Transform
|
||||||
|
|
||||||
|
@com.github.ghik.silencer.silent
|
||||||
lazy private val sharedProgress = new TaskTimings(reportOnShutdown = true)
|
lazy private val sharedProgress = new TaskTimings(reportOnShutdown = true)
|
||||||
def taskTimingProgress: Option[ExecuteProgress[Task]] =
|
def taskTimingProgress: Option[ExecuteProgress[Task]] =
|
||||||
if (SysProp.taskTimingsOnShutdown) Some(sharedProgress)
|
if (SysProp.taskTimingsOnShutdown) Some(sharedProgress)
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,7 @@ object BuiltinCommands {
|
||||||
def ScriptCommands: Seq[Command] =
|
def ScriptCommands: Seq[Command] =
|
||||||
Seq(ignore, exit, Script.command, setLogLevel, early, act, nop)
|
Seq(ignore, exit, Script.command, setLogLevel, early, act, nop)
|
||||||
|
|
||||||
|
@com.github.ghik.silencer.silent
|
||||||
def DefaultCommands: Seq[Command] =
|
def DefaultCommands: Seq[Command] =
|
||||||
Seq(
|
Seq(
|
||||||
multi,
|
multi,
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ abstract class AutoPlugin extends Plugins.Basic with PluginsFunctions {
|
||||||
def trigger: PluginTrigger = noTrigger
|
def trigger: PluginTrigger = noTrigger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This AutoPlugin requires the plugins the [[Plugins]] matcher returned by this method. See [[trigger]].
|
* This AutoPlugin requires the plugins the Plugins matcher returned by this method. See [[trigger]].
|
||||||
*/
|
*/
|
||||||
def requires: Plugins = plugins.JvmPlugin
|
def requires: Plugins = plugins.JvmPlugin
|
||||||
|
|
||||||
|
|
@ -89,20 +89,20 @@ abstract class AutoPlugin extends Plugins.Basic with PluginsFunctions {
|
||||||
|
|
||||||
override def toString: String = label
|
override def toString: String = label
|
||||||
|
|
||||||
/** The [[Configuration]]s to add to each project that activates this AutoPlugin.*/
|
/** The `Configuration`s to add to each project that activates this AutoPlugin.*/
|
||||||
def projectConfigurations: Seq[Configuration] = Nil
|
def projectConfigurations: Seq[Configuration] = Nil
|
||||||
|
|
||||||
/** The [[Setting]]s to add in the scope of each project that activates this AutoPlugin. */
|
/** The `Setting`s to add in the scope of each project that activates this AutoPlugin. */
|
||||||
def projectSettings: Seq[Setting[_]] = Nil
|
def projectSettings: Seq[Setting[_]] = Nil
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The [[Setting]]s to add to the build scope for each project that activates this AutoPlugin.
|
* The `Setting` to add to the build scope for each project that activates this AutoPlugin.
|
||||||
* The settings returned here are guaranteed to be added to a given build scope only once
|
* The settings returned here are guaranteed to be added to a given build scope only once
|
||||||
* regardless of how many projects for that build activate this AutoPlugin.
|
* regardless of how many projects for that build activate this AutoPlugin.
|
||||||
*/
|
*/
|
||||||
def buildSettings: Seq[Setting[_]] = Nil
|
def buildSettings: Seq[Setting[_]] = Nil
|
||||||
|
|
||||||
/** The [[Setting]]s to add to the global scope exactly once if any project activates this AutoPlugin. */
|
/** The `Setting`s to add to the global scope exactly once if any project activates this AutoPlugin. */
|
||||||
def globalSettings: Seq[Setting[_]] = Nil
|
def globalSettings: Seq[Setting[_]] = Nil
|
||||||
|
|
||||||
// TODO?: def commands: Seq[Command]
|
// TODO?: def commands: Seq[Command]
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ final class StructureIndex(
|
||||||
* A resolved build unit. (`ResolvedBuildUnit` would be a better name to distinguish it from the loaded, but unresolved `BuildUnit`.)
|
* A resolved build unit. (`ResolvedBuildUnit` would be a better name to distinguish it from the loaded, but unresolved `BuildUnit`.)
|
||||||
* @param unit The loaded, but unresolved [[BuildUnit]] this was resolved from.
|
* @param unit The loaded, but unresolved [[BuildUnit]] this was resolved from.
|
||||||
* @param defined The definitive map from project IDs to resolved projects.
|
* @param defined The definitive map from project IDs to resolved projects.
|
||||||
* These projects have had [[Reference]]s resolved and [[AutoPlugin]]s evaluated.
|
* These projects have had `Reference`s resolved and [[AutoPlugin]]s evaluated.
|
||||||
* @param rootProjects The list of project IDs for the projects considered roots of this build.
|
* @param rootProjects The list of project IDs for the projects considered roots of this build.
|
||||||
* The first root project is used as the default in several situations where a project is not otherwise selected.
|
* The first root project is used as the default in several situations where a project is not otherwise selected.
|
||||||
*/
|
*/
|
||||||
|
|
@ -91,7 +91,7 @@ final class LoadedBuildUnit(
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project to use as the default when one is not otherwise selected.
|
* The project to use as the default when one is not otherwise selected.
|
||||||
* [[LocalRootProject]] resolves to this from within the same build.
|
* `LocalRootProject` resolves to this from within the same build.
|
||||||
*/
|
*/
|
||||||
val root = rootProjects.headOption.getOrElse(
|
val root = rootProjects.headOption.getOrElse(
|
||||||
throw new java.lang.AssertionError(
|
throw new java.lang.AssertionError(
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,13 @@ package sbt.internal
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.concurrent.atomic.AtomicReference
|
import java.util.concurrent.atomic.AtomicReference
|
||||||
|
|
||||||
|
import com.github.ghik.silencer.silent
|
||||||
import sbt.{ ProjectRef, State, Watched }
|
import sbt.{ ProjectRef, State, Watched }
|
||||||
import sbt.internal.io.{ EventMonitor, Source, WatchState => WS }
|
import sbt.internal.io.{ EventMonitor, Source, WatchState => WS }
|
||||||
import sbt.internal.util.AttributeKey
|
import sbt.internal.util.AttributeKey
|
||||||
import sbt.nio.file.Glob
|
import sbt.nio.file.Glob
|
||||||
|
|
||||||
|
@silent
|
||||||
private[internal] trait DeprecatedContinuous {
|
private[internal] trait DeprecatedContinuous {
|
||||||
protected type StartMessage =
|
protected type StartMessage =
|
||||||
Option[Either[WS => String, (Int, ProjectRef, Seq[String]) => Option[String]]]
|
Option[Either[WS => String, (Int, ProjectRef, Seq[String]) => Option[String]]]
|
||||||
|
|
@ -55,6 +57,8 @@ private[internal] trait DeprecatedContinuous {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@silent
|
||||||
private[sbt] object DeprecatedContinuous {
|
private[sbt] object DeprecatedContinuous {
|
||||||
private[sbt] val taskDefinitions = Seq(
|
private[sbt] val taskDefinitions = Seq(
|
||||||
sbt.Keys.watchTransitiveSources := sbt.Defaults.watchTransitiveSourcesTask.value,
|
sbt.Keys.watchTransitiveSources := sbt.Defaults.watchTransitiveSourcesTask.value,
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@ import sbt.util.{ CacheStore, CacheStoreFactory, Logger, Tracked, Level }
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
import sbt.Project.richInitializeTask
|
import sbt.Project.richInitializeTask
|
||||||
import sbt.dsl.LinterLevel.Ignore
|
|
||||||
import sjsonnew.JsonFormat
|
import sjsonnew.JsonFormat
|
||||||
|
// This is to turn off "`state` is inside the if expression of a regular task." etc
|
||||||
|
import sbt.dsl.LinterLevel.Ignore
|
||||||
|
|
||||||
private[sbt] object LibraryManagement {
|
private[sbt] object LibraryManagement {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import scala.collection.JavaConverters._
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a compiler reporter that uses event logging provided by a [[ManagedLogger]].
|
* Defines a compiler reporter that uses event logging provided by a `ManagedLogger`.
|
||||||
*
|
*
|
||||||
* @param maximumErrors The maximum errors.
|
* @param maximumErrors The maximum errors.
|
||||||
* @param logger The event managed logger.
|
* @param logger The event managed logger.
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ object PublishBinPlugin extends AutoPlugin {
|
||||||
override def globalSettings = Seq(publishLocalBin := (()))
|
override def globalSettings = Seq(publishLocalBin := (()))
|
||||||
|
|
||||||
override def projectSettings = Def settings (
|
override def projectSettings = Def settings (
|
||||||
publishLocalBin := Classpaths.publishTask(publishLocalBinConfig, deliverLocal).value,
|
publishLocalBin := Classpaths.publishTask(publishLocalBinConfig).value,
|
||||||
publishLocalBinConfig := {
|
publishLocalBinConfig := {
|
||||||
Classpaths.publishConfig(
|
Classpaths.publishConfig(
|
||||||
false, // publishMavenStyle.value,
|
false, // publishMavenStyle.value,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
package sbt.util
|
package sbt.util
|
||||||
|
|
||||||
import scala.util.{ Failure, Try, Success }
|
import scala.util.{ Failure, Try, Success => USuccess }
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
|
|
@ -182,7 +182,7 @@ object Tracked {
|
||||||
import CacheImplicits.LongJsonFormat
|
import CacheImplicits.LongJsonFormat
|
||||||
def save(store: CacheStore, value: I): Unit = {
|
def save(store: CacheStore, value: I): Unit = {
|
||||||
Hasher.hash(value) match {
|
Hasher.hash(value) match {
|
||||||
case Success(keyHash) => store.write[Long](keyHash.toLong)
|
case USuccess(keyHash) => store.write[Long](keyHash.toLong)
|
||||||
case Failure(e) =>
|
case Failure(e) =>
|
||||||
if (isStrictMode) throw e
|
if (isStrictMode) throw e
|
||||||
else ()
|
else ()
|
||||||
|
|
@ -191,9 +191,9 @@ object Tracked {
|
||||||
|
|
||||||
def changed(store: CacheStore, value: I): Boolean =
|
def changed(store: CacheStore, value: I): Boolean =
|
||||||
Try { store.read[Long] } match {
|
Try { store.read[Long] } match {
|
||||||
case Success(prev: Long) =>
|
case USuccess(prev: Long) =>
|
||||||
Hasher.hash(value) match {
|
Hasher.hash(value) match {
|
||||||
case Success(keyHash: Int) => keyHash.toLong != prev
|
case USuccess(keyHash: Int) => keyHash.toLong != prev
|
||||||
case Failure(e) =>
|
case Failure(e) =>
|
||||||
if (isStrictMode) throw e
|
if (isStrictMode) throw e
|
||||||
else true
|
else true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue