mill.scalalib.publish.Ivy.scala Maven / Gradle / Ivy
The newest version!
package mill.scalalib.publish
import mill.api.Loose.Agg
import scala.xml.{Elem, PrettyPrinter}
object Ivy {
val head = "\n"
def apply(
artifact: Artifact,
dependencies: Agg[Dependency],
extras: Seq[PublishInfo] = Seq.empty
): String = {
def renderExtra(e: PublishInfo): Elem = {
e.classifier match {
case None =>
case Some(c) =>
}
}
val xml =
{extras.map(renderExtra)}
{dependencies.map(renderDependency).toSeq}
val pp = new PrettyPrinter(120, 4)
head + pp.format(xml).replaceAll(">", ">")
}
private def renderDependency(dep: Dependency): Elem = {
if (dep.exclusions.isEmpty)
${dep.configuration.getOrElse("default(compile)")}"
} />
else
${dep.configuration.getOrElse("default(compile)")}"
}>
{dep.exclusions.map(ex => )}
}
private def depIvyConf(d: Dependency): String = {
if (d.optional) "optional"
else d.scope match {
case Scope.Compile => "compile"
case Scope.Provided => "provided"
case Scope.Test => "test"
case Scope.Runtime => "runtime"
}
}
}