mirror of https://github.com/sbt/sbt.git
Drop "serialising" Function1. It's easily fallible
This commit is contained in:
parent
e7ba7fa9a4
commit
301ec787f2
|
|
@ -315,10 +315,7 @@
|
|||
"For example, if `remapVersion = v => \"2.10\"` and the binary version is \"2.9.2\" or \"2.10\",",
|
||||
"the module is cross-versioned with \"2.10\"."
|
||||
],
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{ "name": "remapVersion", "type": "Function1[String, String]" }
|
||||
]
|
||||
"type": "record"
|
||||
},
|
||||
{
|
||||
"name": "Full",
|
||||
|
|
@ -329,9 +326,6 @@
|
|||
"Cross-versions a module with the result of applying `remapVersion` to the full version.",
|
||||
"For example, if `remapVersion = v => \"2.10\"` and the full version is \"2.9.2\" or \"2.10.3\",",
|
||||
"the module is cross-versioned with \"2.10\"."
|
||||
],
|
||||
"fields": [
|
||||
{ "name": "remapVersion", "type": "Function1[String, String]" }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
package sbt.internal.librarymanagement.formats
|
||||
|
||||
import sjsonnew._
|
||||
|
||||
trait Function1Format { self: BasicJsonProtocol =>
|
||||
implicit def Function1Format[T, U]: JsonFormat[T => U] =
|
||||
project(MyCrazyReferences.referenced _, (ref: String) => MyCrazyReferences(ref, classOf[T => U]))
|
||||
}
|
||||
|
|
@ -13,25 +13,10 @@ abstract class CrossVersionFunctions {
|
|||
val TransitionSbtVersion = CrossVersionUtil.TransitionSbtVersion
|
||||
|
||||
/** Cross-versions a module with the full version (typically the full Scala version). */
|
||||
def full: CrossVersion = new Full(idStringFun)
|
||||
|
||||
/**
|
||||
* Cross-versions a module with the result of applying `remapVersion` to the full version
|
||||
* (typically the full Scala version). See also [[sbt.librarymanagement.CrossVersion.Full]].
|
||||
*/
|
||||
def fullMapped(remapVersion: String => String): CrossVersion = new Full(remapVersion)
|
||||
def full: CrossVersion = new Full()
|
||||
|
||||
/** Cross-versions a module with the binary version (typically the binary Scala version). */
|
||||
def binary: CrossVersion = new Binary(idStringFun)
|
||||
|
||||
/**
|
||||
* Cross-versions a module with the result of applying `remapVersion` to the binary version
|
||||
* (typically the binary Scala version). See also [[sbt.librarymanagement.CrossVersion.Binary]].
|
||||
*/
|
||||
def binaryMapped(remapVersion: String => String): CrossVersion = new Binary(remapVersion)
|
||||
|
||||
private[this] def idFun[T]: T => T = x => x
|
||||
private[this] val idStringFun = idFun[String]
|
||||
def binary: CrossVersion = new Binary()
|
||||
|
||||
private[sbt] def append(s: String): Option[String => String] = Some(x => crossName(x, s))
|
||||
|
||||
|
|
@ -43,8 +28,8 @@ abstract class CrossVersionFunctions {
|
|||
def apply(cross: CrossVersion, fullVersion: String, binaryVersion: String): Option[String => String] =
|
||||
cross match {
|
||||
case _: Disabled => None
|
||||
case b: Binary => append(b.remapVersion(binaryVersion))
|
||||
case f: Full => append(f.remapVersion(fullVersion))
|
||||
case _: Binary => append(binaryVersion)
|
||||
case _: Full => append(fullVersion)
|
||||
}
|
||||
|
||||
/** Constructs the cross-version function defined by `module` and `is`, if one is configured. */
|
||||
|
|
|
|||
|
|
@ -47,9 +47,6 @@ abstract class ModuleIDExtra {
|
|||
@deprecated("Use `cross(CrossVersion)`, the variant accepting a CrossVersion value constructed by a member of the CrossVersion object instead.", "0.12.0")
|
||||
def cross(v: Boolean): ModuleID = cross(if (v) CrossVersion.binary else Disabled())
|
||||
|
||||
@deprecated("Use `cross(CrossVersion)`, the variant accepting a CrossVersion value constructed by a member of the CrossVersion object instead.", "0.12.0")
|
||||
def cross(v: Boolean, verRemap: String => String): ModuleID = cross(if (v) CrossVersion.binaryMapped(verRemap) else Disabled())
|
||||
|
||||
/** Specifies the cross-version behavior for this module. See [CrossVersion] for details.*/
|
||||
def cross(v: CrossVersion): ModuleID = copy(crossVersion = v)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ object DatatypeConfig {
|
|||
val myCodecs: PartialFunction[String, TpeRef => List[String]] = {
|
||||
case "java.util.Date" => { _ => "sbt.internal.librarymanagement.formats.DateFormat" :: Nil }
|
||||
|
||||
case "Function1" =>
|
||||
{ tpe => "sbt.internal.librarymanagement.formats.Function1Format" :: twoArgs(tpe).flatMap(getFormats) }
|
||||
|
||||
case "scala.xml.NodeSeq" => { _ => "sbt.internal.librarymanagement.formats.NodeSeqFormat" :: Nil }
|
||||
|
||||
case "org.apache.ivy.plugins.resolver.DependencyResolver" =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue