mirror of https://github.com/sbt/sbt.git
Added CrossVersion.patch which strips off -bin-suffix. (#2757)
This commit is contained in:
parent
f860d5ef31
commit
0dfd40972d
|
|
@ -92,6 +92,19 @@ object CrossVersion {
|
|||
|
||||
private[this] def idFun[T]: T => T = x => x
|
||||
|
||||
/**
|
||||
* Cross-versions a module with the full Scala version excluding any `-bin` suffix.
|
||||
*/
|
||||
def patch: CrossVersion = new Full(patchFun)
|
||||
|
||||
private[this] def patchFun(fullVersion: String): String = {
|
||||
val BinCompatV = """(\d+)\.(\d+)\.(\d+)(-\w+)??-bin(-.*)?""".r
|
||||
fullVersion match {
|
||||
case BinCompatV(x, y, z, w, _) => s"""$x.$y.$z${if (w == null) "" else w}"""
|
||||
case other => other
|
||||
}
|
||||
}
|
||||
|
||||
@deprecated("Will be made private.", "0.13.1")
|
||||
def append(s: String): Option[String => String] = Some(x => crossName(x, s))
|
||||
|
||||
|
|
|
|||
|
|
@ -118,5 +118,24 @@ object CrossVersionTest extends Specification {
|
|||
"return binary Scala version for 2.10.1 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.1") must_== "2.10"
|
||||
}
|
||||
|
||||
"return patch Scala version for 2.11.8 as 2.11.8" in {
|
||||
CrossVersion(CrossVersion.patch, "2.11.8", "dummy").map(_("artefact")) must_== Some("artefact_2.11.8")
|
||||
}
|
||||
"return patch Scala version for 2.11.8-M1 as 2.11.8-M1" in {
|
||||
CrossVersion(CrossVersion.patch, "2.11.8-M1", "dummy").map(_("artefact")) must_== Some("artefact_2.11.8-M1")
|
||||
}
|
||||
"return patch Scala version for 2.11.8-RC1 as 2.11.8-RC1" in {
|
||||
CrossVersion(CrossVersion.patch, "2.11.8-RC1", "dummy").map(_("artefact")) must_== Some("artefact_2.11.8-RC1")
|
||||
}
|
||||
"return patch Scala version for 2.11.8-bin-extra as 2.11.8" in {
|
||||
CrossVersion(CrossVersion.patch, "2.11.8-bin-extra", "dummy").map(_("artefact")) must_== Some("artefact_2.11.8")
|
||||
}
|
||||
"return patch Scala version for 2.11.8-M1-bin-extra as 2.11.8-M1" in {
|
||||
CrossVersion(CrossVersion.patch, "2.11.8-M1-bin-extra", "dummy").map(_("artefact")) must_== Some("artefact_2.11.8-M1")
|
||||
}
|
||||
"return patch Scala version for 2.11.8-RC1-bin-extra as 2.11.8-RC1" in {
|
||||
CrossVersion(CrossVersion.patch, "2.11.8-RC1-bin-extra", "dummy").map(_("artefact")) must_== Some("artefact_2.11.8-RC1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@
|
|||
- Adds `.jvmopts` support to the launcher script. [sbt/sbt-launcher-package#111][111] by [@fommil][@fommil]
|
||||
- Adds `.java-version` support to the Windows launcher script. [sbt/sbt-launcher-package#111][111] by [@fommil][@fommil]
|
||||
- The startup log level is dropped to `-error` in script mode using `scalas`. [#840][840]/[#2746][2746] by [@eed3si9n][@eed3si9n]
|
||||
- Adds `CrossVersion.patch` which sits in between `CrossVersion.binary` and `CrossVersion.full` in that it strips off any
|
||||
trailing `-bin-...` suffix which is used to distinguish variant but binary compatible Scala toolchain builds. Most things
|
||||
which are currently `CrossVersion.full` (eg. Scala compiler plugins, esp. macro-paradise) would be more appropriately
|
||||
depended on as `CrossVersion.patch` from this release on.
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue