Merge pull request #2921 from eed3si9n/fport/2784

[fport] Show deprecations in build.sbt
This commit is contained in:
eugene yokota 2017-01-15 23:19:19 -05:00 committed by GitHub
commit e54d4ed8fd
2 changed files with 16 additions and 9 deletions

View File

@ -70,13 +70,11 @@ object TaskMacro {
final val TransformInitName = "transform"
final val InputTaskCreateDynName = "createDyn"
final val InputTaskCreateFreeName = "createFree"
final val append1Migration = "Use `lhs += { x.value }`."
final val appendNMigration = "Use `lhs ++= { x.value }`."
final val append1Migration = "`<+=` operator is deprecated. Use `lhs += { x.value }`."
final val appendNMigration = "`<++=` operator is deprecated. Use `lhs ++= { x.value }`."
final val assignMigration =
"""Use `key := { x.value }` or `key ~= (old => { newValue })`.
|The RHS of `<<=` takes an `Initialize[_]` expression, which can be converted to `:=` style
|by wrapping the expression in parenthesis, and calling `.value` at the end.
|For example, `key := (key.dependsOn(compile in Test)).value`.""".stripMargin
"""`<<=` operator is deprecated. Use `key := { x.value }` or `key ~= (old => { newValue })`.
|See http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html""".stripMargin
def taskMacroImpl[T: c.WeakTypeTag](c: blackbox.Context)(t: c.Expr[T]): c.Expr[Initialize[Task[T]]] =
Instance.contImpl[T, Id](c, FullInstance, FullConvert, MixedBuilder)(Left(t), Instance.idTransform[c.type])

View File

@ -1091,8 +1091,7 @@ object Defaults extends BuildCommon {
lazy val runnerSettings: Seq[Setting[_]] = Seq(runnerTask)
lazy val baseTasks: Seq[Setting[_]] = projectTasks ++ packageBase
lazy val configSettings: Seq[Setting[_]] = Classpaths.configSettings ++ configTasks ++ configPaths ++ packageConfig ++ Classpaths.compilerPluginConfig
lazy val configSettings: Seq[Setting[_]] = Classpaths.configSettings ++ configTasks ++ configPaths ++ packageConfig ++ Classpaths.compilerPluginConfig ++ deprecationSettings
lazy val compileSettings: Seq[Setting[_]] = configSettings ++ (mainRunMainTask +: mainRunTask +: addBaseSources) ++ Classpaths.addUnmanagedLibrary
lazy val testSettings: Seq[Setting[_]] = configSettings ++ testTasks
@ -1107,7 +1106,17 @@ object Defaults extends BuildCommon {
baseDirectory := thisProject.value.base,
target := baseDirectory.value / "target"
)
// build.sbt is treated a Scala source of metabuild, so to enable deprecation flag on build.sbt we set the option here.
lazy val deprecationSettings: Seq[Setting[_]] =
inConfig(Compile)(Seq(
scalacOptions := {
val old = scalacOptions.value
val existing = old.toSet
val d = "-deprecation"
if (sbtPlugin.value && !existing(d)) d :: old.toList
else old
}
))
}
object Classpaths {
import Keys._