From 8f3a7b4f5b606ee1febf24b0ec6a007a288c31fb Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Wed, 4 Mar 2015 07:45:00 +0000 Subject: [PATCH] Exempt scala-actors-migration from version checks. Fixes #1818. --- ivy/src/main/scala/sbt/IvyScala.scala | 8 ++++++-- notes/0.13.8.markdown | 2 ++ .../actors-migration-no-warn/build.sbt | 13 +++++++++++++ .../actors-migration-no-warn/test | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 sbt/src/sbt-test/dependency-management/actors-migration-no-warn/build.sbt create mode 100644 sbt/src/sbt-test/dependency-management/actors-migration-no-warn/test diff --git a/ivy/src/main/scala/sbt/IvyScala.scala b/ivy/src/main/scala/sbt/IvyScala.scala index b4299906f..061eddeb7 100644 --- a/ivy/src/main/scala/sbt/IvyScala.scala +++ b/ivy/src/main/scala/sbt/IvyScala.scala @@ -66,7 +66,11 @@ private object IvyScala { { val id = dep.getDependencyRevisionId val depBinaryVersion = CrossVersion.binaryScalaVersion(id.getRevision) - val mismatched = id.getOrganisation == Organization && depBinaryVersion != scalaBinaryVersion && dep.getModuleConfigurations.exists(configSet) + def isScalaLangOrg = id.getOrganisation == Organization + def isNotScalaActorsMigration = !(id.getName startsWith "scala-actors-migration") // Exception to the rule: sbt/sbt#1818 + def hasBinVerMismatch = depBinaryVersion != scalaBinaryVersion + def matchesOneOfTheConfigs = dep.getModuleConfigurations.exists(configSet) + val mismatched = isScalaLangOrg && isNotScalaActorsMigration && hasBinVerMismatch && matchesOneOfTheConfigs if (mismatched) Some("Binary version (" + depBinaryVersion + ") for dependency " + id + "\n\tin " + module.getModuleRevisionId + @@ -111,4 +115,4 @@ private object IvyScala { configurationNames.foreach(rule.addConfiguration) rule } -} \ No newline at end of file +} diff --git a/notes/0.13.8.markdown b/notes/0.13.8.markdown index f35a9c981..9944d2423 100644 --- a/notes/0.13.8.markdown +++ b/notes/0.13.8.markdown @@ -39,6 +39,7 @@ [1787]: https://github.com/sbt/sbt/pull/1787 [1793]: https://github.com/sbt/sbt/pull/1793 [1817]: https://github.com/sbt/sbt/pull/1817 + [1818]: https://github.com/sbt/sbt/pull/1818 [1869]: https://github.com/sbt/sbt/issues/1869 [1871]: https://github.com/sbt/sbt/pull/1871 @@ -75,6 +76,7 @@ - Issues warning if multiple dependencies to a same library is found with different version. [#1634][1634] by [@eed3si9n][@eed3si9n] - Removes "No main class detected" warning. [#1766][1766] by [@eed3si9n][@eed3si9n] - Disable publishing on implicitly created root project by not enabling `IvyPlugin` by default (`-Dsbt.root.ivyplugin=true` will revert this behavior). [#1871][1871]/[#1869][1869] by [@dwijnand][@dwijnand] +- Exempt org.scala-lang:scala-actors-migration from scala binary version checks. [#1818][1818] by [@dwijnand][@dwijnand] ### Rolling back XML parsing workaround diff --git a/sbt/src/sbt-test/dependency-management/actors-migration-no-warn/build.sbt b/sbt/src/sbt-test/dependency-management/actors-migration-no-warn/build.sbt new file mode 100644 index 000000000..a3921655f --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/actors-migration-no-warn/build.sbt @@ -0,0 +1,13 @@ +// https://github.com/sbt/sbt/issues/1818 + +scalaVersion := "2.11.5" +libraryDependencies += "org.scala-lang" %% "scala-actors-migration" % "1.1.0" + +lazy val check = taskKey[Unit]("Runs the check") +check := { + val lastLog = BuiltinCommands lastLogFile state.value + val last = IO read lastLog.get + def containsWarn1 = last contains "Binary version (1.1.0) for dependency org.scala-lang#scala-actors-migration_2.11;1.1.0" + def containsWarn2 = last contains "differs from Scala binary version in project (2.11)." + if (containsWarn1 && containsWarn2) sys error "scala-actors-migration isn't exempted from the Scala binary version check" +} diff --git a/sbt/src/sbt-test/dependency-management/actors-migration-no-warn/test b/sbt/src/sbt-test/dependency-management/actors-migration-no-warn/test new file mode 100644 index 000000000..762c62539 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/actors-migration-no-warn/test @@ -0,0 +1,2 @@ +> update +> check