PageRenderTime 72ms CodeModel.GetById 30ms app.highlight 2ms RepoModel.GetById 38ms app.codeStats 0ms

/build/macros.xml

https://code.google.com/p/webfabric/
XML | 78 lines | 65 code | 11 blank | 2 comment | 0 complexity | 7266effb038d213ca3a231afb8e80891 MD5 | raw file
 1<?xml version="1.0" encoding="UTF-8"?>
 2<project>
 3
 4    <taskdef resource="scala/tools/ant/antlib.xml">
 5        <classpath>
 6            <pathelement location="build/lib/scala-compiler.jar"/>
 7            <pathelement location="lib/scala-library.jar"/>
 8        </classpath>
 9    </taskdef>
10
11    <macrodef name="compile.and.jar">
12        <attribute name="src"/>
13        <attribute name="jar"/>
14        <attribute name="classpathref"/>
15        <attribute name="version"/>
16        <attribute name="classes" default="@{jar}.classes"/>
17
18        <sequential>
19            <mkdir dir="@{classes}"/>
20            <scalac srcdir="@{src}" destdir="@{classes}" classpathref="@{classpathref}" target="jvm-1.5"/>
21            <javac srcdir="@{src}" destdir="@{classes}" classpathref="@{classpathref}" debug="true" target="1.5"/>
22
23            <copy todir="@{classes}">
24                <fileset dir="@{src}">
25                    <exclude name="**/*.java"/>
26                    <exclude name="**/*.scala"/>
27                </fileset>
28            </copy>
29
30            <property name="manifest" value="@{jar}.mf"/>
31            <manifest file="${manifest}">
32                <attribute name="Built-By" value="${user.name}"/>
33                <section name="${ant.project.name}">
34                    <attribute name="Specification-Title" value="${ant.project.name}"/>
35                    <attribute name="Specification-Version" value="@{version}"/>
36                    <attribute name="Specification-Vendor" value="${ant.project.name}"/>
37                    <attribute name="Implementation-Title" value="${ant.project.name}"/>
38                    <attribute name="Implementation-Version" value="@{version}"/>
39                    <attribute name="Implementation-Vendor" value="${ant.project.name}"/>
40                </section>
41            </manifest>
42
43            <jar destfile="@{jar}" basedir="@{classes}" manifest="${manifest}"/>
44
45            <delete file="$manifest"/>
46            <delete dir="@{classes}"/>
47        </sequential>
48    </macrodef>
49
50    <macrodef name="test">
51        <attribute name="jar"/>
52        <attribute name="reports"/>
53        <attribute name="classpathref"/>
54
55        <sequential>
56            <mkdir dir="@{reports}"/>
57            <property name="unzipped.jar" value="@{reports}.unzipped.jar"/>
58            <mkdir dir="${unzipped.jar}"/>
59            <unzip dest="${unzipped.jar}" src="@{jar}"/>
60            <junit printsummary="no" fork="on" failureproperty="failed" forkmode="once">
61                <!--jvmarg value="-Xdebug"/>
62                <jvmarg value="-Xrunjdwp:transport=dt_socket,server=n,address=5005,suspend=y"/-->
63                <classpath refid="@{classpathref}"/>
64                <formatter type="xml"/>
65                <batchtest todir="@{reports}">
66                    <fileset dir="${unzipped.jar}">
67                        <include name="**/*Test*"/>
68                        <exclude name="**/*$*"/>
69                    </fileset>
70                </batchtest>
71            </junit>
72
73            <delete dir="${unzipped.jar}"/>
74            <fail message="Tests failed" if="failed"/>
75        </sequential>
76    </macrodef>
77
78</project>