You can do it via scripting. See this thread...
http://marc.theaimsgroup.com/?t=107585688000004&r=1&w=2
...and specifically, this message...
http://marc.theaimsgroup.com/?l=ant-user&m=107589782422983&w=2
I added my own twist on it and made dependency
following configurable (follows dependencies by
default if not specified) along with optional
"if" and "unless" attributes. Actually, all the
attributes are optional, even "target". If
"target" is either not defined or defined but
doesn't exist in the build file, no action is
performed instead of failing the build. I
intentionally made it very lenient to meet the
needs of my project. Note that this also avoids
creating a whole separate Ant context like <ant>,
<subant>, and <antcall> do, so properties created
by the called target will continue to exist after
it is called. Here's my version. I hope you find it useful...
<scriptdef name="scriptHook" language="javascript">
<attribute name="target"/>
<attribute name="followdependencies"/>
<attribute name="if"/>
<attribute name="unless"/>
<![CDATA[
var ifVal = attributes.get("if");
var unlessVal = attributes.get("unless");
if (((ifVal == null) || (ifVal != null
&& project.getProperties().containsKey(ifVal)))
&& ((unlessVal == null) || (unlessVal
!= null && !project.getProperties().containsKey(unlessVal)))) {
var targetVal = attributes.get("target");
if (targetVal != null &&
project.getTargets().containsKey(targetVal)) {
var followdependenciesVal =
(attributes.get("followdependencies") != null)
? java.lang.Boolean.getBoolean(attributes.get("followdependencies")) : true;
if (followdependenciesVal == true) {
project.executeTarget(targetVal);
}
else {
project.getTargets().get(targetVal).performTasks();
}
}
}
]]>
</scriptdef>
Jake
At 04:59 AM 1/20/2007, you wrote:
>Hi.
>
>Iâve got a build file thatâs structured like this:
>
> <target name="init">
> <echo message="something"/>
> </target>
>
> <target name="one" depends="init, something">
> <condition property="suffix" value="mac" else="other">
> <os name="Mac OS X"/>
> </condition>
> <antcall target="two-${suffix}"/>
> </target>
>
> <target name="two-mac" depends="init">
> </target>
>
> <target name="two-other" depends="init">
> </target>
>
> <target name="something">
> </target>
>
>If I run "ant one" I get:
>
> jet:/tmp $ ant one
> Buildfile: build.xml
>
> init:
> [echo] something
>
> something:
>
> one:
>
> init:
> [echo] something
>
> two-other:
>
> BUILD SUCCESSFUL
>
>but I want it so that the init target doesnât get run again, because it
>has already been run. Is that just a limitation of antcall (that it
>forgets which dependencies have already been run)? If so, how I else
>can I get this sort of flow control?
>
>Thanks,
>
>Cameron
>
>--
>Cameron McCormack, http://mcc.id.au/
> xmpp:[EMAIL PROTECTED] ⪠ICQ 26955922 ⪠MSN [EMAIL PROTECTED]
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]