This commit is contained in:
Alexandre Archambault 2016-04-28 23:17:07 +02:00
parent bf919d4fc1
commit 869d57c2f4
No known key found for this signature in database
GPG Key ID: 14640A6839C263A9
1 changed files with 20 additions and 18 deletions

View File

@ -6,27 +6,26 @@ object MakeIvyXml {
def apply(project: Project): Node = { def apply(project: Project): Node = {
val baseInfoAttrs = <x val infoAttrs = project.module.attributes.foldLeft[xml.MetaData](xml.Null) {
organisation={project.module.organization}
module={project.module.name}
revision={project.version}
/>.attributes
val infoAttrs = project.module.attributes.foldLeft(baseInfoAttrs) {
case (acc, (k, v)) => case (acc, (k, v)) =>
new PrefixedAttribute("e", k, v, acc) new PrefixedAttribute("e", k, v, acc)
} }
val licenseElems = project.info.licenses.map { val licenseElems = project.info.licenses.map {
case (name, urlOpt) => case (name, urlOpt) =>
var n = <license name={name} /> val n = <license name={name} />
for (url <- urlOpt)
n = n % <x url={url} />.attributes urlOpt.fold(n) { url =>
n n % <x url={url} />.attributes
}
} }
val infoElem = { val infoElem = {
<info> <info
organisation={project.module.organization}
module={project.module.name}
revision={project.version}
>
{licenseElems} {licenseElems}
<description>{project.info.description}</description> <description>{project.info.description}</description>
</info> </info>
@ -34,10 +33,11 @@ object MakeIvyXml {
val confElems = project.configurations.toVector.map { val confElems = project.configurations.toVector.map {
case (name, extends0) => case (name, extends0) =>
var n = <conf name={name} visibility="public" description="" /> val n = <conf name={name} visibility="public" description="" />
if (extends0.nonEmpty) if (extends0.nonEmpty)
n = n % <x extends={extends0.mkString(",")} />.attributes n % <x extends={extends0.mkString(",")} />.attributes
n else
n
} }
val publications = project val publications = project
@ -47,10 +47,12 @@ object MakeIvyXml {
val publicationElems = publications.map { val publicationElems = publications.map {
case (pub, configs) => case (pub, configs) =>
var n = <artifact name={pub.name} type={pub.`type`} ext={pub.ext} conf={configs.mkString(",")} /> val n = <artifact name={pub.name} type={pub.`type`} ext={pub.ext} conf={configs.mkString(",")} />
if (pub.classifier.nonEmpty) if (pub.classifier.nonEmpty)
n = n % <x e:classifier={pub.classifier} />.attributes n % <x e:classifier={pub.classifier} />.attributes
n else
n
} }
val dependencyElems = project.dependencies.toVector.map { val dependencyElems = project.dependencies.toVector.map {