From 09c5ce417a6bdedae44f713b5589ee777d16e7cf Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 20 Sep 2017 00:12:20 +0200 Subject: [PATCH] Quick hack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures something sometimes random is not in some conditions, see https://github.com/coursier/coursier/issues/650… --- .../src/main/scala/coursier/ToSbt.scala | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sbt-coursier/src/main/scala/coursier/ToSbt.scala b/sbt-coursier/src/main/scala/coursier/ToSbt.scala index 875115fb6..2c4db0c9e 100644 --- a/sbt-coursier/src/main/scala/coursier/ToSbt.scala +++ b/sbt-coursier/src/main/scala/coursier/ToSbt.scala @@ -221,9 +221,25 @@ object ToSbt { includeSignatures = includeSignatures ) + val reports0 = + if (subRes.rootDependencies.size == 1) { + // quick hack ensuring the module for the only root dependency + // appears first in the update report, see https://github.com/coursier/coursier/issues/650 + val dep = subRes.rootDependencies.head + val (_, proj) = subRes.projectCache(dep.moduleVersion) + val mod = ToSbt.moduleId(dep, proj.properties.toMap) + val (main, other) = reports.partition { r => + r.module.organization == mod.organization && + r.module.name == mod.name && + r.module.crossVersion == mod.crossVersion + } + main.toVector ++ other.toVector + } else + reports.toVector + sbt.ConfigurationReport( ConfigRef(config), - reports.toVector, + reports0, Vector() ) }