/build/macros.xml
XML | 78 lines | 65 code | 11 blank | 2 comment | 0 complexity | 7266effb038d213ca3a231afb8e80891 MD5 | raw file
- <?xml version="1.0" encoding="UTF-8"?>
- <project>
- <taskdef resource="scala/tools/ant/antlib.xml">
- <classpath>
- <pathelement location="build/lib/scala-compiler.jar"/>
- <pathelement location="lib/scala-library.jar"/>
- </classpath>
- </taskdef>
- <macrodef name="compile.and.jar">
- <attribute name="src"/>
- <attribute name="jar"/>
- <attribute name="classpathref"/>
- <attribute name="version"/>
- <attribute name="classes" default="@{jar}.classes"/>
- <sequential>
- <mkdir dir="@{classes}"/>
- <scalac srcdir="@{src}" destdir="@{classes}" classpathref="@{classpathref}" target="jvm-1.5"/>
- <javac srcdir="@{src}" destdir="@{classes}" classpathref="@{classpathref}" debug="true" target="1.5"/>
- <copy todir="@{classes}">
- <fileset dir="@{src}">
- <exclude name="**/*.java"/>
- <exclude name="**/*.scala"/>
- </fileset>
- </copy>
- <property name="manifest" value="@{jar}.mf"/>
- <manifest file="${manifest}">
- <attribute name="Built-By" value="${user.name}"/>
- <section name="${ant.project.name}">
- <attribute name="Specification-Title" value="${ant.project.name}"/>
- <attribute name="Specification-Version" value="@{version}"/>
- <attribute name="Specification-Vendor" value="${ant.project.name}"/>
- <attribute name="Implementation-Title" value="${ant.project.name}"/>
- <attribute name="Implementation-Version" value="@{version}"/>
- <attribute name="Implementation-Vendor" value="${ant.project.name}"/>
- </section>
- </manifest>
- <jar destfile="@{jar}" basedir="@{classes}" manifest="${manifest}"/>
- <delete file="$manifest"/>
- <delete dir="@{classes}"/>
- </sequential>
- </macrodef>
- <macrodef name="test">
- <attribute name="jar"/>
- <attribute name="reports"/>
- <attribute name="classpathref"/>
- <sequential>
- <mkdir dir="@{reports}"/>
- <property name="unzipped.jar" value="@{reports}.unzipped.jar"/>
- <mkdir dir="${unzipped.jar}"/>
- <unzip dest="${unzipped.jar}" src="@{jar}"/>
- <junit printsummary="no" fork="on" failureproperty="failed" forkmode="once">
- <!--jvmarg value="-Xdebug"/>
- <jvmarg value="-Xrunjdwp:transport=dt_socket,server=n,address=5005,suspend=y"/-->
- <classpath refid="@{classpathref}"/>
- <formatter type="xml"/>
- <batchtest todir="@{reports}">
- <fileset dir="${unzipped.jar}">
- <include name="**/*Test*"/>
- <exclude name="**/*$*"/>
- </fileset>
- </batchtest>
- </junit>
- <delete dir="${unzipped.jar}"/>
- <fail message="Tests failed" if="failed"/>
- </sequential>
- </macrodef>
- </project>