diff --git a/ivy/src/main/scala/sbt/IvyScala.scala b/ivy/src/main/scala/sbt/IvyScala.scala index 19bb50207..0c43f662b 100644 --- a/ivy/src/main/scala/sbt/IvyScala.scala +++ b/ivy/src/main/scala/sbt/IvyScala.scala @@ -51,7 +51,7 @@ private object IvyScala { /** Performs checks/adds filters on Scala dependencies (if enabled in IvyScala). */ def checkModule(module: DefaultModuleDescriptor, conf: String, scalaVersionConfigs: Vector[String], log: Logger)(check: IvyScala): Unit = { if (check.checkExplicit) - checkDependencies(module, check.scalaOrganization, check.scalaBinaryVersion, check.configurations, log) + checkDependencies(module, check.scalaOrganization, check.scalaBinaryVersion, scalaVersionConfigs, log) if (check.filterImplicit) excludeScalaJars(module, check.configurations) if (check.overrideScalaVersion) @@ -100,8 +100,8 @@ private object IvyScala { * Checks the immediate dependencies of module for dependencies on scala jars and verifies that the version on the * dependencies matches scalaVersion. */ - private def checkDependencies(module: ModuleDescriptor, scalaOrganization: String, scalaBinaryVersion: String, configurations: Iterable[Configuration], log: Logger): Unit = { - val configSet = if (configurations.isEmpty) (c: String) => true else configurationSet(configurations) + private def checkDependencies(module: ModuleDescriptor, scalaOrganization: String, scalaBinaryVersion: String, scalaVersionConfigs0: Vector[String], log: Logger): Unit = { + val scalaVersionConfigs: String => Boolean = if (scalaVersionConfigs0.isEmpty) (c: String) => false else scalaVersionConfigs0.toSet def binaryScalaWarning(dep: DependencyDescriptor): Option[String] = { val id = dep.getDependencyRevisionId @@ -109,7 +109,7 @@ private object IvyScala { def isScalaLangOrg = id.getOrganisation == scalaOrganization def isScalaArtifact = Artifacts.contains(id.getName) def hasBinVerMismatch = depBinaryVersion != scalaBinaryVersion - def matchesOneOfTheConfigs = dep.getModuleConfigurations.exists(configSet) + def matchesOneOfTheConfigs = dep.getModuleConfigurations exists { scalaVersionConfigs } val mismatched = isScalaLangOrg && isScalaArtifact && hasBinVerMismatch && matchesOneOfTheConfigs if (mismatched) Some("Binary version (" + depBinaryVersion + ") for dependency " + id + diff --git a/notes/0.13.14/mediator_fix.md b/notes/0.13.14/mediator_fix.md index ad0502a34..1e162c311 100644 --- a/notes/0.13.14/mediator_fix.md +++ b/notes/0.13.14/mediator_fix.md @@ -1,9 +1,12 @@ ### Bug fixes - Fixes a regression in sbt 0.13.12 that was misfiring Scala version enforcement when configuration does not extend `Compile`. [#2827][2827]/[#2786][2786] by [@eed3si9n][@eed3si9n] +- Fixes Scala binary version checking misfiring on configurations that do not extend `Compile`. [#2828][2828]/[#1466][1466] by [@eed3si9n][@eed3si9n] + [1466]: https://github.com/sbt/sbt/issues/1466 [2786]: https://github.com/sbt/sbt/issues/2786 [2827]: https://github.com/sbt/sbt/pull/2827 + [2828]: https://github.com/sbt/sbt/pull/2828 [@eed3si9n]: https://github.com/eed3si9n [@dwijnand]: https://github.com/dwijnand [@Duhemm]: https://github.com/Duhemm