I think I must not “get” Ant. I am having a hard time figuring out how to implement reuse and control execution of a sequence of targets. Please help.
I need my build script to create two builds: a debug build and a production build. Currently I am using antcall to hack-around my misunderstanding of Ant.
Let me use pseudo imperative code to describe how I want my builds to go:
//this is my entry point
function build-production-and-debug() =
prepare()
build-production()
build-debug()
cleanup()
function build-production() =
pre-process()
compile()
post-process()
package("production")
function build-debug() =
compile()
package("debug")
How am I suppose to approach this with Ant?
Here’s the outline of what I came up with, I am still using
antcalls but only as an entry point in order to parameterize my builds. The key discovery for me was using theifcondition on a target, to control whether the target gets executed, noting that the targets in its depends chain still execute. Theconditionandissettasks also helped out in certain places.