Deprecation cleanup

The main project emits a number of deprecation warnings. I've isolated
the deprecation warnings related to Watch to the DeprecatedContinuous
file. I fixed the deprecation warnings where it was straightforward to
do so. After this change, there are three non-watch related changes
emitted:

1) Defaults.scala:3760 uses the deprecated InputTask.apply. This seems
   fixable but I'm not in a hurry
2) oldLoadFailed and oldLastGrep are used by Main. I think this could
   just be fixed by removing the deprecation warnings and setting them
   private[sbt] since they will still be available in the shell.
This commit is contained in:
Ethan Atkins 2019-05-11 16:52:48 -07:00
parent b15b638632
commit 2ab8fed8fd
6 changed files with 21 additions and 12 deletions

View File

@ -651,10 +651,8 @@ object Defaults extends BuildCommon {
cleanKeepGlobs := historyPath.value.map(_.toGlob).toSeq,
clean := Def.taskDyn(Clean.task(resolvedScoped.value.scope, full = true)).value,
consoleProject := consoleProjectTask.value,
watchTransitiveSources := watchTransitiveSourcesTask.value,
watch := watchSetting.value,
transitiveDynamicInputs := SettingsGraph.task.value,
)
) ++ sbt.internal.DeprecatedContinuous.taskDefinitions
def generate(generators: SettingKey[Seq[Task[Seq[File]]]]): Initialize[Task[Seq[File]]] =
generators { _.join.map(_.flatten) }
@ -2574,16 +2572,16 @@ object Classpaths {
}
},
ivyConfiguration := InlineIvyConfiguration(
paths = ivyPaths.value,
lock = Option(lock(appConfiguration.value)),
log = Option(streams.value.log),
updateOptions = UpdateOptions(),
paths = Option(ivyPaths.value),
resolvers = externalResolvers.value.toVector,
otherResolvers = Vector.empty,
moduleConfigurations = Vector.empty,
lock = Option(lock(appConfiguration.value)),
checksums = checksums.value.toVector,
managedChecksums = false,
resolutionCacheDir = Some(crossTarget.value / "resolution-cache"),
updateOptions = UpdateOptions(),
log = streams.value.log
),
ivySbt := ivySbt0.value,
classifiersModule := classifiersModuleTask.value,

View File

@ -69,6 +69,7 @@ final class xMain extends xsbti.AppMain {
override def scalaProvider(): ScalaProvider = appProvider.scalaProvider
override def id(): xsbti.ApplicationID = appProvider.id()
override def loader(): ClassLoader = metaLoader
@deprecated("Implements deprecated api", "1.3.0")
override def mainClass(): Class[_ <: AppMain] = appProvider.mainClass()
override def entryPoint(): Class[_] = appProvider.entryPoint()
override def newMain(): AppMain = appProvider.newMain()

View File

@ -29,7 +29,6 @@ import Keys.{
serverConnectionType,
fullServerHandlers,
logLevel,
watch
}
import Scope.{ Global, ThisScope }
import Def.{ Flattened, Initialize, ScopedKey, Setting }
@ -509,7 +508,6 @@ object Project extends ProjectExtra {
val history = get(historyPath) flatMap idFun
val prompt = get(shellPrompt)
val trs = (templateResolverInfos in Global get structure.data).toList.flatten
val watched = get(watch)
val startSvr: Option[Boolean] = get(autoStartServer)
val host: Option[String] = get(serverHost)
val port: Option[Int] = get(serverPort)
@ -524,7 +522,6 @@ object Project extends ProjectExtra {
)
val newAttrs =
s.attributes
.setCond(Watched.Configuration, watched)
.put(historyPath.key, history)
.setCond(autoStartServer.key, startSvr)
.setCond(serverPort.key, port)

View File

@ -19,3 +19,9 @@ private[internal] trait DeprecatedContinuous {
protected val deprecatedWatchingMessage = sbt.Keys.watchingMessage
protected val deprecatedTriggeredMessage = sbt.Keys.triggeredMessage
}
private[sbt] object DeprecatedContinuous {
private[sbt] val taskDefinitions = Seq(
sbt.Keys.watchTransitiveSources := sbt.Defaults.watchTransitiveSourcesTask.value,
sbt.Keys.watch := sbt.Defaults.watchSetting.value,
)
}

View File

@ -57,7 +57,7 @@ object IvyConsole {
depSettings
)
val newStructure = Load.reapply(session.original ++ append, structure, state.log)
val newStructure = Load.reapply(session.original ++ append, structure)
val newState = state.copy(remainingCommands = Exec(Keys.consoleQuick.key.label, None) :: Nil)
Project.setProject(session, newStructure, newState)
}

View File

@ -13,13 +13,20 @@ import org.apache.logging.log4j.core.{ LogEvent => XLogEvent }
import org.apache.logging.log4j.core.appender.AbstractAppender
import org.apache.logging.log4j.core.layout.PatternLayout
import org.apache.logging.log4j.core.async.RingBufferLogEvent
import org.apache.logging.log4j.core.config.Property
import sbt.util.Level
import sbt.internal.util._
import sbt.protocol.LogEvent
import sbt.internal.util.codec._
class RelayAppender(name: String)
extends AbstractAppender(name, null, PatternLayout.createDefaultLayout(), true) {
extends AbstractAppender(
name,
null,
PatternLayout.createDefaultLayout(),
true,
Property.EMPTY_ARRAY
) {
lazy val exchange = StandardMain.exchange
def append(event: XLogEvent): Unit = {