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": "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": "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"
|
||||
},
|
||||
|
|
@ -276,8 +277,7 @@
|
|||
{ "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": "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": "checksum", "type": "Option[sbt.librarymanagement.Checksum]", "default": "None", "since": "0.0.1" }
|
||||
{ "name": "branchName", "type": "Option[String]", "default": "None", "since": "0.0.1" }
|
||||
],
|
||||
"toString": [
|
||||
"this.toStringImpl"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ abstract class ArtifactExtra {
|
|||
def configurations: Vector[Configuration]
|
||||
def url: Option[URL]
|
||||
def extraAttributes: Map[String, String]
|
||||
def checksum: Option[Checksum]
|
||||
|
||||
protected[this] def copy(
|
||||
name: String = name,
|
||||
|
|
@ -22,7 +23,8 @@ abstract class ArtifactExtra {
|
|||
classifier: Option[String] = classifier,
|
||||
configurations: Vector[Configuration] = configurations,
|
||||
url: Option[URL] = url,
|
||||
extraAttributes: Map[String, String] = extraAttributes
|
||||
extraAttributes: Map[String, String] = extraAttributes,
|
||||
checksum: Option[Checksum] = checksum
|
||||
): Artifact
|
||||
|
||||
def extra(attributes: (String, String)*) =
|
||||
|
|
@ -33,7 +35,7 @@ import Configurations.{ Optional, Pom, Test }
|
|||
|
||||
abstract class ArtifactFunctions {
|
||||
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 =
|
||||
Artifact(name, DefaultType, DefaultExtension, Some(classifier), Vector.empty, None)
|
||||
def apply(name: String, `type`: String, extension: String): Artifact =
|
||||
|
|
@ -50,6 +52,7 @@ abstract class ArtifactFunctions {
|
|||
Some(url)
|
||||
)
|
||||
|
||||
private final val empty = Map.empty[String, String]
|
||||
def apply(
|
||||
name: String,
|
||||
`type`: String,
|
||||
|
|
@ -57,8 +60,7 @@ abstract class ArtifactFunctions {
|
|||
classifier: Option[String],
|
||||
configurations: Vector[Configuration],
|
||||
url: Option[URL]
|
||||
): Artifact =
|
||||
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty[String, String])
|
||||
): Artifact = Artifact(name, `type`, extension, classifier, configurations, url, empty, None)
|
||||
|
||||
val DefaultExtension = "jar"
|
||||
val DefaultType = "jar"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ abstract class ModuleIDExtra {
|
|||
def extraAttributes: Map[String, String]
|
||||
def crossVersion: CrossVersion
|
||||
def branchName: Option[String]
|
||||
def checksum: Option[Checksum]
|
||||
|
||||
protected[this] def copy(
|
||||
organization: String = organization,
|
||||
|
|
@ -37,14 +36,12 @@ abstract class ModuleIDExtra {
|
|||
exclusions: Vector[ExclusionRule] = exclusions,
|
||||
extraAttributes: Map[String, String] = extraAttributes,
|
||||
crossVersion: CrossVersion = crossVersion,
|
||||
branchName: Option[String] = branchName,
|
||||
checksum: Option[Checksum] = checksum
|
||||
branchName: Option[String] = branchName
|
||||
): ModuleID
|
||||
|
||||
protected def toStringImpl: String =
|
||||
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
|
||||
if (attr == "") ""
|
||||
else " " + attr
|
||||
|
|
|
|||
Loading…
Reference in New Issue