----- Original Message -----
From: "Diane Holt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 02, 2000 10:30 AM
Subject: "undefined is not a function" error running <script>
> I get an error at the <script> task when I run this target (it all works
> as expected up until it gets to there):
>
> <target name="genNewBuildnum" depends="checkForOld"
> if="haveOldBuildnum">
> <rename src="buildnum.properties" dest="oldBuildnum.properties"/>
> <replace token="buildnum" value="oldBuildnum"
> file="oldBuildnum.properties"/>
> <antcall target="buildnum"/>
> <property file="buildnum.properties"/>
> <property file="oldBuildnum.properties"/>
> <script language="javascript"> <![CDATA[
> var newnum = parseInt(nightly.getProperty('buildnum'));
> var oldnum = parseInt(nightly.getProperty('oldBuildnum'));
> if ( newnum == oldnum ) nightly.setProperty('nochgs', true);
> ]]>
> </script>
> <antcall target="notifyNochgs"/>
> </target>
>
Are you sure 'nightly' refers to a project (i.e. your buildfile states
<project name="nightly" ..) ?
Give the following a try (works for me)
<?xml version="1.0"?>
<project name="nightly" default="default" basedir=".">
<target name="default">
<property name="buildnum" value="100"/>
<property id="foo" name="oldBuildnum" value="100"/>
<script language="javascript"> <![CDATA[
var newnum = parseInt(nightly.getProperty('buildnum'));
var oldnum = parseInt(nightly.getProperty('oldBuildnum'));
if ( newnum == oldnum ) nightly.setProperty('nochgs', true);
]]>
</script>
<echo message="${buildnum} / ${oldBuildnum} / ${nochgs}"/>
</target>
</project>
Does it work for you? It gives me the same error if I replace "nighlty" in
the first line of the script with "foo" which for sure has no method
"getProperty".