i have a fairly complex build system that recently introduces some additional compexity. To describe my problem, i'll sketch a very simplified Ant build:
<target name="clean" depends="-clean" />
<extension-point name="-clean" />
<target name="init" depends="-init" />
<extension-point name="-init" />
<target name="compile" depends="-compile" />
<extension-point name="-compile" depends="-init" />
<target name="install" depends="-install" />
<extension-point name="-install" depends="-compile" />
<target name="recompile" depends="-recompile" />
<extension-point name="-recompile" depends="-clean, -compile" />
This basic structure of the ANT file is required, because all extension-points are extended by specific implementatiosn for various implementation languages (including PL/I and COBOL).
This way i was able to maintain structured and standardized procedures, to generate the artifacts based on the varous sources.
Recently we tried to include that "recompile" step, that introduces a different "clean" semantic. Therefore i've implemented the "clean semantics as follows:
<target name="std-clean" extensionOf="-clean">
<target name="recompile-clean" extensionOf="-clean" if="is.Recompile" >
<echo>Additional behaviour for recompile</echo>
<property name="is.Recompile" value="true" />
And the "-recompile" Target was extended this way:
<target name="recompile" depends="-recompile-switch, -recompile" />
While this solution - in principle - activates "-recompile-switch" just before executing "-clean", this is not guaranteed by ANT. The ANT documentation states, that this dependcy declaration just states, that "-recompile-switch" will be activated BEFORE recompile executes, but it does not guarantee the order of execution for "-recompile-switch" and "-recompile".
In my case, the "-clean" targets activates, before "-recompile-switch" has any chance to execute. (Sometime it works, sometime it fails. But it's backed by ANTs definition.)
Now my question(s):
Are there any ways to define the order of execution to guarantee an optional task just like "-recompile-switch" to execute at the right moment?
Is there any way using the Java API to the ANT core to inspect the execution graph?
Instead of injecting a target setting switch into the execution graph, it might by suitable to look up the chain of target execution to get an idea wich main target is active.
Unfortunately it is impossible to manipulate the execution graph at runtime, conditionally <import>ing different extesions.
A interim solution using <antcall> is in place.
<antcall target="-recompile" inheritAll="true">
<param name="is.Recompile" value="true" />
But ths solution requires a complete re-evaluation of the complete set of ANT build filles which takes a long time and is not applicable in any case.
Mit freundlichen Grüßen,
Ralf Edmund Stranzenbach
Management & Technology Consultants
T + 49 211 17143 6038
C + 49 174 3075 211
F + 49 211 17143 6060
Geschäftsführer: Marcel Nickler (Vorsitzender), Hans-Werner Wurzel (stellv. Vorsitzender), Kiumars Hamidian, Matthias Loebich, Kai Wächter, Dr. Robert Wagner
Vorsitzender des Aufsichtsrats: Beat Leimbacher
Sitz: Frankfurt am Main
Registergericht: Amtsgericht Frankfurt am Main HRB 55490
The information in this email is confidential and may be legally privileged. If you are not the intended recipient of this message, any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and any copies thereof from your system.