Merge pull request #2258 from Duhemm/fix-1933

Fix for sbt/sbt#1933
This commit is contained in:
eugene yokota 2015-11-10 15:00:00 -05:00
commit 8603e24dbb
3 changed files with 24 additions and 2 deletions

View File

@ -536,14 +536,18 @@ private[sbt] object IvySbt {
{
import IvyRetrieve.toModuleID
val dds = moduleID.getDependencies
inconsistentDuplicateWarning(dds map { dd => toModuleID(dd.getDependencyRevisionId) })
val deps = dds flatMap { dd =>
val module = toModuleID(dd.getDependencyRevisionId)
dd.getModuleConfigurations map (c => module.copy(configurations = Some(c)))
}
inconsistentDuplicateWarning(deps)
}
def inconsistentDuplicateWarning(dependencies: Seq[ModuleID]): List[String] =
{
val warningHeader = "Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:"
val out: mutable.ListBuffer[String] = mutable.ListBuffer()
(dependencies groupBy { dep => (dep.organization, dep.name) }) foreach {
(dependencies groupBy { dep => (dep.organization, dep.name, dep.configurations) }) foreach {
case (k, vs) if vs.size > 1 =>
val v0 = vs.head
(vs find { _.revision != v0.revision }) foreach { v =>

View File

@ -9,6 +9,7 @@ class InconsistentDuplicateSpec extends Specification {
Duplicate with different version should
be warned $warn1
not be warned if in different configurations $nodupe2
Duplicate with same version should
not be warned $nodupe1
@ -25,4 +26,8 @@ class InconsistentDuplicateSpec extends Specification {
def nodupe1 =
IvySbt.inconsistentDuplicateWarning(Seq(akkaActor230Test, akkaActor230)) must_== Nil
def nodupe2 =
IvySbt.inconsistentDuplicateWarning(Seq(akkaActor214, akkaActor230Test)) must_== Nil
}

View File

@ -0,0 +1,13 @@
[@Duhemm]: http://github.com/Duhemm
[1933]: https://github.com/sbt/sbt/issues/1933
[2258]: https://github.com/sbt/sbt/pull/2258
### Fixes with compatibility implications
### Improvements
### Bug fixes
- Fixes [#1933][1933] duplicate warnings for artifacts in distinct configurations [#2258][2258] by
[@Duhemm][@Duhemm]