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

ammonite.interp.api.IvyConstructor.scala Maven / Gradle / Ivy

There is a newer version: 3.0.0-M0-67-83057fea
Show newest version
package ammonite.interp.api

import coursierapi.{Dependency, Module}

case class ScalaVersion(value: String)

object IvyConstructor extends IvyConstructor {

  def scalaBinaryVersion(sv: String) = {
    val retain = if (sv.startsWith("2")) 2 else 1
    sv.split('.').take(retain).mkString(".")
  }

}
trait IvyConstructor{
  implicit class GroupIdExt(groupId: String){
    def %(artifactId: String) = Module.of(groupId, artifactId)
    def %%(artifactId: String)(implicit sv: ScalaVersion) = Module.of(
      groupId,
      artifactId + "_" + IvyConstructor.scalaBinaryVersion(sv.value)
    )
  }
  implicit class ArtifactIdExt(t: Module){
    def %(version: String) = Dependency.of(t, version)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy