mirror of https://github.com/sbt/sbt.git
Apply binary version conflict check to Compile related configs
Fixes #1466 Ref #2786 Even after fixing the mediator issue, we still have spurious binary version conflict warning that does not account for sandbox configurations. This change follows the scalaVersionConfigs work.
This commit is contained in:
parent
07e2a9a799
commit
7d6c56e391
|
|
@ -51,7 +51,7 @@ private object IvyScala {
|
||||||
/** Performs checks/adds filters on Scala dependencies (if enabled in 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 = {
|
def checkModule(module: DefaultModuleDescriptor, conf: String, scalaVersionConfigs: Vector[String], log: Logger)(check: IvyScala): Unit = {
|
||||||
if (check.checkExplicit)
|
if (check.checkExplicit)
|
||||||
checkDependencies(module, check.scalaOrganization, check.scalaBinaryVersion, check.configurations, log)
|
checkDependencies(module, check.scalaOrganization, check.scalaBinaryVersion, scalaVersionConfigs, log)
|
||||||
if (check.filterImplicit)
|
if (check.filterImplicit)
|
||||||
excludeScalaJars(module, check.configurations)
|
excludeScalaJars(module, check.configurations)
|
||||||
if (check.overrideScalaVersion)
|
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
|
* Checks the immediate dependencies of module for dependencies on scala jars and verifies that the version on the
|
||||||
* dependencies matches scalaVersion.
|
* dependencies matches scalaVersion.
|
||||||
*/
|
*/
|
||||||
private def checkDependencies(module: ModuleDescriptor, scalaOrganization: String, scalaBinaryVersion: String, configurations: Iterable[Configuration], log: Logger): Unit = {
|
private def checkDependencies(module: ModuleDescriptor, scalaOrganization: String, scalaBinaryVersion: String, scalaVersionConfigs0: Vector[String], log: Logger): Unit = {
|
||||||
val configSet = if (configurations.isEmpty) (c: String) => true else configurationSet(configurations)
|
val scalaVersionConfigs: String => Boolean = if (scalaVersionConfigs0.isEmpty) (c: String) => false else scalaVersionConfigs0.toSet
|
||||||
def binaryScalaWarning(dep: DependencyDescriptor): Option[String] =
|
def binaryScalaWarning(dep: DependencyDescriptor): Option[String] =
|
||||||
{
|
{
|
||||||
val id = dep.getDependencyRevisionId
|
val id = dep.getDependencyRevisionId
|
||||||
|
|
@ -109,7 +109,7 @@ private object IvyScala {
|
||||||
def isScalaLangOrg = id.getOrganisation == scalaOrganization
|
def isScalaLangOrg = id.getOrganisation == scalaOrganization
|
||||||
def isScalaArtifact = Artifacts.contains(id.getName)
|
def isScalaArtifact = Artifacts.contains(id.getName)
|
||||||
def hasBinVerMismatch = depBinaryVersion != scalaBinaryVersion
|
def hasBinVerMismatch = depBinaryVersion != scalaBinaryVersion
|
||||||
def matchesOneOfTheConfigs = dep.getModuleConfigurations.exists(configSet)
|
def matchesOneOfTheConfigs = dep.getModuleConfigurations exists { scalaVersionConfigs }
|
||||||
val mismatched = isScalaLangOrg && isScalaArtifact && hasBinVerMismatch && matchesOneOfTheConfigs
|
val mismatched = isScalaLangOrg && isScalaArtifact && hasBinVerMismatch && matchesOneOfTheConfigs
|
||||||
if (mismatched)
|
if (mismatched)
|
||||||
Some("Binary version (" + depBinaryVersion + ") for dependency " + id +
|
Some("Binary version (" + depBinaryVersion + ") for dependency " + id +
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
### Bug fixes
|
### 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 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
|
[2786]: https://github.com/sbt/sbt/issues/2786
|
||||||
[2827]: https://github.com/sbt/sbt/pull/2827
|
[2827]: https://github.com/sbt/sbt/pull/2827
|
||||||
|
[2828]: https://github.com/sbt/sbt/pull/2828
|
||||||
[@eed3si9n]: https://github.com/eed3si9n
|
[@eed3si9n]: https://github.com/eed3si9n
|
||||||
[@dwijnand]: https://github.com/dwijnand
|
[@dwijnand]: https://github.com/dwijnand
|
||||||
[@Duhemm]: https://github.com/Duhemm
|
[@Duhemm]: https://github.com/Duhemm
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue