diff --git a/internal/util-complete/src/main/scala/sbt/internal/util/LineReader.scala b/internal/util-complete/src/main/scala/sbt/internal/util/LineReader.scala index 8075faa24..a105a6ef3 100644 --- a/internal/util-complete/src/main/scala/sbt/internal/util/LineReader.scala +++ b/internal/util-complete/src/main/scala/sbt/internal/util/LineReader.scala @@ -173,10 +173,6 @@ object LineReader { abstract class JLine extends LineReader { protected def handleCONT: Boolean protected def reader: ConsoleReader - @deprecated("For binary compatibility only", "1.4.0") - protected def injectThreadSleep: Boolean = false - @deprecated("For binary compatibility only", "1.4.0") - protected lazy val in: InputStream = Terminal.wrappedSystemIn override def readLine(prompt: String, mask: Option[Char] = None): Option[String] = unsynchronizedReadLine(prompt, mask) @@ -235,79 +231,12 @@ abstract class JLine extends LineReader { } } -@deprecated("Use LineReader apis", "1.4.0") -private[sbt] object JLine { - @deprecated("Handled by Terminal.fixTerminalProperty", "1.4.0") - private[sbt] def fixTerminalProperty(): Unit = () - - // When calling this, ensure that enableEcho has been or will be called. - // TerminalFactory.get will initialize the terminal to disable echo. - @deprecated("Don't use jline.Terminal directly", "1.4.0") - private[sbt] def terminal: jline.Terminal = Terminal.deprecatedTerminal - - /** - * For accessing the JLine Terminal object. This ensures synchronized access as well as - * re-enabling echo after getting the Terminal. - */ - // @deprecated( - // "Don't use jline.Terminal directly. Use Terminal.get.withCanonicalIn instead.", - // "1.4.0" - // ) - // def usingTerminal[T](f: jline.Terminal => T): T = f(Terminal.get.toJLine) - - @deprecated("unused", "1.4.0") - def createReader(): ConsoleReader = createReader(None, Terminal.wrappedSystemIn) - - @deprecated("Use LineReader.createReader", "1.4.0") - def createReader(historyPath: Option[File], in: InputStream): ConsoleReader = { - val cr = Terminal.createReader(Terminal.console, Prompt.Running) - cr.setExpandEvents(false) // https://issues.scala-lang.org/browse/SI-7650 - cr.setBellEnabled(false) - val h = historyPath match { - case None => new MemoryHistory - case Some(file) => new FileHistory(file): MemoryHistory - } - h.setMaxSize(MaxHistorySize) - cr.setHistory(h) - cr - } - - @deprecated("Avoid referencing JLine directly.", "1.4.0") - def withJLine[T](action: => T): T = Terminal.get.withRawInput(action) - - @deprecated("Use LineReader.simple instead", "1.4.0") - def simple( - historyPath: Option[File], - handleCONT: Boolean = LineReader.HandleCONT, - injectThreadSleep: Boolean = false - ): SimpleReader = new SimpleReader(historyPath, handleCONT, injectThreadSleep) - - @deprecated("Use LineReader.MaxHistorySize", "1.4.0") - val MaxHistorySize = LineReader.MaxHistorySize - - @deprecated("Use LineReader.HandleCONT", "1.4.0") - val HandleCONT = LineReader.HandleCONT -} - final class FullReader( historyPath: Option[File], complete: Parser[?], val handleCONT: Boolean, terminal: Terminal ) extends JLine { - @deprecated("Use the constructor with no injectThreadSleep parameter", "1.4.0") - def this( - historyPath: Option[File], - complete: Parser[?], - handleCONT: Boolean = LineReader.HandleCONT, - injectThreadSleep: Boolean = false - ) = - this( - historyPath, - complete, - handleCONT, - Terminal.console - ) protected val reader: ConsoleReader = { val cr = LineReader.createJLine2Reader(historyPath, terminal) sbt.internal.util.complete.JLineCompletion.installCustomCompletor(cr, complete) diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/BufferedLogger.scala b/internal/util-logging/src/main/scala/sbt/internal/util/BufferedLogger.scala index af9dd9bf3..105612d73 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/BufferedLogger.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/BufferedLogger.scala @@ -178,9 +178,6 @@ class BufferedLogger(delegate: AbstractLogger) extends BasicLogger { /** Plays buffered events and disables buffering. */ def stop(): Unit = synchronized { play(); clear() } - @deprecated("No longer used.", "1.0.0") - override def ansiCodesSupported = delegate.ansiCodesSupported - override def setLevel(newLevel: Level.Value): Unit = synchronized { super.setLevel(newLevel) if (recording) diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/ConsoleAppender.scala b/internal/util-logging/src/main/scala/sbt/internal/util/ConsoleAppender.scala index eed706ef9..369813959 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/ConsoleAppender.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/ConsoleAppender.scala @@ -74,7 +74,7 @@ object ConsoleLogger { */ class ConsoleLogger private[ConsoleLogger] ( out: ConsoleOut, - override val ansiCodesSupported: Boolean, + ansiCodesSupported: Boolean, useFormat: Boolean, suppressedMessage: SuppressedTraceContext => Option[String] ) extends BasicLogger { diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/EscHelpers.scala b/internal/util-logging/src/main/scala/sbt/internal/util/EscHelpers.scala index 512f5ca1b..e13c605b3 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/EscHelpers.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/EscHelpers.scala @@ -183,11 +183,6 @@ object EscHelpers { } (res, index) } - @deprecated("use EscHelpers.strip", "1.4.2") - def stripMoves(s: String): String = { - val (bytes, len) = strip(s.getBytes, stripAnsi = true, stripColor = false) - new String(bytes, 0, len) - } /** * Removes the ansi escape sequences from a string and makes a best attempt at calculating any diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/FilterLogger.scala b/internal/util-logging/src/main/scala/sbt/internal/util/FilterLogger.scala index 3c90a15af..289860c41 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/FilterLogger.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/FilterLogger.scala @@ -9,7 +9,6 @@ package sbt.internal.util import sbt.util.* -import scala.annotation.nowarn /** * A filter logger is used to delegate messages but not the logging level to another logger. This @@ -17,7 +16,6 @@ import scala.annotation.nowarn * delegate. */ class FilterLogger(delegate: AbstractLogger) extends BasicLogger { - @nowarn override lazy val ansiCodesSupported = delegate.ansiCodesSupported def trace(t: => Throwable): Unit = { if (traceEnabled) delegate.trace(t) diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/FullLogger.scala b/internal/util-logging/src/main/scala/sbt/internal/util/FullLogger.scala index 4e5f79f7c..7178e33a8 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/FullLogger.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/FullLogger.scala @@ -9,13 +9,9 @@ package sbt.internal.util import sbt.util.* -import com.github.ghik.silencer.silent /** Promotes the simple Logger interface to the full AbstractLogger interface. */ class FullLogger(delegate: Logger) extends BasicLogger { - @deprecated("No longer used.", "1.0.0") - @silent override val ansiCodesSupported: Boolean = delegate.ansiCodesSupported - def trace(t: => Throwable): Unit = { if (traceEnabled) delegate.trace(t) diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/ManagedLogger.scala b/internal/util-logging/src/main/scala/sbt/internal/util/ManagedLogger.scala index c8c0d8d95..e07da7a7b 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/ManagedLogger.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/ManagedLogger.scala @@ -66,7 +66,4 @@ class ManagedLogger( val entry: ObjectEvent[A] = ObjectEvent(level, v, channelName, execId, tag.key) xlogger.log(level, entry) } - - @deprecated("No longer used.", "1.0.0") - override def ansiCodesSupported = ConsoleAppender.formatEnabledInEnv } diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/MultiLogger.scala b/internal/util-logging/src/main/scala/sbt/internal/util/MultiLogger.scala index 51d94408d..78aa73da6 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/MultiLogger.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/MultiLogger.scala @@ -9,14 +9,10 @@ package sbt.internal.util import sbt.util.* -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 - @nowarn private def supported = (_: AbstractLogger).ansiCodesSupported override def setLevel(newLevel: Level.Value): Unit = { super.setLevel(newLevel) diff --git a/internal/util-logging/src/main/scala/sbt/internal/util/Terminal.scala b/internal/util-logging/src/main/scala/sbt/internal/util/Terminal.scala index 3e15493fe..6605595b7 100644 --- a/internal/util-logging/src/main/scala/sbt/internal/util/Terminal.scala +++ b/internal/util-logging/src/main/scala/sbt/internal/util/Terminal.scala @@ -889,8 +889,6 @@ object Terminal { private[sbt] def setConsoleProgressState(progressState: ProgressState): Unit = consoleProgressState.set(progressState) - @deprecated("For compatibility only", "1.4.0") - private[sbt] def deprecatedTerminal: jline.Terminal = console.toJLine private[util] class ConsoleTerminal( in: WriteableInputStream, out: OutputStream, diff --git a/internal/util-logging/src/main/scala/sbt/util/InterfaceUtil.scala b/internal/util-logging/src/main/scala/sbt/util/InterfaceUtil.scala index bebf4fe83..dab78ed1d 100644 --- a/internal/util-logging/src/main/scala/sbt/util/InterfaceUtil.scala +++ b/internal/util-logging/src/main/scala/sbt/util/InterfaceUtil.scala @@ -70,32 +70,6 @@ object InterfaceUtil { l.toList } - @deprecated("Use the overload of this method with more arguments", "1.2.2") - def position( - line0: Option[Integer], - content: String, - offset0: Option[Integer], - pointer0: Option[Integer], - pointerSpace0: Option[String], - sourcePath0: Option[String], - sourceFile0: Option[File] - ): Position = - position( - line0, - content, - offset0, - pointer0, - pointerSpace0, - sourcePath0, - sourceFile0, - None, - None, - None, - None, - None, - None - ) - def position( line0: Option[Integer], content: String, @@ -127,41 +101,6 @@ object InterfaceUtil { endColumn0 ) - @deprecated("Use the overload of this method with more arguments", "1.2.2") - def problem(cat: String, pos: Position, msg: String, sev: Severity): Problem = - problem(cat, pos, msg, sev, None) - - @deprecated("Use the overload of this method with more arguments", "1.7.2") - def problem( - cat: String, - pos: Position, - msg: String, - sev: Severity, - rendered: Option[String] - ): Problem = - problem(cat, pos, msg, sev, rendered, None, List.empty[DiagnosticRelatedInformation]) - - @deprecated("Use the overload of this method with more arguments", "1.9.0") - def problem( - cat: String, - pos: Position, - msg: String, - sev: Severity, - rendered: Option[String], - diagnosticCode: Option[DiagnosticCode], - diagnosticRelatedInformation: List[DiagnosticRelatedInformation] - ): Problem = - problem( - cat, - pos, - msg, - sev, - rendered, - diagnosticCode, - diagnosticRelatedInformation, - List.empty[Action], - ) - def problem( cat: String, pos: Position, diff --git a/internal/util-logging/src/main/scala/sbt/util/Logger.scala b/internal/util-logging/src/main/scala/sbt/util/Logger.scala index 75a39710a..39db3f63b 100644 --- a/internal/util-logging/src/main/scala/sbt/util/Logger.scala +++ b/internal/util-logging/src/main/scala/sbt/util/Logger.scala @@ -9,11 +9,9 @@ package sbt.util import xsbti.{ Logger as xLogger } -import xsbti.{ Position, Problem, Severity } import sys.process.ProcessLogger import sbt.internal.util.{ BufferedLogger, FullLogger } -import java.io.File import java.util.Optional import java.util.function.Supplier @@ -33,9 +31,6 @@ abstract class Logger extends xLogger { // sys.process.ProcessLogger final def out(message: => String): Unit = log(Level.Info, message) - @deprecated("No longer used.", "1.0.0") - def ansiCodesSupported: Boolean = false - def trace(t: => Throwable): Unit def success(message: => String): Unit def log(level: Level.Value, message: => String): Unit @@ -103,28 +98,4 @@ object Logger { def jo2o[A](o: Optional[A]): Option[A] = InterfaceUtil.jo2o(o) def o2jo[A](o: Option[A]): Optional[A] = InterfaceUtil.o2jo(o) - - @deprecated("Use InterfaceUtil.position", "1.2.2") - def position( - line0: Option[Integer], - content: String, - offset0: Option[Integer], - pointer0: Option[Integer], - pointerSpace0: Option[String], - sourcePath0: Option[String], - sourceFile0: Option[File] - ): Position = - InterfaceUtil.position( - line0, - content, - offset0, - pointer0, - pointerSpace0, - sourcePath0, - sourceFile0 - ) - - @deprecated("Use InterfaceUtil.problem", "1.2.2") - def problem(cat: String, pos: Position, msg: String, sev: Severity): Problem = - InterfaceUtil.problem(cat, pos, msg, sev) } diff --git a/internal/util-logging/src/test/scala/LogWriterTest.scala b/internal/util-logging/src/test/scala/LogWriterTest.scala index 4ae741a37..b5f0eec4d 100644 --- a/internal/util-logging/src/test/scala/LogWriterTest.scala +++ b/internal/util-logging/src/test/scala/LogWriterTest.scala @@ -163,7 +163,7 @@ final class RecordingLogger extends BasicLogger { def getEvents = events.reverse - override def ansiCodesSupported = true + def ansiCodesSupported = true def trace(t: => Throwable): Unit = { events ::= new Trace(t) } def log(level: Level.Value, message: => String): Unit = { events ::= new Log(level, message) } def success(message: => String): Unit = { events ::= new Success(message) } diff --git a/lm-core/src/main/scala/sbt/internal/librarymanagement/StringUtilities.scala b/lm-core/src/main/scala/sbt/internal/librarymanagement/StringUtilities.scala index 37c26418d..e5d878cec 100644 --- a/lm-core/src/main/scala/sbt/internal/librarymanagement/StringUtilities.scala +++ b/lm-core/src/main/scala/sbt/internal/librarymanagement/StringUtilities.scala @@ -3,14 +3,7 @@ */ package sbt.internal.librarymanagement -import java.util.Locale - object StringUtilities { - @deprecated( - "Different use cases require different normalization. Use Project.normalizeModuleID or normalizeProjectID instead.", - "0.13.0" - ) - def normalize(s: String) = s.toLowerCase(Locale.ENGLISH).replaceAll("""\W+""", "-") def nonEmpty(s: String, label: String): Unit = require(s.trim.length > 0, label + " cannot be empty.") def appendable(s: String) = if (s.isEmpty) "" else "_" + s diff --git a/main-actions/src/main/scala/sbt/DotGraph.scala b/main-actions/src/main/scala/sbt/DotGraph.scala index d0fa765c1..d121893cb 100644 --- a/main-actions/src/main/scala/sbt/DotGraph.scala +++ b/main-actions/src/main/scala/sbt/DotGraph.scala @@ -9,24 +9,11 @@ package sbt import java.io.File -import sbt.internal.inc.Relations import sbt.internal.util.Relation import sbt.io.IO object DotGraph { - @deprecated("not used", "1.4.0") - def sources(relations: Relations, outputDirectory: File, sourceRoots: Iterable[File]): Unit = ??? - @deprecated("not used", "1.4.0") - def packages(relations: Relations, outputDirectory: File, sourceRoots: Iterable[File]): Unit = ??? - @deprecated("not used", "1.4.0") - def apply( - relations: Relations, - outputDir: File, - sourceToString: File => String, - externalToString: File => String - ): Unit = ??? - def generateGraph[K, V]( file: File, graphName: String, diff --git a/main-actions/src/main/scala/sbt/Tests.scala b/main-actions/src/main/scala/sbt/Tests.scala index 1a1f7d2ab..ec977e6aa 100644 --- a/main-actions/src/main/scala/sbt/Tests.scala +++ b/main-actions/src/main/scala/sbt/Tests.scala @@ -175,8 +175,7 @@ object Tests { val tests: Seq[TestDefinition], val runPolicy: TestRunPolicy, val tags: Seq[(Tag, Int)] - ) extends Product - with Serializable { + ) extends Serializable { def this(name: String, tests: Seq[TestDefinition], runPolicy: TestRunPolicy) = { this(name, tests, runPolicy, Seq.empty) @@ -198,36 +197,6 @@ object Tests { new Group(name, tests, runPolicy, tags) } - // - EXPANDED CASE CLASS METHOD BEGIN -// - @deprecated("Methods generated for case class will be removed in the future.", "1.4.0") - def copy( - name: String = this.name, - tests: Seq[TestDefinition] = this.tests, - runPolicy: TestRunPolicy = this.runPolicy - ): Group = { - new Group(name, tests, runPolicy, this.tags) - } - - @deprecated("Methods generated for case class will be removed in the future.", "1.4.0") - override def productElement(x$1: Int): Any = x$1 match { - case 0 => Group.this.name - case 1 => Group.this.tests - case 2 => Group.this.runPolicy - case 3 => Group.this.tags - } - - @deprecated("Methods generated for case class will be removed in the future.", "1.4.0") - override def productArity: Int = 4 - - @deprecated("Methods generated for case class will be removed in the future.", "1.4.0") - def canEqual(x$1: Any): Boolean = x$1.isInstanceOf[Group] - - override def hashCode(): Int = { - scala.runtime.ScalaRunTime._hashCode(Group.this) - } - - override def toString(): String = scala.runtime.ScalaRunTime._toString(Group.this) - override def equals(x$1: Any): Boolean = { this.eq(x$1.asInstanceOf[Object]) || (x$1.isInstanceOf[Group] && ({ val Group$1: Group = x$1.asInstanceOf[Group] @@ -235,7 +204,6 @@ object Tests { runPolicy == Group$1.runPolicy && tags == Group$1.tags })) } - // - EXPANDED CASE CLASS METHOD END -// } object Group @@ -260,20 +228,6 @@ object Tests { new Group(name, tests, runPolicy, tags) } - @deprecated("Methods generated for case class will be removed in the future.", "1.4.0") - def unapply( - x$0: Group - ): Option[(String, Seq[TestDefinition], TestRunPolicy)] = { - if (x$0 == null) None - else - Some.apply[(String, Seq[TestDefinition], TestRunPolicy)]( - Tuple3.apply[String, Seq[TestDefinition], TestRunPolicy]( - x$0.name, - x$0.tests, - x$0.runPolicy - ) - ) - } private def readResolve(): Object = Group // - EXPANDED CASE CLASS METHOD END -// } @@ -478,15 +432,6 @@ object Tests { } } - @deprecated("Use the variant without tags", "1.1.1") - def makeSerial( - loader: ClassLoader, - runnables: Seq[TestRunnable], - setupTasks: Task[Unit], - tags: Seq[(Tag, Int)], - ): Task[List[(String, SuiteResult)]] = - makeSerial(loader, runnables, setupTasks) - def makeSerial( loader: ClassLoader, runnables: Seq[TestRunnable], diff --git a/main-command/src/main/scala/sbt/BasicCommands.scala b/main-command/src/main/scala/sbt/BasicCommands.scala index ccef59e7f..33ed2aebe 100644 --- a/main-command/src/main/scala/sbt/BasicCommands.scala +++ b/main-command/src/main/scala/sbt/BasicCommands.scala @@ -381,16 +381,6 @@ object BasicCommands { } } - @deprecated("Replaced by BuiltInCommands.continuous", "1.3.0") - def continuous: Command = - Command(ContinuousExecutePrefix, continuousBriefHelp, continuousDetail)(otherCommandParser) { - (s, arg) => - withAttribute(s, Watched.Configuration, "Continuous execution not configured.") { w => - val repeat = ContinuousExecutePrefix + (if (arg.startsWith(" ")) arg else " " + arg) - Watched.executeContinuously(w, s, arg, repeat) - } - } - def history: Command = Command.custom(historyParser, BasicCommandStrings.historyHelp) def historyParser(s: State): Parser[() => State] = diff --git a/main-command/src/main/scala/sbt/BasicKeys.scala b/main-command/src/main/scala/sbt/BasicKeys.scala index dc95e88a4..b5f82e69b 100644 --- a/main-command/src/main/scala/sbt/BasicKeys.scala +++ b/main-command/src/main/scala/sbt/BasicKeys.scala @@ -16,7 +16,6 @@ import sbt.internal.server.ServerHandler import sbt.internal.util.AttributeKey import sbt.librarymanagement.ModuleID import sbt.util.{ ActionCacheStore, Level } -import scala.annotation.nowarn import scala.concurrent.duration.FiniteDuration import xsbti.{ FileConverter, VirtualFile } @@ -43,8 +42,6 @@ object BasicKeys { "The function that constructs the command prompt from the current build state for a given terminal.", 10000 ) - @nowarn val watch = - AttributeKey[Watched]("watched", "Continuous execution configuration.", 1000) val serverPort = AttributeKey[Int]("server-port", "The port number used by server command.", 10000) diff --git a/main-command/src/main/scala/sbt/State.scala b/main-command/src/main/scala/sbt/State.scala index c26b241a2..74543b8d5 100644 --- a/main-command/src/main/scala/sbt/State.scala +++ b/main-command/src/main/scala/sbt/State.scala @@ -70,29 +70,6 @@ final case class State( case _ => false } -/** - * Data structure extracted form the State Machine for safe observability purposes. - * - * @param currentExecId provide the execId extracted from the original State. - * @param combinedParser the parser extracted from the original State. - */ -@deprecated("unused", "1.4.2") -private[sbt] final case class SafeState( - currentExecId: Option[String], - combinedParser: Parser[() => sbt.State] -) - -@deprecated("unused", "1.4.2") -private[sbt] object SafeState { - @deprecated("use StandardMain.exchange.withState", "1.4.2") - def apply(s: State) = { - new SafeState( - currentExecId = s.currentCommand.map(_.execId).flatten, - combinedParser = s.combinedParser - ) - } -} - trait Identity { override final def hashCode = super.hashCode override final def equals(a: Any) = super.equals(a) diff --git a/main-command/src/main/scala/sbt/Watched.scala b/main-command/src/main/scala/sbt/Watched.scala index 124ac9b70..ea28c592e 100644 --- a/main-command/src/main/scala/sbt/Watched.scala +++ b/main-command/src/main/scala/sbt/Watched.scala @@ -12,52 +12,16 @@ import java.io.File import java.nio.file.FileSystems import sbt.internal.LabeledFunctions.* -import sbt.internal.LegacyWatched -import sbt.internal.io.{ EventMonitor, Source, WatchState } -import sbt.internal.util.Types.const -import sbt.internal.util.AttributeKey +import sbt.internal.io.{ Source } import sbt.io.* import scala.concurrent.duration.* import scala.util.Properties -import scala.annotation.nowarn -@deprecated("Watched is no longer used to implement continuous execution", "1.3.0") -trait Watched { - - /** The files watched when an action is run with a proceeding ~ */ - def watchSources(@deprecated("unused", "") s: State): Seq[Watched.WatchSource] = Nil - def terminateWatch(key: Int): Boolean = Watched.isEnter(key) - - /** - * The time in milliseconds between checking for changes. The actual time between the last change - * made to a file and the execution time is between `pollInterval` and `pollInterval*2`. - */ - def pollInterval: FiniteDuration = Watched.PollDelay - - /** - * The duration for which the EventMonitor while ignore file events after a file triggers - * a new build. - */ - def antiEntropy: FiniteDuration = Watched.AntiEntropy - - /** The message to show when triggered execution waits for sources to change. */ - private[sbt] def watchingMessage(s: WatchState): String = Watched.defaultWatchingMessage(s) - - /** The message to show before an action is run. */ - private[sbt] def triggeredMessage(s: WatchState): String = Watched.defaultTriggeredMessage(s) - - /** The `WatchService` to use to monitor the file system. */ - private[sbt] def watchService(): WatchService = Watched.createWatchService() -} - -object Watched { +object Watched: type WatchSource = Source - @nowarn - def terminateWatch(key: Int): Boolean = Watched.isEnter(key) - private def waitMessage(project: String): String = s"Waiting for source changes$project... (press enter to interrupt)" @@ -86,9 +50,11 @@ object Watched { } - @nowarn + private val defaultPollInterval: FiniteDuration = 500.milliseconds + + // @nowarn private[sbt] val newWatchService: () => WatchService = - (() => createWatchService()).label("Watched.newWatchService") + (() => createWatchService(defaultPollInterval)).label("Watched.newWatchService") def createWatchService(pollDelay: FiniteDuration): WatchService = { def closeWatch = new MacOSXWatchService() sys.props.get("sbt.watch.mode") match { @@ -103,83 +69,4 @@ object Watched { } } - @deprecated("This is no longer used by continuous builds.", "1.3.0") - def printIfDefined(msg: String): Unit = if (!msg.isEmpty) System.out.println(msg) - @deprecated("This is no longer used by continuous builds.", "1.3.0") - def isEnter(key: Int): Boolean = key == 10 || key == 13 - @deprecated("Replaced by defaultPollInterval", "1.3.0") - val PollDelay: FiniteDuration = 500.milliseconds - @deprecated("Replaced by defaultAntiEntropy", "1.3.0") - val AntiEntropy: FiniteDuration = 40.milliseconds - @deprecated("Use the version that explicitly takes the poll delay", "1.3.0") - def createWatchService(): WatchService = createWatchService(PollDelay) - - @deprecated("Replaced by Watched.command", "1.3.0") - def executeContinuously(watched: Watched, s: State, next: String, repeat: String): State = - LegacyWatched.executeContinuously(watched, s, next, repeat) - - // Deprecated apis below - @deprecated("unused", "1.3.0") - def projectWatchingMessage(projectId: String): WatchState => String = - ((ws: WatchState) => projectOnWatchMessage(projectId)(ws.count, projectId, Nil).get) - .label("Watched.projectWatchingMessage") - @deprecated("unused", "1.3.0") - def projectOnWatchMessage(project: String): (Int, String, Seq[String]) => Option[String] = { - (count: Int, _: String, _: Seq[String]) => - Some(s"$count. ${waitMessage(s" in project $project")}") - }.label("Watched.projectOnWatchMessage") - - @deprecated("This method is not used and may be removed in a future version of sbt", "1.3.0") - private class AWatched extends Watched - - @deprecated("This method is not used and may be removed in a future version of sbt", "1.3.0") - def multi(base: Watched, paths: Seq[Watched]): Watched = - new AWatched { - override def watchSources(s: State): Seq[Watched.WatchSource] = - paths.foldLeft(base.watchSources(s))(_ ++ _.watchSources(s)) - override def terminateWatch(key: Int): Boolean = base.terminateWatch(key) - override val pollInterval: FiniteDuration = (base +: paths).map(_.pollInterval).min - override val antiEntropy: FiniteDuration = (base +: paths).map(_.antiEntropy).min - override def watchingMessage(s: WatchState): String = base.watchingMessage(s) - override def triggeredMessage(s: WatchState): String = base.triggeredMessage(s) - } - @deprecated("This method is not used and may be removed in a future version of sbt", "1.3.0") - def empty: Watched = new AWatched - - @deprecated("ContinuousEventMonitor attribute is not used by Watched.command", "1.3.0") - val ContinuousEventMonitor = - AttributeKey[EventMonitor]( - "watch event monitor", - "Internal: maintains watch state and monitor threads." - ) - @deprecated("Superseded by ContinuousEventMonitor", "1.3.0") - val ContinuousState = - AttributeKey[WatchState]("watch state", "Internal: tracks state for continuous execution.") - - @deprecated("Superseded by ContinuousEventMonitor", "1.3.0") - val ContinuousWatchService = - AttributeKey[WatchService]( - "watch service", - "Internal: tracks watch service for continuous execution." - ) - @deprecated("No longer used for continuous execution", "1.3.0") - val Configuration = - AttributeKey[Watched]("watched-configuration", "Configures continuous execution.") - - @deprecated("Use Watch.defaultStartWatch in conjunction with the watchStartMessage key", "1.3.0") - val defaultWatchingMessage: WatchState => String = - ((ws: WatchState) => s"${ws.count}. ${waitMessage("")} ") - .label("Watched.projectWatchingMessage") - @deprecated( - "Use Watch.defaultOnTriggerMessage in conjunction with the watchTriggeredMessage key", - "1.3.0" - ) - val defaultTriggeredMessage: WatchState => String = - const("").label("Watched.defaultTriggeredMessage") - @deprecated( - "Use Watch.clearScreenOnTrigger in conjunction with the watchTriggeredMessage key", - "1.3.0" - ) - val clearWhenTriggered: WatchState => String = - const(clearScreen).label("Watched.clearWhenTriggered") -} +end Watched diff --git a/main-command/src/main/scala/sbt/internal/LegacyWatched.scala b/main-command/src/main/scala/sbt/internal/LegacyWatched.scala deleted file mode 100644 index a1dca2fef..000000000 --- a/main-command/src/main/scala/sbt/internal/LegacyWatched.scala +++ /dev/null @@ -1,87 +0,0 @@ -/* - * sbt - * Copyright 2023, Scala center - * Copyright 2011 - 2022, Lightbend, Inc. - * Copyright 2008 - 2010, Mark Harrah - * Licensed under Apache License 2.0 (see LICENSE) - */ - -package sbt.internal - -import sbt.BasicCommandStrings.{ ClearOnFailure, FailureWall } -import sbt.Watched.ContinuousEventMonitor -import sbt.internal.io.{ EventMonitor, WatchState } -import sbt.internal.nio.{ FileEventMonitor, FileTreeRepository, WatchLogger } -import sbt.{ State, Watched } - -import scala.annotation.tailrec -import scala.concurrent.duration.* -import scala.util.control.NonFatal - -private[sbt] object LegacyWatched { - @deprecated("Replaced by Watched.command", "1.3.0") - 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) - val log = s.log - s.get(ContinuousEventMonitor) match { - case None => - val watchState = WatchState.empty(watched.watchService(), watched.watchSources(s)) - // This is the first iteration, so run the task and create a new EventMonitor - val logger: WatchLogger = (a: Any) => log.debug(a.toString) - val repo = FileTreeRepository.legacy(logger, watched.watchService()) - val fileEventMonitor = FileEventMonitor.antiEntropy( - repo, - watched.antiEntropy, - logger, - watched.antiEntropy, - 10.minutes - ) - val monitor = new EventMonitor { - override def awaitEvent(): Boolean = fileEventMonitor.poll(2.millis).nonEmpty - override def state(): WatchState = watchState - override def close(): Unit = watchState.close() - } - (ClearOnFailure :: next :: FailureWall :: repeat :: s) - .put(ContinuousEventMonitor, monitor: EventMonitor) - case Some(eventMonitor) => - Watched.printIfDefined(watched.watchingMessage(eventMonitor.state())) - @tailrec def impl(): State = { - val triggered = - try eventMonitor.awaitEvent() - catch { - case NonFatal(e) => - log.error( - "Error occurred obtaining files to watch. Terminating continuous execution..." - ) - s.handleError(e) - false - } - if (triggered) { - Watched.printIfDefined(watched.triggeredMessage(eventMonitor.state())) - ClearOnFailure :: next :: FailureWall :: repeat :: s - } else if (shouldTerminate) { - while (System.in.available() > 0) System.in.read() - eventMonitor.close() - s.remove(ContinuousEventMonitor) - } else { - impl() - } - } - impl() - } - } - -} - -package io { - @deprecated("No longer used", "1.3.0") - private[sbt] trait EventMonitor extends AutoCloseable { - - /** Block indefinitely until the monitor receives a file event or the user stops the watch. */ - def awaitEvent(): Boolean - - /** A snapshot of the WatchState that includes the number of build triggers and watch sources. */ - def state(): WatchState - } -} diff --git a/main-settings/src/main/scala/sbt/Previous.scala b/main-settings/src/main/scala/sbt/Previous.scala index 2baf15bdc..4c46e8f7c 100644 --- a/main-settings/src/main/scala/sbt/Previous.scala +++ b/main-settings/src/main/scala/sbt/Previous.scala @@ -53,9 +53,6 @@ object Previous { private[sbt] final class Referenced[T](val key: Key[T], val format: JsonFormat[T]) { def this(task: ScopedTaskKey[T], format: JsonFormat[T]) = this(Key(task, task), format) - // @deprecated("unused", "1.3.0") - // private[sbt] def task: ScopedKey[Task[T]] = key.task - lazy val stamped: JsonFormat[T] = StampedFormat.withStamp(key.task.key.tag.toString)(format) @@ -102,9 +99,6 @@ object Previous { private[sbt] final class References { private var map = IMap.empty[Key, Referenced] - @deprecated("unused", "1.3.0") - def recordReference[T](key: ScopedKey[Task[T]], format: JsonFormat[T]): Unit = - recordReference(Key(key, key), format) // TODO: this arbitrarily chooses a JsonFormat. // The need to choose is a fundamental problem with this approach, but this should at least make a stable choice. def recordReference[T](key: Key[T], format: JsonFormat[T]): Unit = synchronized { diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index beac7026e..c13a5f3a3 100644 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -21,14 +21,7 @@ import org.scalasbt.ipcsocket.Win32SecurityLevel import sbt.Def.{ Initialize, ScopedKey, Setting, SettingsDefinition, parsed } import sbt.Keys.* import sbt.OptionSyntax.* -import sbt.Project.{ - inScope, - inTask, - // richInitialize, - // richInitialize Task, - // richTaskSessionVar, - // sbtRichTaskPromise -} +import sbt.Project.{ inScope, inTask } import sbt.ProjectExtra.* import sbt.Scope.{ GlobalScope, ThisBuildScope, ThisScope, fillTaskAxis } import sbt.ScopeAxis.{ Select, This, Zero } @@ -40,7 +33,6 @@ import sbt.internal.classpath.AlternativeZincUtil import sbt.internal.inc.JavaInterfaceUtil.* import sbt.internal.inc.classpath.{ ClasspathFilter, ClasspathUtil } import sbt.internal.inc.{ CompileOutput, MappedFileConverter, Stamps, ZincLmUtil, ZincUtil } -import sbt.internal.io.{ Source, WatchState } import sbt.internal.librarymanagement.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties @@ -811,12 +803,6 @@ object Defaults extends BuildCommon { else Vector() } - @deprecated("Use constructor with scalaVersion and scalaBinaryVersion", "1.5.0") - def makeCrossTarget(t: File, bv: String, sbtv: String, plugin: Boolean, cross: Boolean): File = { - val scalaBase = if (cross) t / ("scala-" + bv) else t - if (plugin) scalaBase / ("sbt-" + sbtv) else scalaBase - } - def makeCrossTarget( t: File, scalaVersion: String, @@ -1056,20 +1042,11 @@ object Defaults extends BuildCommon { clean := Clean.scopedTask.value, consoleProject := consoleProjectTask.value, transitiveDynamicInputs := WatchTransitiveDependencies.task.value, - ) ++ sbt.internal.DeprecatedContinuous.taskDefinitions + ) def generate(generators: SettingKey[Seq[Task[Seq[File]]]]): Initialize[Task[Seq[File]]] = generators { _.join.map(_.flatten) } - @deprecated( - "The watchTransitiveSourcesTask is used only for legacy builds and will be removed in a future version of sbt.", - "1.3.0" - ) - def watchTransitiveSourcesTask: Initialize[Task[Seq[Source]]] = - import ScopeFilter.Make.* - val selectDeps = ScopeFilter(inAggregates(ThisProject) || inDependencies(ThisProject)) - watchSources.??(Nil).all(selectDeps).map(_.flatten) - def transitiveUpdateTask: Initialize[Task[Seq[UpdateReport]]] = { import ScopeFilter.Make.* val selectDeps = ScopeFilter(inDependencies(ThisProject, includeRoot = false)) @@ -1078,31 +1055,6 @@ object Defaults extends BuildCommon { Def.task { allUpdates.value.flatten ++ globalPluginUpdate.?.value } } - @deprecated("This is no longer used to implement continuous execution", "1.3.0") - def watchSetting: Initialize[Watched] = - Def.setting { - val getService = watchService.value - val interval = pollInterval.value - val _antiEntropy = watchAntiEntropy.value - val base = thisProjectRef.value - val msg = watchingMessage.getOrElse(Watched.defaultWatchingMessage).value - val trigMsg = triggeredMessage.getOrElse(Watched.defaultTriggeredMessage).value - new Watched { - val scoped = (base / watchTransitiveSources) - val key = scoped.scopedKey - override def antiEntropy: FiniteDuration = _antiEntropy - override def pollInterval: FiniteDuration = interval - override def watchingMessage(s: WatchState) = msg(s) - override def triggeredMessage(s: WatchState) = trigMsg(s) - override def watchService() = getService() - override def watchSources(s: State) = - EvaluateTask(Project.structure(s), key, s, base) match - case Some((_, Result.Value(ps))) => ps - case Some((_, Result.Inc(i))) => throw i - case None => sys.error("key not found: " + Def.displayFull(key)) - } - } - // Returns the ScalaInstance only if it was not constructed via `update` // This is necessary to prevent cycles between `update` and `scalaInstance` private[sbt] def unmanagedScalaInstanceOnly: Initialize[Task[Option[ScalaInstance]]] = @@ -4055,10 +4007,6 @@ object Classpaths { def constructBuildDependencies: Initialize[BuildDependencies] = loadedBuild(lb => BuildUtil.dependencies(lb.units)) - @deprecated("not used", "1.4.0") - def internalDependencies: Initialize[Task[Classpath]] = - ClasspathImpl.internalDependencyClasspathTask - def internalDependencyJarsTask: Initialize[Task[Classpath]] = ClasspathImpl.internalDependencyJarsTask lazy val mkIvyConfiguration: Initialize[Task[InlineIvyConfiguration]] = diff --git a/main/src/main/scala/sbt/Extracted.scala b/main/src/main/scala/sbt/Extracted.scala index b7df96d8f..3e86eee07 100644 --- a/main/src/main/scala/sbt/Extracted.scala +++ b/main/src/main/scala/sbt/Extracted.scala @@ -125,13 +125,6 @@ final case class Extracted( ): T = getOrError(key, structure.data.get(key))(using display) - @deprecated( - "This discards session settings. Migrate to appendWithSession or appendWithoutSession.", - "1.2.0" - ) - def append(settings: Seq[Setting[?]], state: State): State = - appendWithoutSession(settings, state) - /** Appends the given settings to all the build state settings, including session settings. */ def appendWithSession(settings: Seq[Setting[?]], state: State): State = appendImpl(settings, state, session.mergeSettings) diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index ad901b33d..7d809083a 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -22,7 +22,6 @@ import sbt.internal.InMemoryCacheStore.CacheStoreFactoryFactory import sbt.internal.* import sbt.internal.bsp.* import sbt.internal.inc.ScalaInstance -import sbt.internal.io.WatchState import sbt.internal.librarymanagement.{ CompatibilityWarningOptions, IvySbt } import sbt.internal.remotecache.RemoteCacheArtifact import sbt.internal.server.BuildServerProtocol.BspFullWorkspace @@ -143,15 +142,7 @@ object Keys { val watchService = settingKey[() => WatchService]("Service to use to monitor file system changes.").withRank(BMinusSetting).withRank(DSetting) // Deprecated watch apis - @deprecated("This is no longer used for continuous execution", "1.3.0") - val watch = SettingKey(BasicKeys.watch) val watchSources = taskKey[Seq[Watched.WatchSource]]("Defines the sources in this project for continuous execution to watch for changes.").withRank(BMinusSetting) - @deprecated("This is for legacy builds only and will be removed in a future version of sbt", "1.3.0") - val watchTransitiveSources = taskKey[Seq[Watched.WatchSource]]("Defines the sources in all projects for continuous execution to watch.").withRank(CSetting) - @deprecated("Use watchStartMessage instead", "1.3.0") - val watchingMessage = settingKey[WatchState => String]("The message to show when triggered execution waits for sources to change.").withRank(DSetting) - @deprecated("Use watchTriggeredMessage instead", "1.3.0") - val triggeredMessage = settingKey[WatchState => String]("The message to show before triggered execution executes an action after sources change.").withRank(DSetting) // Path Keys val baseDirectory = settingKey[File]("The base directory. Depending on the scope, this is the base directory for the build, project, configuration, or task.").withRank(AMinusSetting) diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index 3d63a6e9d..6093b5578 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -760,9 +760,6 @@ object BuiltinCommands { */ def isLastOnly(s: State): Boolean = s.history.previous.forall(_.commandLine == Shell) - @deprecated("Use variant that doesn't take the state", "1.1.1") - def printLast(s: State): Seq[String] => Unit = printLast - def printLast: Seq[String] => Unit = _ foreach println def autoImports(extracted: Extracted): EvalImports = diff --git a/main/src/main/scala/sbt/StateTransform.scala b/main/src/main/scala/sbt/StateTransform.scala index af4b76c68..0a0522408 100644 --- a/main/src/main/scala/sbt/StateTransform.scala +++ b/main/src/main/scala/sbt/StateTransform.scala @@ -29,17 +29,9 @@ package sbt final class StateTransform private ( val transform: State => State, stateProxy: () => State, -) { - // @deprecated("Exists only for binary compatibility with 1.3.x.", "1.4.0") - // private[sbt] def state: State = stateProxy() - // @deprecated("1.4.0", "Use the constructor that takes a transform function.") - // private[sbt] def this(state: State) = this((_: State) => state, () => state) -} +) {} object StateTransform: - // @deprecated("Exists only for binary compatibility with 1.3.x", "1.4.0") - // def apply(state: State): State = state - /** * Create an instance of [[StateTransform]]. * @param transform the transformation to apply after task evaluation has completed diff --git a/main/src/main/scala/sbt/internal/Continuous.scala b/main/src/main/scala/sbt/internal/Continuous.scala index 9b2d29f3f..1fc9210cc 100644 --- a/main/src/main/scala/sbt/internal/Continuous.scala +++ b/main/src/main/scala/sbt/internal/Continuous.scala @@ -26,7 +26,6 @@ import sbt.Keys.* import sbt.ProjectExtra.extract import sbt.internal.Continuous.{ ContinuousState, FileStampRepository } import sbt.internal.LabeledFunctions.* -import sbt.internal.io.WatchState import sbt.internal.nio.* import sbt.internal.ui.UITask import sbt.internal.util.JoinThread.* @@ -68,12 +67,11 @@ import scala.annotation.nowarn * system so that we don't rerun tasks if their inputs have not changed. As of 1.3.0, the * semantics match previous sbt versions as closely as possible while allowing the user more * freedom to adjust the behavior to best suit their use cases. - * - * For now Continuous extends DeprecatedContinuous to minimize the number of deprecation warnings - * produced by this file. In sbt 2.0, the DeprecatedContinuous mixin should be eliminated and - * the deprecated apis should no longer be supported. */ -private[sbt] object Continuous extends DeprecatedContinuous { +private[sbt] object Continuous { + protected type StartMessage = + Option[(Int, ProjectRef, Seq[String]) => Option[String]] + protected type TriggerMessage = (Int, Path, Seq[String]) => Option[String] private type Event = FileEvent[FileAttributes] /** @@ -409,12 +407,10 @@ private[sbt] object Continuous extends DeprecatedContinuous { val ws = params.watchSettings ws.onIteration.map(_(count, project, commands)).getOrElse { if (configs.size == 1) { // Only allow custom start messages for single tasks - ws.startMessage match { - case Some(Left(sm)) => logger.info(sm(params.watchState(count))) - case Some(Right(sm)) => sm(count, project, commands).foreach(logger.info(_)) + ws.startMessage match + case Some(sm) => sm(count, project, commands).foreach(logger.info(_)) case None => Watch.defaultStartWatch(count, project, commands).foreach(logger.info(_)) - } } Watch.Ignore } @@ -616,10 +612,8 @@ private[sbt] object Continuous extends DeprecatedContinuous { val onTrigger: (Int, Watch.Event) => Unit = { (count: Int, event: Watch.Event) => if (configs.size == 1) { val config = configs.head - config.watchSettings.triggerMessage match { - case Left(tm) => logger.info(tm(config.watchState(count))) - case Right(tm) => tm(count, event.path, commands).foreach(logger.info(_)) - } + val tm = config.watchSettings.triggerMessage + tm(count, event.path, commands).foreach(logger.info(_)) } else { Watch.defaultOnTriggerMessage(count, event.path, commands).foreach(logger.info(_)) } @@ -980,16 +974,13 @@ private[sbt] object Continuous extends DeprecatedContinuous { val watchSettings: WatchSettings, ): def inputs() = dynamicInputs.toSeq.sorted - private[sbt] def watchState(count: Int): DeprecatedWatchState = - WatchState.empty(inputs().map(_.glob)).withCount(count) - def arguments(logger: Logger): Arguments = new Arguments(logger, inputs()) end Config @nowarn private def getStartMessage(key: ScopedKey[?])(using Extracted): StartMessage = Some { lazy val default = key.get(watchStartMessage).getOrElse(Watch.defaultStartWatch) - key.get(deprecatedWatchingMessage).map(Left(_)).getOrElse(Right(default)) + default } @nowarn @@ -998,7 +989,7 @@ private[sbt] object Continuous extends DeprecatedContinuous { )(using Extracted): TriggerMessage = { lazy val default = key.get(watchTriggeredMessage).getOrElse(Watch.defaultOnTriggerMessage) - key.get(deprecatedTriggeredMessage).map(Left(_)).getOrElse(Right(default)) + default } extension (scope: Scope) { diff --git a/main/src/main/scala/sbt/internal/DeprecatedContinuous.scala b/main/src/main/scala/sbt/internal/DeprecatedContinuous.scala deleted file mode 100644 index ab3635317..000000000 --- a/main/src/main/scala/sbt/internal/DeprecatedContinuous.scala +++ /dev/null @@ -1,72 +0,0 @@ -/* - * sbt - * Copyright 2023, Scala center - * Copyright 2011 - 2022, Lightbend, Inc. - * Copyright 2008 - 2010, Mark Harrah - * Licensed under Apache License 2.0 (see LICENSE) - */ - -package sbt -package internal - -import java.nio.file.Path -import java.util.concurrent.atomic.AtomicReference - -import sbt.internal.io.{ EventMonitor, Source, WatchState as WS } -import sbt.internal.util.AttributeKey -import sbt.nio.file.Glob - -import scala.annotation.nowarn - -@nowarn -private[internal] trait DeprecatedContinuous { - protected type StartMessage = - Option[Either[WS => String, (Int, ProjectRef, Seq[String]) => Option[String]]] - protected type TriggerMessage = Either[WS => String, (Int, Path, Seq[String]) => Option[String]] - protected type DeprecatedWatchState = WS - protected val deprecatedWatchingMessage = sbt.Keys.watchingMessage - protected val deprecatedTriggeredMessage = sbt.Keys.triggeredMessage - protected def watchState(globs: Seq[Glob], count: Int): WS = { - WS.empty(globs).withCount(count) - } - private val legacyWatchState = - AttributeKey[AtomicReference[WS]]("legacy-watch-state", Int.MaxValue) - private[sbt] def addLegacyWatchSetting(state: State): State = { - val legacyState = new AtomicReference[WS](WS.empty(Nil).withCount(1)) - state - .put( - Watched.ContinuousEventMonitor, - new EventMonitor { - - /** Block indefinitely until the monitor receives a file event or the user stops the watch. */ - override def awaitEvent(): Boolean = false - - /** A snapshot of the WatchState that includes the number of build triggers and watch sources. */ - override def state(): WS = legacyState.get() - override def close(): Unit = () - } - ) - .put(legacyWatchState, legacyState) - .put( - Watched.Configuration, - new Watched { - override def watchSources(s: State): Seq[Source] = - s.get(legacyWatchState).map(_.get.sources).getOrElse(Nil) - } - ) - } - def updateLegacyWatchState(state: State, globs: Seq[Glob], count: Int): Unit = { - state.get(legacyWatchState).foreach { ref => - val ws = WS.empty(globs).withCount(count) - ref.set(ws) - } - } -} - -private[sbt] object DeprecatedContinuous { - private[sbt] val taskDefinitions: Seq[Def.Setting[?]] = Seq( - /* sbt.Keys.watchTransitiveSources := sbt.Defaults.watchTransitiveSourcesTask.value, - sbt.Keys.watch := sbt.Defaults.watchSetting.value, - sbt.nio.Keys.watchTasks := Continuous.continuousTask.evaluated, */ - ) -} diff --git a/main/src/main/scala/sbt/internal/Load.scala b/main/src/main/scala/sbt/internal/Load.scala index db4cefeca..8c7196542 100755 --- a/main/src/main/scala/sbt/internal/Load.scala +++ b/main/src/main/scala/sbt/internal/Load.scala @@ -415,15 +415,6 @@ private[sbt] object Load { ) } - @deprecated("No longer used. For binary compatibility", "1.2.1") - def reapply( - newSettings: Seq[Setting[?]], - structure: BuildStructure, - log: Logger - )(using display: Show[ScopedKey[?]]): BuildStructure = { - reapply(newSettings, structure) - } - def buildConfigurations( loaded: LoadedBuild, rootProject: URI => String, diff --git a/main/src/main/scala/sbt/internal/LogManager.scala b/main/src/main/scala/sbt/internal/LogManager.scala index 820c3faa4..f681dadfb 100644 --- a/main/src/main/scala/sbt/internal/LogManager.scala +++ b/main/src/main/scala/sbt/internal/LogManager.scala @@ -28,23 +28,12 @@ sealed abstract class LogManager { writer: PrintWriter, context: LoggerContext, ): ManagedLogger - @deprecated("Use alternate apply that provides a LoggerContext", "1.4.0") - def apply( - data: Def.Settings, - state: State, - task: ScopedKey[?], - writer: PrintWriter - ): ManagedLogger = apply(data, state, task, writer, LoggerContext.globalContext) - def backgroundLog( data: Def.Settings, state: State, task: ScopedKey[?], context: LoggerContext ): ManagedLogger - @deprecated("Use alternate background log that provides a LoggerContext", "1.4.0") - final def backgroundLog(data: Def.Settings, state: State, task: ScopedKey[?]): ManagedLogger = - backgroundLog(data, state, task, LoggerContext.globalContext) } /** @@ -72,15 +61,6 @@ object LogManager { manager(data, state, task, to, context) } - @deprecated("Use alternate constructBackgroundLog that provides a LoggerContext", "1.8.0") - def constructBackgroundLog( - data: Def.Settings, - state: State - ): ScopedKey[?] => ManagedLogger = { - val context = state.get(Keys.loggerContext).getOrElse(LoggerContext.globalContext) - constructBackgroundLog(data, state, context) - } - def constructBackgroundLog( data: Def.Settings, state: State, @@ -157,17 +137,6 @@ object LogManager { ): T = data.get(ScopedKey(scope, key)).orElse(state.get(key)).getOrElse(default) - @deprecated("Use defaultLogger that provides a LoggerContext", "1.4.0") - def defaultLogger( - data: Def.Settings, - state: State, - task: ScopedKey[?], - console: Appender, - backed: Appender, - relay: Appender, - extra: List[Appender] - ): ManagedLogger = - defaultLogger(data, state, task, console, backed, relay, extra, LoggerContext.globalContext) // This is the main function that is used to generate the logger for tasks. def defaultLogger( data: Def.Settings, @@ -314,7 +283,7 @@ object LogManager { private def slog: Logger = Option(ref.get) getOrElse sys.error("Settings logger used after project was loaded.") - override val ansiCodesSupported = ITerminal.isAnsiSupported + val ansiCodesSupported = ITerminal.isAnsiSupported override def trace(t: => Throwable) = slog.trace(t) override def success(message: => String) = slog.success(message) override def log(level: Level.Value, message: => String) = slog.log(level, message) diff --git a/main/src/main/scala/sbt/nio/Watch.scala b/main/src/main/scala/sbt/nio/Watch.scala index 18cd5a0bf..7ca36c4e5 100644 --- a/main/src/main/scala/sbt/nio/Watch.scala +++ b/main/src/main/scala/sbt/nio/Watch.scala @@ -342,16 +342,6 @@ object Watch { private type NextAction = Int => Watch.Action - @deprecated( - "Unused in sbt but left for binary compatibility. Use five argument version instead.", - "1.4.0" - ) - def apply( - task: () => Unit, - onStart: () => Watch.Action, - nextAction: () => Watch.Action, - ): Watch.Action = apply(0, _ => task(), _ => onStart(), _ => nextAction(), recursive = true) - /** * Runs a task and then blocks until the task is ready to run again or we no longer wish to * block execution. diff --git a/run/src/main/scala/sbt/Run.scala b/run/src/main/scala/sbt/Run.scala index e8b7e6cc7..8b1511a0c 100644 --- a/run/src/main/scala/sbt/Run.scala +++ b/run/src/main/scala/sbt/Run.scala @@ -186,10 +186,6 @@ object Run: ) = runner.run(mainClass, classpath, options, log) - /** Executes the given function, trapping calls to System.exit. */ - @deprecated("TrapExit feature is removed; just call the function instead", "1.6.0") - def executeTrapExit(f: => Unit, log: Logger): Try[Unit] = executeSuccess(f) - private[sbt] def executeSuccess(f: => Unit): Try[Unit] = { f Success(()) diff --git a/sbt-app/src/main/scala/sbt/Import.scala b/sbt-app/src/main/scala/sbt/Import.scala index cbeadd22f..424f67c76 100644 --- a/sbt-app/src/main/scala/sbt/Import.scala +++ b/sbt-app/src/main/scala/sbt/Import.scala @@ -91,8 +91,6 @@ trait Import { type Cache[I, O] = sbt.util.Cache[I, O] val Cache = sbt.util.Cache val CacheImplicits = sbt.util.CacheImplicits - @deprecated("Use Tracked.inputChanged and Tracked.outputChanged instead", "1.0.1") - type Changed[O] = sbt.util.Changed[O] type ChangeReport[T] = sbt.util.ChangeReport[T] val ChangeReport = sbt.util.ChangeReport type ControlEvent = sbt.util.ControlEvent @@ -159,7 +157,6 @@ trait Import { type FilterLogger = sbt.internal.util.FilterLogger val FullLogger = sbt.internal.util.FullLogger type FullLogger = sbt.internal.util.FullLogger - val FullReader = sbt.internal.util.FullReader type FullReader = sbt.internal.util.FullReader // val HCons = sbt.internal.util.HCons // type HCons[H, T <: HList] = sbt.internal.util.HCons[H, T] diff --git a/tasks-standard/src/main/scala/sbt/std/Streams.scala b/tasks-standard/src/main/scala/sbt/std/Streams.scala index 1696bbcf8..9e3fca8c0 100644 --- a/tasks-standard/src/main/scala/sbt/std/Streams.scala +++ b/tasks-standard/src/main/scala/sbt/std/Streams.scala @@ -120,23 +120,6 @@ object Streams { synchronized { streams.values.foreach(_.close()); streams.clear() } } - @deprecated("Use constructor without converter", "1.4") - def apply[Key, J: sjsonnew.IsoString]( - taskDirectory: Key => File, - name: Key => String, - mkLogger: (Key, PrintWriter) => ManagedLogger, - converter: sjsonnew.SupportConverter[J], - ): Streams[Key] = apply[Key](taskDirectory, name, mkLogger) - - @deprecated("Use constructor without converter", "1.4") - private[sbt] def apply[Key, J: sjsonnew.IsoString]( - taskDirectory: Key => File, - name: Key => String, - mkLogger: (Key, PrintWriter) => ManagedLogger, - converter: sjsonnew.SupportConverter[J], - mkFactory: (File, sjsonnew.SupportConverter[J]) => CacheStoreFactory - ): Streams[Key] = apply[Key](taskDirectory, name, mkLogger, mkFactory(_, converter)) - def apply[Key]( taskDirectory: Key => File, name: Key => String, diff --git a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala index 37e7804b5..a31eef61d 100644 --- a/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala +++ b/testing/src/main/scala/sbt/JUnitXmlTestsListener.scala @@ -43,9 +43,6 @@ class JUnitXmlTestsListener(val targetDir: File, legacyTestReport: Boolean, logg def this(outputDir: String, logger: Logger) = this(outputDir, false, logger) def this(outputDir: String) = this(outputDir, false, null) - @deprecated("Provided for binary compatibility: please use `targetDir` instead", "1.6.0") - def outputDir: String = targetDir.getParent - /** Current hostname so we know which machine executed the tests */ val hostname: String = { val start = System.nanoTime diff --git a/testing/src/main/scala/sbt/TestFramework.scala b/testing/src/main/scala/sbt/TestFramework.scala index ef7d80a3e..6ef27739c 100644 --- a/testing/src/main/scala/sbt/TestFramework.scala +++ b/testing/src/main/scala/sbt/TestFramework.scala @@ -8,15 +8,11 @@ package sbt -import java.io.File import scala.util.control.NonFatal import testing.{ Task as TestTask, * } import org.scalatools.testing.{ Framework as OldFramework } -import sbt.internal.inc.classpath.{ ClasspathUtilities, DualLoader } -import sbt.internal.inc.ScalaInstance import scala.annotation.tailrec import sbt.internal.util.ManagedLogger -import sbt.io.IO import sbt.protocol.testing.TestResult object TestFrameworks { @@ -304,32 +300,6 @@ object TestFramework { Thread.currentThread.setContextClassLoader(oldLoader) } } - @deprecated("1.3.0", "This has been replaced by the ClassLoaders.test task.") - def createTestLoader( - classpath: Seq[File], - scalaInstance: ScalaInstance, - tempDir: File - ): ClassLoader = { - val interfaceJar = IO.classLocationPath(classOf[testing.Framework]).toFile - val interfaceFilter = (name: String) => - name.startsWith("org.scalatools.testing.") || name.startsWith("sbt.testing.") - val notInterfaceFilter = (name: String) => !interfaceFilter(name) - val dual = new DualLoader( - scalaInstance.loader, - notInterfaceFilter, - x => true, - getClass.getClassLoader, - interfaceFilter, - x => false - ) - val main = ClasspathUtilities.makeLoader(classpath, dual, scalaInstance, tempDir) - // TODO - There's actually an issue with the classpath facility such that unmanagedScalaInstances are not added - // to the classpath correctly. We have a temporary workaround here. - val cp: Seq[File] = - if (scalaInstance.isManagedVersion) interfaceJar +: classpath - else scalaInstance.allJars ++ (interfaceJar +: classpath) - ClasspathUtilities.filterByClasspath(cp, main) - } def createTestFunction( loader: ClassLoader, taskDef: TaskDef, diff --git a/testing/src/main/scala/sbt/internal/testing/TestLogger.scala b/testing/src/main/scala/sbt/internal/testing/TestLogger.scala index bfdf75f2e..fbc5e94d6 100644 --- a/testing/src/main/scala/sbt/internal/testing/TestLogger.scala +++ b/testing/src/main/scala/sbt/internal/testing/TestLogger.scala @@ -35,12 +35,6 @@ object TestLogger { val buffered: Boolean ) - @deprecated("Use make variant that accepts a log level.", "1.4.0") - def make( - global: ManagedLogger, - perTest: TestDefinition => PerTest, - ): TestLogger = make(global, perTest, Level.Debug) - def make( global: ManagedLogger, perTest: TestDefinition => PerTest, diff --git a/util-cache/src/main/scala/sbt/util/CacheStore.scala b/util-cache/src/main/scala/sbt/util/CacheStore.scala index 03c138355..e07d85f12 100644 --- a/util-cache/src/main/scala/sbt/util/CacheStore.scala +++ b/util-cache/src/main/scala/sbt/util/CacheStore.scala @@ -63,10 +63,6 @@ object CacheStoreFactory { class DirectoryStoreFactory[J](base: File) extends CacheStoreFactory { IO.createDirectory(base) - @deprecated("Use constructor without converter", "1.4") - def this(base: File, converter: sjsonnew.SupportConverter[J])(using e: sjsonnew.IsoString[J]) = - this(base) - def make(identifier: String): CacheStore = new FileBasedStore(base / identifier) def sub(identifier: String): CacheStoreFactory = @@ -77,10 +73,6 @@ class DirectoryStoreFactory[J](base: File) extends CacheStoreFactory { class FileBasedStore[J](file: File) extends CacheStore { IO.touch(file, setModified = false) - @deprecated("Use constructor without converter", "1.4") - def this(file: File, converter: sjsonnew.SupportConverter[J])(using e: sjsonnew.IsoString[J]) = - this(file) - def read[T: JsonReader]() = new FileInput(file).read() diff --git a/util-collection/src/main/scala/sbt/internal/util/Settings.scala b/util-collection/src/main/scala/sbt/internal/util/Settings.scala index 08d6dfdbe..919bef085 100644 --- a/util-collection/src/main/scala/sbt/internal/util/Settings.scala +++ b/util-collection/src/main/scala/sbt/internal/util/Settings.scala @@ -215,13 +215,6 @@ trait Init: compile(dMap) } - @deprecated("Use makeWithCompiledMap", "1.4.0") - def make(init: Seq[Setting[?]])(using - delegates: ScopeType => Seq[ScopeType], - scopeLocal: ScopeLocal, - display: Show[ScopedKey[?]] - ): Settings = makeWithCompiledMap(init)._2 - def makeWithCompiledMap(init: Seq[Setting[?]])(using delegates: ScopeType => Seq[ScopeType], scopeLocal: ScopeLocal, diff --git a/util-tracking/src/main/scala/sbt/util/Tracked.scala b/util-tracking/src/main/scala/sbt/util/Tracked.scala index b2e7ca8a4..f5390fa7b 100644 --- a/util-tracking/src/main/scala/sbt/util/Tracked.scala +++ b/util-tracking/src/main/scala/sbt/util/Tracked.scala @@ -340,29 +340,6 @@ class Timestamp(val store: CacheStore, useStartTime: Boolean)(using format: Json Try { store.read[Long]() } getOrElse 0 } -@deprecated("Use Tracked.inputChanged and Tracked.outputChanged instead", "1.0.1") -class Changed[O: Equiv: JsonFormat](val store: CacheStore) extends Tracked { - def clean() = store.delete() - - def apply[O2](ifChanged: O => O2, ifUnchanged: O => O2): O => O2 = value => { - if (uptodate(value)) ifUnchanged(value) - else { - update(value) - ifChanged(value) - } - } - - def update(value: O): Unit = - store.write( - value - ) // Using.fileOutputStream(false)(cacheFile)(stream => format.writes(stream, value)) - - def uptodate(value: O): Boolean = { - val equiv: Equiv[O] = implicitly - equiv.equiv(value, store.read[O]()) - } -} - object Difference { def constructor( defineClean: Boolean,