From 8d7bd67593e50832e474dd819726bcc9ae0e6cfe Mon Sep 17 00:00:00 2001 From: Hua Jiang Date: Tue, 25 Jun 2024 19:45:54 +0800 Subject: [PATCH] fix runtime dependency resolution issue --- .../scala/sbtversionpolicy/SbtVersionPolicySettings.scala | 2 +- .../scala/sbtversionpolicy/internal/DependencyCheck.scala | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sbt-version-policy/src/main/scala/sbtversionpolicy/SbtVersionPolicySettings.scala b/sbt-version-policy/src/main/scala/sbtversionpolicy/SbtVersionPolicySettings.scala index 4da66fd..ca416fe 100644 --- a/sbt-version-policy/src/main/scala/sbtversionpolicy/SbtVersionPolicySettings.scala +++ b/sbt-version-policy/src/main/scala/sbtversionpolicy/SbtVersionPolicySettings.scala @@ -113,7 +113,7 @@ object SbtVersionPolicySettings { val sv = scalaVersion.value val sbv = scalaBinaryVersion.value - val compileReport = update.value.configuration(Compile).getOrElse { + val compileReport = update.value.configuration(Runtime).getOrElse { sys.error("Compile configuration not found in update report") } diff --git a/sbt-version-policy/src/main/scala/sbtversionpolicy/internal/DependencyCheck.scala b/sbt-version-policy/src/main/scala/sbtversionpolicy/internal/DependencyCheck.scala index 3a0ae67..4832f08 100644 --- a/sbt-version-policy/src/main/scala/sbtversionpolicy/internal/DependencyCheck.scala +++ b/sbt-version-policy/src/main/scala/sbtversionpolicy/internal/DependencyCheck.scala @@ -2,9 +2,8 @@ package sbtversionpolicy.internal import coursier.version.{ModuleMatchers, VersionCompatibility} import sbt.Compile -import sbt.librarymanagement.{ConfigurationReport, CrossVersion, ModuleID} +import sbt.librarymanagement.{ConfigurationReport, CrossVersion, DependencyResolution, ModuleID, ScalaModuleInfo, UnresolvedWarningConfiguration, UpdateConfiguration, syntax} import sbt.util.Logger -import sbt.librarymanagement.{DependencyResolution, ScalaModuleInfo, UnresolvedWarningConfiguration, UpdateConfiguration} import sbtversionpolicy.DependencyCheckReport object DependencyCheck { @@ -66,7 +65,7 @@ object DependencyCheck { val previousReport = depRes.update(mod, updateConfig, warningConfig, log) .fold(thing => throw thing.resolveException, identity) - val previousCompileReport = previousReport.configuration(Compile).getOrElse { + val previousCompileReport = previousReport.configuration(syntax.Runtime).getOrElse { sys.error(s"Compile configuration not found in previous update report $previousReport") } val previousDependencies = DependencyCheck.modulesOf(previousCompileReport, excludedModules, sv, sbv, moduleToVersion, log)