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 }