After reading the antlist archive a little better, I found a thread from
January that matched my situation in which Peter showed a way which is much
better. Turns out I was trying to do it backwards. Instead of having my
subproj script be a dependency for my targets, it's much more natural to
have the targets call the script. As Peter suggested:
<target name = "clean">
<antcall target = "call">
<param name = "script.target" value = "clean"/>
</antcall>
</target>
Then all references in the javascript are to "call", instead of the target
I'm trying to pass. Don't know what the heck I was thinking before!
My modified example is included below just to complete the thread - critique
is always welcome.
Thanks.
-- Steve
<!-- clean target -->
<target name = "clean">
<antcall target = "dosubproj">
<param name = "target" value = "clean"/>
</antcall>
</target>
<!-- dosubproj target calls ant in each subproject and passes target -->
<target name="dosubproj">
<script language="javascript"><![CDATA[
// Add new subprojects to this array. They'll be built
// in the order they appear in the array.
var subproj = new Array(
list snipped to save space
);
for (i = 0; i < subproj.length; i++) {
target = new java.io.File(testproj.getProperty("target"));
build = testproj.createTask('ant');
build.setAntfile("build.xml");
build.setDir(new java.io.File(testproj.getProperty("basedir") + "/"
+ subproj[i]));
build.setInheritAll(false);
// Pass the target name unless it's the default target
if(target != "") {
build.setTarget(target);
}
dosubproj.addTask(build);
}]]> </script></target>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>