Conditional execution in Ant -
i have target, executed if my_step==true
:
<target name="pre-compile" if="my_step"> ... </target>
but want make pre-compile target available regardless of value of my_step
, execute action manually using ant do_my_step
:
<target name"-do_my_step"> ... </target>
question. how can run make pre-compile execute -do_my_step target? is, if property my_step true, pre-compile step execute -do_my_step target. obviously, copy-paste contents of -do_my_step target pre-compile target, want keep target cleanly separated.
target names prefix '-' common practice make target 'private' it's impossible call via commandline. ant -f yourbuildfile.xml -yourprivatetarget
won't work ant commandline interface uses leading '-' options. strip leading '-' target name call via ant -f yourbuildfile.xml do_my_step
consider :
"..question. how can run make pre-compile execute -do_my_step target? .."
ant has antcall task calling target within same buildscript. antcall should avoided because opens new project scope (so needs more memory , slow down build) , breaks dependency chain built via <target name="..." depends"=...">
.
antcall
superfluous since ant 1.6 introduced macrodef purpose (reuse of functionality).
Comments
Post a Comment