mirror of https://github.com/sbt/sbt.git
Remove unused vals/defs
This commit is contained in:
parent
deea82542c
commit
84c611af36
|
|
@ -55,7 +55,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se
|
|||
lazy val settings =
|
||||
{
|
||||
val s = new Settings(println)
|
||||
val command = new CompilerCommand(options.toList, s)
|
||||
new CompilerCommand(options.toList, s) // this side-effects on Settings..
|
||||
s
|
||||
}
|
||||
lazy val reporter = mkReporter(settings)
|
||||
|
|
@ -259,11 +259,6 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se
|
|||
case None => Nil
|
||||
case Some(dir) => dir listFiles moduleFileFilter(moduleName)
|
||||
}
|
||||
private[this] def getClassFiles(backing: Option[File], moduleName: String): Seq[File] =
|
||||
backing match {
|
||||
case None => Nil
|
||||
case Some(dir) => dir listFiles moduleClassFilter(moduleName)
|
||||
}
|
||||
private[this] def moduleFileFilter(moduleName: String) = new java.io.FilenameFilter {
|
||||
def accept(dir: File, s: String) =
|
||||
(s contains moduleName)
|
||||
|
|
|
|||
|
|
@ -52,23 +52,24 @@ object Watched {
|
|||
|
||||
def executeContinuously(watched: Watched, s: State, next: String, repeat: String): State =
|
||||
{
|
||||
@tailrec def shouldTerminate: Boolean = (System.in.available > 0) && (watched.terminateWatch(System.in.read()) || shouldTerminate)
|
||||
@tailrec def shouldTerminate: Boolean =
|
||||
(System.in.available > 0) && (watched.terminateWatch(System.in.read()) || shouldTerminate)
|
||||
val sourcesFinder = PathFinder { watched watchPaths s }
|
||||
val watchState = s get ContinuousState getOrElse WatchState.empty
|
||||
|
||||
if (watchState.count > 0)
|
||||
printIfDefined(watched watchingMessage watchState)
|
||||
|
||||
val (triggered, newWatchState, newState) =
|
||||
val (triggered, newWatchState) =
|
||||
try {
|
||||
val (triggered, newWatchState) = SourceModificationWatch.watch(sourcesFinder, watched.pollInterval, watchState)(shouldTerminate)
|
||||
(triggered, newWatchState, s)
|
||||
(triggered, newWatchState)
|
||||
} catch {
|
||||
case e: Exception =>
|
||||
val log = s.log
|
||||
log.error("Error occurred obtaining files to watch. Terminating continuous execution...")
|
||||
State.handleException(e, s, log)
|
||||
(false, watchState, s.fail)
|
||||
(false, watchState)
|
||||
}
|
||||
|
||||
if (triggered) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package sbt
|
|||
|
||||
import Def.{ Initialize, ScopedKey, streamsManagerKey }
|
||||
import Previous._
|
||||
import sbt.internal.util.{ ~>, AttributeKey, IMap, RMap }
|
||||
import sbt.internal.util.{ ~>, IMap, RMap }
|
||||
|
||||
import java.io.{ InputStream, OutputStream }
|
||||
|
||||
|
|
@ -46,7 +46,6 @@ object Previous {
|
|||
|
||||
private[sbt] val references = SettingKey[References]("previous-references", "Collects all static references to previous values of tasks.", KeyRanks.Invisible)
|
||||
private[sbt] val cache = TaskKey[Previous]("previous-cache", "Caches previous values of tasks read from disk for the duration of a task execution.", KeyRanks.Invisible)
|
||||
private[this] val previousReferenced = AttributeKey[Referenced[_]]("previous-referenced")
|
||||
|
||||
/** Records references to previous task value. This should be completely populated after settings finish loading. */
|
||||
private[sbt] final class References {
|
||||
|
|
|
|||
|
|
@ -776,7 +776,6 @@ object Defaults extends BuildCommon {
|
|||
def runnerInit: Initialize[Task[ScalaRun]] = Def.task {
|
||||
val tmp = taskTemporaryDirectory.value
|
||||
val resolvedScope = resolvedScoped.value.scope
|
||||
val structure = buildStructure.value
|
||||
val si = scalaInstance.value
|
||||
val s = streams.value
|
||||
val options = javaOptions.value
|
||||
|
|
@ -811,9 +810,6 @@ object Defaults extends BuildCommon {
|
|||
val cp = data(dependencyClasspath.value).toList
|
||||
val label = nameForSrc(configuration.value.name)
|
||||
val fiOpts = fileInputOptions.value
|
||||
val logger: Logger = s.log
|
||||
val maxer = maxErrors.value
|
||||
val spms = sourcePositionMappers.value
|
||||
val reporter = (compilerReporter in compile).value
|
||||
(hasScala, hasJava) match {
|
||||
case (true, _) =>
|
||||
|
|
@ -1300,9 +1296,6 @@ object Classpaths {
|
|||
val uwConfig = (unresolvedWarningConfiguration in update).value
|
||||
val depDir = dependencyCacheDirectory.value
|
||||
withExcludes(out, mod.classifiers, lock(app)) { excludes =>
|
||||
val uwConfig = (unresolvedWarningConfiguration in update).value
|
||||
val logicalClock = LogicalClock(state.value.hashCode)
|
||||
val depDir = dependencyCacheDirectory.value
|
||||
IvyActions.updateClassifiers(is, GetClassifiersConfiguration(mod, excludes, c.copy(artifactFilter = c.artifactFilter.invert), ivyScala.value, srcTypes, docTypes), uwConfig, LogicalClock(state.value.hashCode), Some(depDir), Vector.empty, s.log)
|
||||
}
|
||||
} tag (Tags.Update, Tags.Network)
|
||||
|
|
@ -1493,7 +1486,7 @@ object Classpaths {
|
|||
val ew = EvictionWarning(module, ewo, result, log)
|
||||
ew.lines foreach { log.warn(_) }
|
||||
ew.infoAllTheThings foreach { log.info(_) }
|
||||
val cw = CompatibilityWarning.run(compatWarning, module, mavenStyle, log)
|
||||
CompatibilityWarning.run(compatWarning, module, mavenStyle, log)
|
||||
result
|
||||
}
|
||||
def uptodate(inChanged: Boolean, out: UpdateReport): Boolean =
|
||||
|
|
@ -1622,8 +1615,8 @@ object Classpaths {
|
|||
|
||||
def analyzed[T](data: T, analysis: CompileAnalysis) = Attributed.blank(data).put(Keys.analysis, analysis)
|
||||
def makeProducts: Initialize[Task[Seq[File]]] = Def.task {
|
||||
val x1 = compile.value
|
||||
val x2 = copyResources.value
|
||||
compile.value
|
||||
copyResources.value
|
||||
classDirectory.value :: Nil
|
||||
}
|
||||
// This is a variant of exportProductsTask with tracking
|
||||
|
|
|
|||
|
|
@ -254,7 +254,6 @@ object EvaluateTask {
|
|||
def logIncomplete(result: Incomplete, state: State, streams: Streams): Unit = {
|
||||
val all = Incomplete linearize result
|
||||
val keyed = for (Incomplete(Some(key: ScopedKey[_]), _, msg, _, ex) <- all) yield (key, msg, ex)
|
||||
val un = all.filter { i => i.node.isEmpty || i.message.isEmpty }
|
||||
|
||||
import ExceptionCategory._
|
||||
for ((key, msg, Some(ex)) <- keyed) {
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ object BuiltinCommands {
|
|||
|
||||
def lastGrep = Command(LastGrepCommand, lastGrepBrief, lastGrepDetailed)(lastGrepParser) {
|
||||
case (s, (pattern, Some(sks))) =>
|
||||
val (str, ref, display) = extractLast(s)
|
||||
val (str, _, display) = extractLast(s)
|
||||
Output.lastGrep(sks, str.streams(s), pattern, printLast(s))(display)
|
||||
keepLastLog(s)
|
||||
case (s, (pattern, None)) =>
|
||||
|
|
@ -353,7 +353,7 @@ object BuiltinCommands {
|
|||
|
||||
private[this] def lastImpl(s: State, sks: AnyKeys, sid: Option[String]): State =
|
||||
{
|
||||
val (str, ref, display) = extractLast(s)
|
||||
val (str, _, display) = extractLast(s)
|
||||
Output.last(sks, str.streams(s), printLast(s), sid)(display)
|
||||
keepLastLog(s)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -385,11 +385,11 @@ object Project extends ProjectExtra {
|
|||
{
|
||||
val structure = Project.structure(s)
|
||||
val ref = Project.current(s)
|
||||
val project = Load.getProject(structure.units, ref.build, ref.project)
|
||||
Load.getProject(structure.units, ref.build, ref.project)
|
||||
val msg = Keys.onLoadMessage in ref get structure.data getOrElse ""
|
||||
if (!msg.isEmpty) s.log.info(msg)
|
||||
def get[T](k: SettingKey[T]): Option[T] = k in ref get structure.data
|
||||
def commandsIn(axis: ResolvedReference) = commands in axis get structure.data toList;
|
||||
def commandsIn(axis: ResolvedReference) = commands in axis get structure.data toList
|
||||
|
||||
val allCommands = commandsIn(ref) ++ commandsIn(BuildRef(ref.build)) ++ (commands in Global get structure.data toList)
|
||||
val history = get(historyPath) flatMap idFun
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ package sbt
|
|||
package internal
|
||||
|
||||
import sbt.util.Logger
|
||||
import java.io.File
|
||||
import sbt.internal.inc.{ ClasspathOptionsUtil, ScalaInstance }
|
||||
|
||||
object ConsoleProject {
|
||||
|
|
@ -36,7 +35,4 @@ object ConsoleProject {
|
|||
implicit def settingKeyEvaluate[T](s: SettingKey[T]): Evaluate[T] = new Evaluate(get(s))
|
||||
}
|
||||
final class Evaluate[T] private[sbt] (val eval: T)
|
||||
private def bootIvyHome(app: xsbti.AppConfiguration): Option[File] =
|
||||
try { Option(app.provider.scalaProvider.launcher.ivyHome) }
|
||||
catch { case _: NoSuchMethodError => None }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ private[sbt] object EvaluateConfigurations {
|
|||
if (parsed.definitions.isEmpty) (Nil, DefinedSbtValues.empty) else {
|
||||
val definitions = evaluateDefinitions(eval, name, parsed.imports, parsed.definitions, Some(file))
|
||||
val imp = BuildUtil.importAllRoot(definitions.enclosingModule :: Nil)
|
||||
val projs = (loader: ClassLoader) => definitions.values(loader).map(p => resolveBase(file.getParentFile, p.asInstanceOf[Project]))
|
||||
(imp, DefinedSbtValues(definitions))
|
||||
}
|
||||
val allImports = importDefs.map(s => (s, -1)) ++ parsed.imports
|
||||
|
|
|
|||
|
|
@ -58,10 +58,9 @@ private[sbt] object Load {
|
|||
val compilers = Compiler.compilers(ClasspathOptionsUtil.boot, ivyConfiguration)(state.configuration, log)
|
||||
val evalPluginDef = EvaluateTask.evalPluginDef(log) _
|
||||
val delegates = defaultDelegates
|
||||
val initialID = baseDirectory.getName
|
||||
val pluginMgmt = PluginManagement(loader)
|
||||
val inject = InjectSettings(injectGlobal(state), Nil, const(Nil))
|
||||
new LoadBuildConfiguration(stagingDirectory, classpath, loader, compilers, evalPluginDef, delegates,
|
||||
LoadBuildConfiguration(stagingDirectory, classpath, loader, compilers, evalPluginDef, delegates,
|
||||
EvaluateTask.injectStreams, pluginMgmt, inject, None, Nil, log)
|
||||
}
|
||||
private def bootIvyHome(app: xsbti.AppConfiguration): Option[File] =
|
||||
|
|
|
|||
|
|
@ -215,15 +215,15 @@ private[sbt] object PluginsDebug {
|
|||
val minRequiredPlugins = plugins(minModel)
|
||||
|
||||
// The presence of any one of these plugins would deactivate `plugin`
|
||||
val minAbsentPlugins = excludes(minModel).toSet
|
||||
val minAbsentPlugins = excludes(minModel)
|
||||
|
||||
// Plugins that must be both activated and deactivated for `plugin` to activate.
|
||||
// A non-empty list here cannot be satisfied and is an error.
|
||||
val contradictions = minAbsentPlugins & minRequiredPlugins
|
||||
|
||||
if(contradictions.nonEmpty) PluginImpossible(plugin, context, contradictions)
|
||||
if (contradictions.nonEmpty) PluginImpossible(plugin, context, contradictions)
|
||||
else {
|
||||
// Plguins that the user has to add to the currently selected plugins in order to enable `plugin`.
|
||||
// Plugins that the user has to add to the currently selected plugins in order to enable `plugin`.
|
||||
val addToExistingPlugins = minRequiredPlugins -- initialPlugins
|
||||
|
||||
// Plugins that are currently excluded that need to be allowed.
|
||||
|
|
@ -232,9 +232,7 @@ private[sbt] object PluginsDebug {
|
|||
// The model that results when the minimal plugins are enabled and the minimal plugins are excluded.
|
||||
// This can include more plugins than just `minRequiredPlugins` because the plguins required for `plugin`
|
||||
// might activate other plugins as well.
|
||||
val modelForMin = context.deducePlugin(and(includeAll(minRequiredPlugins), excludeAll(minAbsentPlugins)), context.log)
|
||||
|
||||
val incrementalInputs = and( includeAll(minRequiredPlugins ++ initialPlugins), excludeAll(minAbsentPlugins ++ initialExcludes -- minRequiredPlugins))
|
||||
val incrementalInputs = and(includeAll(minRequiredPlugins ++ initialPlugins), excludeAll(minAbsentPlugins ++ initialExcludes -- minRequiredPlugins))
|
||||
val incrementalModel = context.deducePlugin(incrementalInputs, context.log).toSet
|
||||
|
||||
// Plugins that are newly enabled as a result of selecting the plugins needed for `plugin`, but aren't strictly required for `plugin`.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ private[sbt] object SettingCompletions {
|
|||
import extracted._
|
||||
val append = Load.transformSettings(Load.projectScope(currentRef), currentRef.build, rootProject, settings)
|
||||
val newSession = session.appendSettings(append map (a => (a, arg.split('\n').toList)))
|
||||
val struct = extracted.structure
|
||||
val r = relation(newSession.mergeSettings, true)(structure.delegates, structure.scopeLocal, implicitly)
|
||||
setResult(newSession, r, append)
|
||||
}
|
||||
|
|
@ -111,8 +110,7 @@ private[sbt] object SettingCompletions {
|
|||
*/
|
||||
def settingParser(settings: Settings[Scope], rawKeyMap: Map[String, AttributeKey[_]], context: ResolvedProject): Parser[String] =
|
||||
{
|
||||
val cutoff = KeyRanks.MainCutoff
|
||||
val keyMap: Map[String, AttributeKey[_]] = rawKeyMap.map { case (k, v) => (keyScalaID(k), v) } toMap;
|
||||
val keyMap: Map[String, AttributeKey[_]] = rawKeyMap.map { case (k, v) => (keyScalaID(k), v) }.toMap
|
||||
def inputScopedKey(pred: AttributeKey[_] => Boolean): Parser[ScopedKey[_]] =
|
||||
scopedKeyParser(keyMap.filter { case (_, k) => pred(k) }, settings, context)
|
||||
val full = for {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ object Util {
|
|||
"-Yno-adapted-args",
|
||||
"-Ywarn-dead-code",
|
||||
"-Ywarn-numeric-widen",
|
||||
"-Ywarn-unused",
|
||||
"-Ywarn-unused-import"
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ object TrapExit {
|
|||
|
||||
// interrupts the given thread, but first replaces the exception handler so that the InterruptedException is not printed
|
||||
private def safeInterrupt(thread: Thread, log: Logger): Unit = {
|
||||
val name = thread.getName
|
||||
log.debug("Interrupting thread " + thread.getName)
|
||||
thread.setUncaughtExceptionHandler(new TrapInterrupt(thread.getUncaughtExceptionHandler))
|
||||
thread.interrupt
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ object ScriptedPlugin extends AutoPlugin {
|
|||
|
||||
def scriptedTask: Initialize[InputTask[Unit]] = Def.inputTask {
|
||||
val args = scriptedParser(sbtTestDirectory.value).parsed
|
||||
val prereq: Unit = scriptedDependencies.value
|
||||
scriptedDependencies.value
|
||||
try {
|
||||
scriptedRun.value.invoke(
|
||||
scriptedTests.value, sbtTestDirectory.value, scriptedBufferLog.value: java.lang.Boolean,
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@ object ScriptedTests extends ScriptedRunner {
|
|||
def main(args: Array[String]): Unit = {
|
||||
val directory = new File(args(0))
|
||||
val buffer = args(1).toBoolean
|
||||
val sbtVersion = args(2)
|
||||
val defScalaVersion = args(3)
|
||||
val buildScalaVersions = args(4)
|
||||
// val sbtVersion = args(2)
|
||||
// val defScalaVersion = args(3)
|
||||
// val buildScalaVersions = args(4)
|
||||
val bootProperties = new File(args(5))
|
||||
val tests = args.drop(6)
|
||||
val logger = ConsoleLogger()
|
||||
|
|
|
|||
Loading…
Reference in New Issue