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) else if (dependency.attributes.`type`.nonEmpty)
project.publications.collect { project.publications.collect {
case (_, p) case (conf, p)
if p.classifier.isEmpty && ( if (conf == "*" ||
p.`type` == dependency.attributes.`type` || 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.ext == dependency.attributes.`type` && project.packagingOpt.toSeq.contains(p.`type`)) // wow
) => ) =>
p p

View File

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