From 2c3ea28cad56741824218d67040fb6ead90ad91f Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Wed, 20 Nov 2024 15:29:15 +0100 Subject: [PATCH] bugfix: Fix compilation error and make sure cli module is compiled --- .github/workflows/ci.yml | 1 + .../main/scala/bloop/cli/util/Artifacts.scala | 2 +- .../scala/bloop/cli/util/CoursierUtils.scala | 17 +++++++++++++---- project/Dependencies.scala | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1eb8c7ea6..51d993f41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,6 +123,7 @@ jobs: "frontend/test:compile; \ backend/test; \ docs/compile; \ + cli/compile; \ bloopRifle/test; \ frontend/testOnly bloop.ScalaVersionsSpec; \ frontend/testOnly -bloop.ScalaVersionsSpec; \ diff --git a/cli/src/main/scala/bloop/cli/util/Artifacts.scala b/cli/src/main/scala/bloop/cli/util/Artifacts.scala index 01e2248ea..656092870 100644 --- a/cli/src/main/scala/bloop/cli/util/Artifacts.scala +++ b/cli/src/main/scala/bloop/cli/util/Artifacts.scala @@ -53,7 +53,7 @@ object Artifacts { val maybeCoursierDependencies = { val seq = dependencies .map { dep => - val maybeUrl = dep.userParams.get("url").flatten + val maybeUrl = dep.getUserParam("url") if (maybeUrl.nonEmpty) sys.error("unsupported") dep diff --git a/cli/src/main/scala/bloop/cli/util/CoursierUtils.scala b/cli/src/main/scala/bloop/cli/util/CoursierUtils.scala index fbf89d43b..44251b573 100644 --- a/cli/src/main/scala/bloop/cli/util/CoursierUtils.scala +++ b/cli/src/main/scala/bloop/cli/util/CoursierUtils.scala @@ -26,6 +26,14 @@ object CoursierUtils { } } + implicit class AnyDependencyOps(private val dep: dependency.AnyDependency) extends AnyVal { + def getUserParam(key: String) = { + dep.userParams.collectFirst { + case (`key`, value) => value + }.flatten + } + } + implicit class DependencyOps(private val dep: dependency.Dependency) extends AnyVal { def toCs: coursier.Dependency = { val mod = dep.module.toCs @@ -36,13 +44,14 @@ object CoursierUtils { (coursier.Organization(mod.organization), coursier.ModuleName(mod.name)) } } - for (clOpt <- dep.userParams.get("classifier"); cl <- clOpt) + + for (cl <- dep.getUserParam("classifier")) dep0 = dep0.withPublication(dep0.publication.withClassifier(coursier.core.Classifier(cl))) - for (tpeOpt <- dep.userParams.get("type"); tpe <- tpeOpt) + for (tpe <- dep.getUserParam("type")) dep0 = dep0.withPublication(dep0.publication.withType(coursier.core.Type(tpe))) - for (extOpt <- dep.userParams.get("ext"); ext <- extOpt) + for (ext <- dep.getUserParam("ext")) dep0 = dep0.withPublication(dep0.publication.withExt(coursier.core.Extension(ext))) - for (_ <- dep.userParams.get("intransitive")) + for (_ <- dep.getUserParam("intransitive")) dep0 = dep0.withTransitive(false) dep0 } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 424f6fa75..8dfecc238 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -62,7 +62,7 @@ object Dependencies { val svm = "org.graalvm.nativeimage" % "svm" % "24.1.1" val coursier = "io.get-coursier" %% "coursier" % coursierVersion val coursierJvm = "io.get-coursier" %% "coursier-jvm" % coursierVersion - val dependency = "io.get-coursier" %% "dependency" % "0.2.4" + val dependency = "io.get-coursier" %% "dependency" % "0.3.1" val scalaCollectionCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0" val shapeless = "com.chuusai" %% "shapeless" % shapelessVersion val caseApp = "com.github.alexarchambault" %% "case-app" % caseAppVersion