This commit is contained in:
Alexandre Archambault 2018-09-20 15:15:47 +02:00
parent fd6e56f2f8
commit 32747ab195
2 changed files with 22 additions and 18 deletions

View File

@ -1,8 +1,8 @@
package coursier.core
import coursier.Fetch
import coursier.core.compatibility.encodeURIComponent
import coursier.maven.MavenSource
import coursier.util.{EitherT, Monad}
trait Repository extends Product with Serializable {
@ -24,14 +24,22 @@ object Repository {
"SHA-1" -> (underlying.url + ".sha1"),
"SHA-256" -> (underlying.url + ".sha256")
))
def withDefaultSignature: Artifact =
def withDefaultSignature: Artifact = {
val underlyingExt =
if (underlying.attributes.`type`.isEmpty)
"jar"
else
// TODO move MavenSource.typeExtension elsewhere
MavenSource.typeExtension(underlying.attributes.`type`)
underlying.copy(extra = underlying.extra ++ Seq(
"sig" ->
Artifact(
underlying.url + ".asc",
Map.empty,
Map.empty,
Attributes("asc", ""),
Attributes(s"$underlyingExt.asc", ""),
changing = underlying.changing,
authentication = underlying.authentication
)
@ -39,4 +47,5 @@ object Repository {
))
}
}
}

View File

@ -46,7 +46,7 @@ final case class MavenSource(
)
val changing0 = changing.getOrElse(isSnapshot(project.actualVersion))
var artifact =
Artifact(
root + path.mkString("/"),
Map.empty,
@ -57,11 +57,6 @@ final case class MavenSource(
)
.withDefaultChecksums
.withDefaultSignature
if (publication.ext == "jar")
artifact = artifact.withDefaultSignature
artifact
}
val metadataArtifact = artifactOf(Publication(dependency.module.name, "pom", "pom", ""))