mirror of https://github.com/sbt/sbt.git
Add checksum to ModuleID
A checksum in a `ModuleID` ensures that the checksum of the resolved module id matches. This checksum check is done at the same time ivy checks it.
This commit is contained in:
parent
7500291dfc
commit
892f6e3775
|
|
@ -267,22 +267,33 @@
|
||||||
{ "name": "organization", "type": "String" },
|
{ "name": "organization", "type": "String" },
|
||||||
{ "name": "name", "type": "String" },
|
{ "name": "name", "type": "String" },
|
||||||
{ "name": "revision", "type": "String" },
|
{ "name": "revision", "type": "String" },
|
||||||
{ "name": "configurations", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
{ "name": "configurations", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||||
{ "name": "isChanging", "type": "boolean", "default": "false", "since": "0.0.1" },
|
{ "name": "isChanging", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||||
{ "name": "isTransitive", "type": "boolean", "default": "true", "since": "0.0.1" },
|
{ "name": "isTransitive", "type": "boolean", "default": "true", "since": "0.0.1" },
|
||||||
{ "name": "isForce", "type": "boolean", "default": "false", "since": "0.0.1" },
|
{ "name": "isForce", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||||
{ "name": "explicitArtifacts", "type": "sbt.librarymanagement.Artifact*", "default": "Vector.empty", "since": "0.0.1" },
|
{ "name": "explicitArtifacts", "type": "sbt.librarymanagement.Artifact*", "default": "Vector.empty", "since": "0.0.1" },
|
||||||
{ "name": "inclusions", "type": "sbt.librarymanagement.InclExclRule*", "default": "Vector.empty", "since": "0.0.1" },
|
{ "name": "inclusions", "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": "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"
|
||||||
],
|
],
|
||||||
"parentsCompanion": "sbt.librarymanagement.ModuleIDFunctions"
|
"parentsCompanion": "sbt.librarymanagement.ModuleIDFunctions"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Checksum",
|
||||||
|
"namespace": "sbt.librarymanagement",
|
||||||
|
"target": "Scala",
|
||||||
|
"type": "record",
|
||||||
|
"fields": [
|
||||||
|
{ "name": "digest", "type": "String" },
|
||||||
|
{ "name": "type", "type": "String", "default": "sha1" }
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ModuleInfo",
|
"name": "ModuleInfo",
|
||||||
"namespace": "sbt.librarymanagement",
|
"namespace": "sbt.librarymanagement",
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ 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,
|
||||||
|
|
@ -36,12 +37,14 @@ 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""" +
|
||||||
(configurations match { case Some(s) => ":" + s; case None => "" }) + {
|
(checksum match { case Some(s) => s": ${s.`type`} ${s.digest}"; 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