mirror of https://github.com/sbt/sbt.git
Move checksum to artifact
This is a more elegant solution than before since module IDs can bring different artifacts (in updateClassifiers, for instance).
This commit is contained in:
parent
27bf130853
commit
9d0dfce869
|
|
@ -15,7 +15,8 @@
|
||||||
{ "name": "classifier", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
{ "name": "classifier", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*", "default": "Vector.empty", "since": "0.0.1" },
|
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*", "default": "Vector.empty", "since": "0.0.1" },
|
||||||
{ "name": "url", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
{ "name": "url", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" }
|
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" },
|
||||||
|
{ "name": "checksum", "type": "Option[sbt.librarymanagement.Checksum]", "default": "None", "since": "0.0.1" }
|
||||||
],
|
],
|
||||||
"parentsCompanion": "sbt.librarymanagement.ArtifactFunctions"
|
"parentsCompanion": "sbt.librarymanagement.ArtifactFunctions"
|
||||||
},
|
},
|
||||||
|
|
@ -276,8 +277,7 @@
|
||||||
{ "name": "exclusions", "type": "sbt.librarymanagement.InclExclRule*", "default": "Vector.empty", "since": "0.0.1" },
|
{ "name": "exclusions", "type": "sbt.librarymanagement.InclExclRule*", "default": "Vector.empty", "since": "0.0.1" },
|
||||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" },
|
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" },
|
||||||
{ "name": "crossVersion", "type": "sbt.librarymanagement.CrossVersion", "default": "sbt.librarymanagement.Disabled()", "since": "0.0.1" },
|
{ "name": "crossVersion", "type": "sbt.librarymanagement.CrossVersion", "default": "sbt.librarymanagement.Disabled()", "since": "0.0.1" },
|
||||||
{ "name": "branchName", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
{ "name": "branchName", "type": "Option[String]", "default": "None", "since": "0.0.1" }
|
||||||
{ "name": "checksum", "type": "Option[sbt.librarymanagement.Checksum]", "default": "None", "since": "0.0.1" }
|
|
||||||
],
|
],
|
||||||
"toString": [
|
"toString": [
|
||||||
"this.toStringImpl"
|
"this.toStringImpl"
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ abstract class ArtifactExtra {
|
||||||
def configurations: Vector[Configuration]
|
def configurations: Vector[Configuration]
|
||||||
def url: Option[URL]
|
def url: Option[URL]
|
||||||
def extraAttributes: Map[String, String]
|
def extraAttributes: Map[String, String]
|
||||||
|
def checksum: Option[Checksum]
|
||||||
|
|
||||||
protected[this] def copy(
|
protected[this] def copy(
|
||||||
name: String = name,
|
name: String = name,
|
||||||
|
|
@ -22,7 +23,8 @@ abstract class ArtifactExtra {
|
||||||
classifier: Option[String] = classifier,
|
classifier: Option[String] = classifier,
|
||||||
configurations: Vector[Configuration] = configurations,
|
configurations: Vector[Configuration] = configurations,
|
||||||
url: Option[URL] = url,
|
url: Option[URL] = url,
|
||||||
extraAttributes: Map[String, String] = extraAttributes
|
extraAttributes: Map[String, String] = extraAttributes,
|
||||||
|
checksum: Option[Checksum] = checksum
|
||||||
): Artifact
|
): Artifact
|
||||||
|
|
||||||
def extra(attributes: (String, String)*) =
|
def extra(attributes: (String, String)*) =
|
||||||
|
|
@ -33,7 +35,7 @@ import Configurations.{ Optional, Pom, Test }
|
||||||
|
|
||||||
abstract class ArtifactFunctions {
|
abstract class ArtifactFunctions {
|
||||||
def apply(name: String, extra: Map[String, String]): Artifact =
|
def apply(name: String, extra: Map[String, String]): Artifact =
|
||||||
Artifact(name, DefaultType, DefaultExtension, None, Vector.empty, None, extra)
|
Artifact(name, DefaultType, DefaultExtension, None, Vector.empty, None, extra, None)
|
||||||
def apply(name: String, classifier: String): Artifact =
|
def apply(name: String, classifier: String): Artifact =
|
||||||
Artifact(name, DefaultType, DefaultExtension, Some(classifier), Vector.empty, None)
|
Artifact(name, DefaultType, DefaultExtension, Some(classifier), Vector.empty, None)
|
||||||
def apply(name: String, `type`: String, extension: String): Artifact =
|
def apply(name: String, `type`: String, extension: String): Artifact =
|
||||||
|
|
@ -50,6 +52,7 @@ abstract class ArtifactFunctions {
|
||||||
Some(url)
|
Some(url)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private final val empty = Map.empty[String, String]
|
||||||
def apply(
|
def apply(
|
||||||
name: String,
|
name: String,
|
||||||
`type`: String,
|
`type`: String,
|
||||||
|
|
@ -57,8 +60,7 @@ abstract class ArtifactFunctions {
|
||||||
classifier: Option[String],
|
classifier: Option[String],
|
||||||
configurations: Vector[Configuration],
|
configurations: Vector[Configuration],
|
||||||
url: Option[URL]
|
url: Option[URL]
|
||||||
): Artifact =
|
): Artifact = Artifact(name, `type`, extension, classifier, configurations, url, empty, None)
|
||||||
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty[String, String])
|
|
||||||
|
|
||||||
val DefaultExtension = "jar"
|
val DefaultExtension = "jar"
|
||||||
val DefaultType = "jar"
|
val DefaultType = "jar"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ abstract class ModuleIDExtra {
|
||||||
def extraAttributes: Map[String, String]
|
def extraAttributes: Map[String, String]
|
||||||
def crossVersion: CrossVersion
|
def crossVersion: CrossVersion
|
||||||
def branchName: Option[String]
|
def branchName: Option[String]
|
||||||
def checksum: Option[Checksum]
|
|
||||||
|
|
||||||
protected[this] def copy(
|
protected[this] def copy(
|
||||||
organization: String = organization,
|
organization: String = organization,
|
||||||
|
|
@ -37,14 +36,12 @@ abstract class ModuleIDExtra {
|
||||||
exclusions: Vector[ExclusionRule] = exclusions,
|
exclusions: Vector[ExclusionRule] = exclusions,
|
||||||
extraAttributes: Map[String, String] = extraAttributes,
|
extraAttributes: Map[String, String] = extraAttributes,
|
||||||
crossVersion: CrossVersion = crossVersion,
|
crossVersion: CrossVersion = crossVersion,
|
||||||
branchName: Option[String] = branchName,
|
branchName: Option[String] = branchName
|
||||||
checksum: Option[Checksum] = checksum
|
|
||||||
): ModuleID
|
): ModuleID
|
||||||
|
|
||||||
protected def toStringImpl: String =
|
protected def toStringImpl: String =
|
||||||
s"""$organization:$name:$revision""" +
|
s"""$organization:$name:$revision""" +
|
||||||
(checksum match { case Some(s) => s": ${s.`type`} ${s.digest}"; case None => "" }) +
|
(configurations match { case Some(s) => ":" + s; case None => "" }) + {
|
||||||
(configurations match { case Some(s) => ":" + s; case None => "" }) + {
|
|
||||||
val attr = attributeString
|
val attr = attributeString
|
||||||
if (attr == "") ""
|
if (attr == "") ""
|
||||||
else " " + attr
|
else " " + attr
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue