From 541bd4a6a4fdcc31683d5d17b2e91d50cedea886 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 28 Oct 2015 15:23:45 +0100 Subject: [PATCH 1/2] Fix for sbt/sbt#1933 sbt was reporting warning abouts inconsistent versions of dependencies even if these dependencies didn't have the same configuration (as in `provided` vs `compile`). This commit fixes this problem by comparing the dependencies by organization, artifact name and configuration. Fixes sbt/sbt#1933 --- ivy/src/main/scala/sbt/Ivy.scala | 8 ++++++-- ivy/src/test/scala/InconsistentDuplicateSpec.scala | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ivy/src/main/scala/sbt/Ivy.scala b/ivy/src/main/scala/sbt/Ivy.scala index b8540fd68..ef9b695e9 100644 --- a/ivy/src/main/scala/sbt/Ivy.scala +++ b/ivy/src/main/scala/sbt/Ivy.scala @@ -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 => diff --git a/ivy/src/test/scala/InconsistentDuplicateSpec.scala b/ivy/src/test/scala/InconsistentDuplicateSpec.scala index b9f4a05ef..34a5a441f 100644 --- a/ivy/src/test/scala/InconsistentDuplicateSpec.scala +++ b/ivy/src/test/scala/InconsistentDuplicateSpec.scala @@ -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 + } From 26e15c2dd43910b4f52d697370e00da0678054a5 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 28 Oct 2015 16:05:45 +0100 Subject: [PATCH 2/2] Add notes for #2258 --- notes/0.13.10/fix-duplicate-warnings.markdown | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 notes/0.13.10/fix-duplicate-warnings.markdown diff --git a/notes/0.13.10/fix-duplicate-warnings.markdown b/notes/0.13.10/fix-duplicate-warnings.markdown new file mode 100644 index 000000000..a8e9c8bed --- /dev/null +++ b/notes/0.13.10/fix-duplicate-warnings.markdown @@ -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]