mirror of https://github.com/sbt/sbt.git
Add prefix support to Binary/Full
This commit is contained in:
parent
87e8d87811
commit
fb049d181b
|
|
@ -138,12 +138,16 @@
|
|||
"namespace": "sbt.librarymanagement",
|
||||
"target": "Scala",
|
||||
"doc": [
|
||||
"Cross-versions a module using the result of appending `suffix` to the binary version.",
|
||||
"For example, if `suffix = \"_foo\"` and the binary version is \"2.10\",",
|
||||
"the module is cross-versioned with \"2.10_foo\"."
|
||||
"Cross-versions a module using the result of",
|
||||
"prepending `prefix` and appending `suffix` to the binary version.",
|
||||
"For example, if `prefix = \"foo_\"` and `suffix = \"_bar\"` and the binary version is \"2.10\",",
|
||||
"the module is cross-versioned with \"foo_2.10_bar\"."
|
||||
],
|
||||
"type": "record",
|
||||
"fields": [ { "name": "suffix", "type": "String", "default": "\"\"", "since": "0.0.1" } ]
|
||||
"fields": [
|
||||
{ "name": "prefix", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "suffix", "type": "String", "default": "\"\"", "since": "0.0.1" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Patch",
|
||||
|
|
@ -161,11 +165,15 @@
|
|||
"target": "Scala",
|
||||
"type": "record",
|
||||
"doc": [
|
||||
"Cross-versions a module with the result of appending `suffix` to the full version.",
|
||||
"For example, if `suffix = \"_foo\"` and the full version is \"2.12.1\",",
|
||||
"the module is cross-versioned with \"2.12.1_foo\"."
|
||||
"Cross-versions a module with the result of",
|
||||
"prepending `prefix` and appending `suffix` to the full version.",
|
||||
"For example, if `prefix = \"foo_\"` and `suffix = \"_bar\"` and the full version is \"2.12.1\",",
|
||||
"the module is cross-versioned with \"foo_2.12.1_bar\"."
|
||||
],
|
||||
"fields": [ { "name": "suffix", "type": "String", "default": "\"\"", "since": "0.0.1" } ]
|
||||
"fields": [
|
||||
{ "name": "prefix", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "suffix", "type": "String", "default": "\"\"", "since": "0.0.1" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"parentsCompanion": "sbt.librarymanagement.CrossVersionFunctions"
|
||||
|
|
|
|||
|
|
@ -16,19 +16,19 @@ abstract class CrossVersionFunctions {
|
|||
def full: CrossVersion = Full()
|
||||
|
||||
/**
|
||||
* Cross-versions a module with the result of appending `suffix` to the full version.
|
||||
* Cross-versions a module with the result of prepending `prefix` and appending `suffix` to the full version.
|
||||
* (typically the full Scala version). See also [[sbt.librarymanagement.Full]]
|
||||
*/
|
||||
def fullSuffixed(suffix: String): CrossVersion = Full(suffix)
|
||||
def fullWith(prefix: String, suffix: String): CrossVersion = Full(prefix, suffix)
|
||||
|
||||
/** Cross-versions a module with the binary version (typically the binary Scala version). */
|
||||
def binary: CrossVersion = Binary()
|
||||
|
||||
/**
|
||||
* Cross-versions a module with the result of appending `suffix` to the binary version
|
||||
* Cross-versions a module with the result of prepending `prefix` and appending `suffix` to the binary version
|
||||
* (typically the binary Scala version). See also [[sbt.librarymanagement.Binary]].
|
||||
*/
|
||||
def binarySuffixed(suffix: String): CrossVersion = Binary(suffix)
|
||||
def binaryWith(prefix: String, suffix: String): CrossVersion = Binary(prefix, suffix)
|
||||
|
||||
/**
|
||||
* Cross-versions a module with the full Scala version excluding any `-bin` suffix.
|
||||
|
|
@ -53,9 +53,9 @@ abstract class CrossVersionFunctions {
|
|||
def apply(cross: CrossVersion, fullVersion: String, binaryVersion: String): Option[String => String] =
|
||||
cross match {
|
||||
case _: Disabled => None
|
||||
case b: Binary => append(binaryVersion + b.suffix)
|
||||
case b: Binary => append(b.prefix + binaryVersion + b.suffix)
|
||||
case _: Patch => append(patchFun(fullVersion))
|
||||
case f: Full => append(fullVersion + f.suffix)
|
||||
case f: Full => append(f.prefix + fullVersion + f.suffix)
|
||||
}
|
||||
|
||||
/** Constructs the cross-version function defined by `module` and `is`, if one is configured. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue