Hi, I have a problem with the following build script:
========================= <?xml version="1.0" encoding="UTF-8"?> <project name="Test" default="test"> <macrodef name="appendExecutionOf"> <attribute name="target" /> <attribute name="toTarget" /> <sequential> <script language="javascript"> <![CDATA[ targetName = "@{target}" toTargetName = "@{toTarget}" toTarget = project.getTargets().get(toTargetName) antcall = project.createTask("antcall") antcall.setTarget(targetName) toTarget.addTask(antcall) println("Added task <antcall target=\"" + targetName + "\"/> to target \"" + toTarget + "\"") ]]> </script> </sequential> </macrodef> <target name="init"> <echo>Hello from target 'init'</echo> <appendExecutionOf target="extra-pre-test" toTarget="pre-test" /> <appendExecutionOf target="extra-post-test" toTarget="post-test" /> </target> <target name="extra-pre-test"> <echo>Hello from target 'extra-pre-test'</echo> </target> <target name="extra-post-test"> <echo>Hello from target 'extra-post-test'</echo> </target> <target name="pre-test"> <echo>Hello from target 'pre-test'</echo> </target> <target name="post-test"> <echo>Hello from target 'post-test'</echo> </target> <target name="test" depends="init"> <antcall target="pre-test"/> <echo>Hello from target 'test'</echo> <antcall target="post-test"/> </target> </project> ========================= This is purposing the follwing: Adding execution of additional targets (here "extra-pre-test" and "extra-post-test") to some other targets (here "pre-test" and "post-test", respectively) depending on environmental properties (not shown here for simplicity). I'm trying to achieve this using the macro "appendExecutionOf", which uses JavaScript to add a new <antcall> task to the intended target. But unfortunalety this does not work as expected: ========================= $ ant Buildfile: build.xml init: [echo] Hello from target 'init' [script] Added task <antcall target="extra-pre-test"/> to target "pre-test" [script] Added task <antcall target="extra-post-test"/> to target "post-test" test: pre-test: [echo] Hello from target 'pre-test' [echo] Hello from target 'test' post-test: [echo] Hello from target 'post-test' BUILD SUCCESSFUL Total time: 0 seconds ========================= I would expect something like this: ========================= [...] init: [echo] Hello from target 'init' [script] Added task <antcall target="extra-pre-test"/> to target "pre-test" [script] Added task <antcall target="extra-post-test"/> to target "post-test" test: pre-test: [echo] Hello from target 'pre-test' [echo] Hello from target 'extra-pre-test' // <= ADDITIONAL LINE [echo] Hello from target 'test' post-test: [echo] Hello from target 'post-test' [echo] Hello from target 'extra-post-test' // <= ADDITIONAL LINE [...] ========================= So my question is: Am I missing something important with my JavaScript macro? Or might this be a bug? Any help appreciated. Thanks and regards Christian -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org