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

mill.scalalib.publish.Ivy.scala Maven / Gradle / Ivy

There is a newer version: 0.12.0-RC2-17-07e173
Show 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"
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy