From 013388724faa96bb8f604e99c7d5f2ffed6cb946 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 22 Dec 2024 17:04:28 -0500 Subject: [PATCH] Expose enableDependencyOverrides flag Ref https://github.com/coursier/coursier/issues/3190 --- .../src/main/scala/lmcoursier/CoursierConfiguration.scala | 2 ++ .../main/scala/lmcoursier/CoursierDependencyResolution.scala | 1 + .../lm-coursier/src/main/scala/lmcoursier/syntax/package.scala | 3 +++ 3 files changed, 6 insertions(+) diff --git a/modules/definitions/src/main/scala/lmcoursier/CoursierConfiguration.scala b/modules/definitions/src/main/scala/lmcoursier/CoursierConfiguration.scala index 357a11a72..5e5c313c0 100644 --- a/modules/definitions/src/main/scala/lmcoursier/CoursierConfiguration.scala +++ b/modules/definitions/src/main/scala/lmcoursier/CoursierConfiguration.scala @@ -61,4 +61,6 @@ import java.net.URLClassLoader protocolHandlerDependencies: Seq[ModuleID] = Vector.empty, retry: Option[(FiniteDuration, Int)] = None, sameVersions: Seq[Set[InclExclRule]] = Nil, + @since + enableDependencyOverrides: Option[Boolean] = None, ) diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/CoursierDependencyResolution.scala b/modules/lm-coursier/src/main/scala/lmcoursier/CoursierDependencyResolution.scala index 7dcb76e55..be3a45569 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/CoursierDependencyResolution.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/CoursierDependencyResolution.scala @@ -249,6 +249,7 @@ class CoursierDependencyResolution( .withMaxIterations(conf.maxIterations) .withProfiles(conf.mavenProfiles.toSet) .withForceVersion(conf.forceVersions.map { case (k, v) => (ToCoursier.module(k), v) }.toMap) + .withEnableDependencyOverrides(conf.enableDependencyOverrides) .withTypelevel(typelevel) .withReconciliation(ToCoursier.reconciliation(conf.reconciliation)) .withExclusions(excludeDependencies) diff --git a/modules/lm-coursier/src/main/scala/lmcoursier/syntax/package.scala b/modules/lm-coursier/src/main/scala/lmcoursier/syntax/package.scala index c4c3755b6..c5fd049a4 100644 --- a/modules/lm-coursier/src/main/scala/lmcoursier/syntax/package.scala +++ b/modules/lm-coursier/src/main/scala/lmcoursier/syntax/package.scala @@ -76,6 +76,7 @@ package object syntax { protocolHandlerDependencies = Vector.empty, retry = None, sameVersions = Nil, + enableDependencyOverrides = None, ) } @@ -112,6 +113,8 @@ package object syntax { def withRetry(retry: (FiniteDuration, Int)): CoursierConfiguration = value.withRetry(Some((retry._1, retry._2))) + def withEnableDependencyOverrides(enable: Boolean): CoursierConfiguration = + value.withEnableDependencyOverrides(Some(enable)) } implicit class PublicationOp(value: Publication) {