In working through the examples during the Chicago training (Exercise 12.1) I found that the ant echo action through the ant importBuild setup doesn’t match the action of gradle’s version of an ant echo. See below:
build.xml
<project name='checksum'>
<target name='printChecksum'>
<checksum property='checksumOut'>
<fileset dir='.'>
<include name='agile.txt'/>
</fileset>
</checksum>
<echo>${checksumOut}</echo>
</target>
</project>
build.gradle
ant.importBuild 'build.xml'
printChecksum {
doFirst {
println 'before printChecksum'
}
doLast {
println 'after printChecksum'
}
}
task createChecksum << {
ant {
checksum(property: 'checksumOut') {
fileset(dir: '.') {
include(name: 'agile.txt')
}
}
println 'before ant:echoing checksum'
echo {
checksumOut
}
println 'after ant:echoing checksum'
}
}
Output
smac:12.1-Ant-Integration sgoings$ gradle pC cC --rerun-tasks
:printChecksum
before printChecksum
[ant:echo] 14b904baef9f66bdf87d5083b8ddd74a
after printChecksum
:createChecksum
before ant:echoing checksum
[ant:echo]
after ant:echoing checksum
BUILD SUCCESSFUL