Tweak Ivy repositories artifact handling

This commit is contained in:
Alexandre Archambault 2018-09-19 15:34:54 +02:00
parent 2775ef396b
commit 9968a12d10
2 changed files with 26 additions and 11 deletions

View File

@ -79,9 +79,12 @@ final case class IvyRepository(
}
else if (dependency.attributes.`type`.nonEmpty)
project.publications.collect {
case (_, p)
if p.classifier.isEmpty && (
p.`type` == dependency.attributes.`type` ||
case (conf, p)
if (conf == "*" ||
conf == dependency.configuration ||
project.allConfigurations.getOrElse(dependency.configuration, Set.empty).contains(conf)) &&
(
p.`type` == dependency.attributes.`type` ||
(p.ext == dependency.attributes.`type` && project.packagingOpt.toSeq.contains(p.`type`)) // wow
) =>
p

View File

@ -81,14 +81,26 @@ object IvyTests extends TestSuite {
throw new Exception(s"Unexpected number of artifacts\n${other.mkString("\n")}")
}
"test conf" - CentralTests.withArtifacts(
dep = dep.copy(configuration = "test"),
extraRepos = Seq(repo),
classifierOpt = None
) { artifacts =>
val urls = artifacts.map(_.url).toSet
assert(urls(mainJarUrl))
assert(urls(testJarUrl))
"test conf" - {
"no attributes" - CentralTests.withArtifacts(
dep = dep.copy(configuration = "test"),
extraRepos = Seq(repo),
classifierOpt = None
) { artifacts =>
val urls = artifacts.map(_.url).toSet
assert(urls(mainJarUrl))
assert(urls(testJarUrl))
}
"attributes" - CentralTests.withArtifacts(
dep = dep.copy(configuration = "test", attributes = Attributes("jar")),
extraRepos = Seq(repo),
classifierOpt = None
) { artifacts =>
val urls = artifacts.map(_.url).toSet
assert(urls(mainJarUrl))
assert(urls(testJarUrl))
}
}
"tests classifier" - {