Temporary hack

to minimize the chance of two different Artifact to have the same URL -
these are handled well by the cache if the corresponding URL has not
been downloaded yet, and result in one download locking the file for the
others
This commit is contained in:
Alexandre Archambault 2016-04-18 00:28:54 +02:00
parent 51fefe5c29
commit e5be2c4c2c
No known key found for this signature in database
GPG Key ID: 14640A6839C263A9
2 changed files with 14 additions and 6 deletions

View File

@ -885,7 +885,10 @@ final case class Resolution(
.getOrElse(Map.empty)
)
private def artifacts0(overrideClassifiers: Option[Seq[String]]): Seq[Artifact] = {
private def artifacts0(
overrideClassifiers: Option[Seq[String]],
keepAttributes: Boolean
): Seq[Artifact] = {
val res = for {
dep <- minDependencies.toSeq
(source, proj) <- projectCache
@ -893,16 +896,19 @@ final case class Resolution(
.toSeq
artifact <- source
.artifacts(dep, proj, overrideClassifiers)
} yield artifact
} yield (if (keepAttributes) artifact else artifact.copy(attributes = Attributes("", "")))
res.distinct
}
// temporary hack :-|
// if one wants the attributes field of artifacts not to be cleared, call dependencyArtifacts
def classifiersArtifacts(classifiers: Seq[String]): Seq[Artifact] =
artifacts0(Some(classifiers))
artifacts0(Some(classifiers), keepAttributes = false)
def artifacts: Seq[Artifact] =
artifacts0(None)
artifacts0(None, keepAttributes = false)
private def dependencyArtifacts0(overrideClassifiers: Option[Seq[String]]): Seq[(Dependency, Artifact)] =
for {

View File

@ -581,9 +581,11 @@ object Tasks {
}.toSet
def artifactFileOpt(artifact: Artifact) = {
val res = artifactFiles.get(artifact)
val artifact0 = artifact
.copy(attributes = Attributes()) // temporary hack :-(
val res = artifactFiles.get(artifact0)
if (res.isEmpty && !erroredArtifacts(artifact))
if (res.isEmpty && !erroredArtifacts(artifact0))
log.error(s"${artifact.url} not downloaded (should not happen)")
res