All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mill.scalalib.dependency.metadata.MavenMetadataLoader.scala Maven / Gradle / Ivy

There is a newer version: 0.12.0-RC2-17-07e173
Show newest version
package mill.scalalib.dependency.metadata

import coursier.maven.MavenRepository
import coursier.util.Task
import mill.scalalib.dependency.versions.Version

private[dependency] final case class MavenMetadataLoader(mavenRepo: MavenRepository)
    extends MetadataLoader {

  private val fetch = coursier.cache.FileCache[Task]().fetch

  override def getVersions(module: coursier.Module): List[Version] = {
    import scala.concurrent.ExecutionContext.Implicits.global
    // TODO fallback to 'versionsFromListing' if 'versions' doesn't work? (needs to be made public in coursier first)
    val allVersions = mavenRepo.versions(module, fetch).run.unsafeRun()
    allVersions
      .map(_._1.available.map(Version(_)))
      .getOrElse(List.empty)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy