<project name="scripttest" default="test">
<libpath libraryid="antopt.script" file="/home/conor/dev/antdev/jakarta-ant/lib/optional/bsf.jar"/>
<libpath libraryid="antopt.script" file="/home/conor/dev/antdev/jakarta-ant/lib/optional/js.jar"/>
<import libraryid="antopt.script" name="scriptdef"/>
<scriptdef name="scripttest" language="javascript"> <![CDATA[
var test = "hello";
function setTest(x) {
test = x;
}function execute()
{
java.lang.System.out.println("test is " + test);
modelElementClass = context.getModelElement().getClass().getName();
java.lang.System.out.println("model element class is " + modelElementClass);
}
]]> </scriptdef>
<target name = "test">
<scripttest test="goodbye"/>
</target>
</project>The first two lines just provide additional classpath info for the script Ant library. Normally these would be in a config file rather than the build file but I wanted to test them out.
The result of running this is
test: test is goodbye model element class is org.apache.ant.common.model.BuildElement
BUILD SUCCESSFUL
Total time: 2 seconds
This is built on BSF and works with javascript (Rhino) although I have not tried any other scripting language.
Thoughts?
Conor
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
