mirror of https://github.com/sbt/sbt.git
Deprecate the old operators `<<=`, `<+=`, and `<++=` (#2716)
* Backport style changes in tests and Defaults.scala This backports the scripted tests and Defaults.scala style changes to use `build.sbt` and `:=`. * Fix backport * Deprecate the old operators `<<=`, `<+=`, and `<++=` The no-longer-documented operators `<<=`, `<+=`, and `<++=` are deprecated in anticipation of the removal in sbt 1.0. Ref #2711 For `<<=`, the suggested migration would be to use either `:=` or `~=` operators. 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.
This commit is contained in:
parent
cd216a2758
commit
16a6906826
|
|
@ -40,7 +40,9 @@ sealed abstract class SettingKey[T] extends ScopedTaskable[T] with KeyedInitiali
|
|||
final def :=(v: T): Setting[T] = macro std.TaskMacro.settingAssignMacroImpl[T]
|
||||
final def +=[U](v: U)(implicit a: Append.Value[T, U]): Setting[T] = macro std.TaskMacro.settingAppend1Impl[T, U]
|
||||
final def ++=[U](vs: U)(implicit a: Append.Values[T, U]): Setting[T] = macro std.TaskMacro.settingAppendNImpl[T, U]
|
||||
@deprecated("Use `lhs += { x.value }`", "0.13.13")
|
||||
final def <+=[V](v: Initialize[V])(implicit a: Append.Value[T, V]): Setting[T] = macro std.TaskMacro.settingAppend1Position[T, V]
|
||||
@deprecated("Use `lhs ++= { x.value }`", "0.13.13")
|
||||
final def <++=[V](vs: Initialize[V])(implicit a: Append.Values[T, V]): Setting[T] = macro std.TaskMacro.settingAppendNPosition[T, V]
|
||||
final def -=[U](v: U)(implicit r: Remove.Value[T, U]): Setting[T] = macro std.TaskMacro.settingRemove1Impl[T, U]
|
||||
final def --=[U](vs: U)(implicit r: Remove.Values[T, U]): Setting[T] = macro std.TaskMacro.settingRemoveNImpl[T, U]
|
||||
|
|
@ -71,7 +73,9 @@ sealed abstract class TaskKey[T] extends ScopedTaskable[T] with KeyedInitialize[
|
|||
|
||||
def +=[U](v: U)(implicit a: Append.Value[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskAppend1Impl[T, U]
|
||||
def ++=[U](vs: U)(implicit a: Append.Values[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskAppendNImpl[T, U]
|
||||
@deprecated("Use `lhs += { x.value }`", "0.13.13")
|
||||
def <+=[V](v: Initialize[Task[V]])(implicit a: Append.Value[T, V]): Setting[Task[T]] = macro std.TaskMacro.taskAppend1Position[T, V]
|
||||
@deprecated("Use `lhs ++= { x.value }`", "0.13.13")
|
||||
def <++=[V](vs: Initialize[Task[V]])(implicit a: Append.Values[T, V]): Setting[Task[T]] = macro std.TaskMacro.taskAppendNPosition[T, V]
|
||||
final def -=[U](v: U)(implicit r: Remove.Value[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskRemove1Impl[T, U]
|
||||
final def --=[U](vs: U)(implicit r: Remove.Values[T, U]): Setting[Task[T]] = macro std.TaskMacro.taskRemoveNImpl[T, U]
|
||||
|
|
@ -153,6 +157,10 @@ object Scoped {
|
|||
* @param app value to bind to this key
|
||||
* @return setting binding this key to the given value.
|
||||
*/
|
||||
@deprecated("""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, "0.13.13")
|
||||
final def <<=(app: Initialize[S]): Setting[S] = macro std.TaskMacro.settingAssignPosition[S]
|
||||
|
||||
/** Internally used function for setting a value along with the `.sbt` file location where it is defined. */
|
||||
|
|
@ -199,6 +207,10 @@ object Scoped {
|
|||
def :=(v: S): Setting[Task[S]] = macro std.TaskMacro.taskAssignMacroImpl[S]
|
||||
def ~=(f: S => S): Setting[Task[S]] = macro std.TaskMacro.taskTransformPosition[S]
|
||||
|
||||
@deprecated("""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, "0.13.13")
|
||||
def <<=(app: Initialize[Task[S]]): Setting[Task[S]] = macro std.TaskMacro.itaskAssignPosition[S]
|
||||
def set(app: Initialize[Task[S]], source: SourcePosition): Setting[Task[S]] = Def.setting(scopedKey, app, source)
|
||||
def transform(f: S => S, source: SourcePosition): Setting[Task[S]] = set(scopedKey(_ map f), source)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
### Fixes with compatibility implications
|
||||
|
||||
- Deprecate old operators.
|
||||
|
||||
### Deprecate old operators
|
||||
|
||||
The no-longer-documented operators `<<=`, `<+=`, and `<++=` are deprecated,
|
||||
and will be removed in sbt 1.0.
|
||||
|
||||
For `<<=`, the suggested migration would be to use either `:=` or `~=` operators.
|
||||
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
|
||||
|
||||
For `<+=` and `<++=`, use `+= { x.value }` and `++= { x.value }`.
|
||||
|
||||
[@eed3si9n]: https://github.com/eed3si9n
|
||||
|
||||
Loading…
Reference in New Issue