My new build macro looks like this:
<macrodef name="build">
<attribute name="srcdir"/>
<attribute name="builddir"/>
<sequential>
<mkdir dir="@{builddir}" />
<javac srcdir="@{srcdir}"
destdir="@{builddir}"
source="${compile.source}"
target="${compile.target}"
deprecation="${compile.deprecation}"
debug="${compile.debug}">
<classpath refid="classpath" />
</javac>
<if>
<available classpathref="classpath" classname="scala.ScalaObject"/>
<then>
<scalac srcdir="@{srcdir}"
destdir="@{builddir}"
classpathref="classpath" />
</then>
</if>
<copy todir="@{builddir}">
<fileset dir="@{srcdir}">
<include name="**/*"/>
<exclude name="**/*.java" />
<exclude name="**/*.scala" />
<exclude name="**/.svn/*" />
</fileset>
</copy>
</sequential>
</macrodef>
We also need to define the scalac task like so:
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="ant/jars/scala-compiler.jar" />
</classpath>
</taskdef>