Mercurial > public > develkit
changeset 86:da29f9bde0da
groovy script to 'fix' ivy scripts to use standard conventions for configurations
author | smith@nwoca.org |
---|---|
date | Tue, 14 Feb 2012 15:41:45 -0500 |
parents | f36eeb411845 |
children | be111b66cdc6 |
files | fix-ivy.groovy |
diffstat | 1 files changed, 35 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fix-ivy.groovy Tue Feb 14 15:41:45 2012 -0500 @@ -0,0 +1,35 @@ +import groovy.xml.* + +def xml = new XmlSlurper() +def ivy = xml.parse( new File('ivy.xml')) + +def cfgs = ivy.configurations + +if (cfgs.@defaultconfmapping.size() == 0) { + println "adding defaultconfmapping" + cfgs.@defaultconfmapping = '*->default' +} + +if (!cfgs.children().find { it.@name == 'default' } ) { + println "adding default config" + cfgs.appendNode { + conf(name:"default") + } +} + +groovy = ivy.dependencies.children().find { it.@org == 'org.codehaus.groovy' && it.@name == 'groovy' } +if (groovy) { + groovy.@conf = "*->default,optional" + println "Groovy ${groovy.@rev} conf changed to ${groovy.@conf}" +} + +def sameConfMappings = ivy.dependencies.children().findAll { it.@conf in ['*->@','*->*'] } + +println sameConfMappings.each { + it.@conf = "default->compile;%->@" + println "changing conf for ${it.@name} to ${it.@conf}" +} + + +def outputBuilder = new StreamingMarkupBuilder() +new File('ivy.xml').write( XmlUtil.serialize( outputBuilder.bind { mkp.yield ivy }).replaceAll('>','>')) \ No newline at end of file