Here you go... one of my coworkers whipped this up the other day. One
dirty thing about it is that our carfax dependencies use customized
configurations due to originally misunderstanding ivy so it has a
small level of complexity.
Hope it helps.
task generateDependencies() << {
ivyFile = new File('ivy.xml')
gather = { dependencies, conf ->
dependencies.findAll( {
it['@conf'].toString().contains(conf.ivyConf) }).each {
String line = "\t${conf.gradleConf} group:
'${it['@org']}', name: '${it['@name']}', version: '${it['@rev']}'"
if(it['@org'].toString().contains('carfax'))
line += ", configuration: '${conf.ivyConf}'"
delegate << line
}
delegate << ''
}
confs = [ jar: [ivyConf: 'jar', gradleConf: 'compile' ],
test: [ivyConf: 'test', gradleConf: 'testCompile' ],
]
output = []
dependencies = new
XmlSlurper().parseText(ivyFile.text).dependencies.dependency
output.metaClass.gather = gather.curry(dependencies)
output.gather confs.jar
output.gather confs.test
outputFile = new File('build.gradle')
outputFile.delete()
outputFile << 'dependencies {\n'
output.each { outputFile << "$it\n" }
outputFile << '}\n'
}
Thanks,
James
On Thu, May 19, 2011 at 2:52 PM, James Carr <[email protected]> wrote:
> Yes... it was a custom XMLSlurper parsing setup.
>
> I will post some code when I return to work.
>
> Thanks,
> James
>
>
> On Wed, May 18, 2011 at 6:58 PM, Roger Studner <[email protected]> wrote:
>> I've been digging around.. seen Hans code for, at runtime, parsing some
>> ivy.xml files etc...
>>
>> That all being said.. has anyone successfully written an ivy =->
>> build.gradle converter?
>>
>> if not, i'll put something (sort of) together.. it is the configurations
>> that seem to make the least sense .. outside of just the jar artifacts.
>>
>> thanks
>> Roger
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email