Move Maven specific method closer to its usage

This commit is contained in:
Alexandre Archambault 2015-12-30 01:34:35 +01:00
parent ca17da83f1
commit eaa7874874
2 changed files with 26 additions and 23 deletions

View File

@ -38,29 +38,6 @@ object Repository {
)
.withDefaultChecksums
))
def withJavadocSources: Artifact = {
val base = underlying.url.stripSuffix(".jar")
underlying.copy(extra = underlying.extra ++ Seq(
"sources" -> Artifact(
base + "-sources.jar",
Map.empty,
Map.empty,
Attributes("jar", "src"), // Are these the right attributes?
changing = underlying.changing
)
.withDefaultChecksums
.withDefaultSignature,
"javadoc" -> Artifact(
base + "-javadoc.jar",
Map.empty,
Map.empty,
Attributes("jar", "javadoc"), // Same comment as above
changing = underlying.changing
)
.withDefaultChecksums
.withDefaultSignature
))
}
}
}

View File

@ -11,6 +11,32 @@ case class MavenSource(
import Repository._
import MavenRepository._
private implicit class DocSourcesArtifactExtensions(val underlying: Artifact) {
def withJavadocSources: Artifact = {
val base = underlying.url.stripSuffix(".jar")
underlying.copy(extra = underlying.extra ++ Seq(
"sources" -> Artifact(
base + "-sources.jar",
Map.empty,
Map.empty,
Attributes("jar", "src"), // Are these the right attributes?
changing = underlying.changing
)
.withDefaultChecksums
.withDefaultSignature,
"javadoc" -> Artifact(
base + "-javadoc.jar",
Map.empty,
Map.empty,
Attributes("jar", "javadoc"), // Same comment as above
changing = underlying.changing
)
.withDefaultChecksums
.withDefaultSignature
))
}
}
def artifacts(
dependency: Dependency,
project: Project