forked from LMAX-Exchange/Simple-DSL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
121 lines (106 loc) · 4.34 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?xml version="1.0" encoding="UTF-8"?>
<project name="simpledsl" basedir="." default="build">
<property name="project.dir" value="${basedir}" />
<property name="build.lib" value="${project.dir}/lib" />
<property name="project.src" value="${project.dir}/src/main/java" />
<property name="test.src" value="${project.dir}/src/test/java"/>
<property name="build.dir" value="${project.dir}/build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="dist.dir" value="${build.dir}/dist" />
<property name="test.build.dir" value="${build.dir}/test-classes"/>
<property name="junit.tmp.dir" value="${build.dir}/tmp"/>
<property name="reports.dir" value="${build.dir}/reports"/>
<property name="test.reports" value="${reports.dir}/junit"/>
<path id="classpath">
<pathelement path="${classes.dir}" />
<fileset dir="${build.lib}" >
<include name="**/*.jar" />
</fileset>
</path>
<path id="test-classpath">
<pathelement path="${project.dir}"/>
<pathelement path="${test.build.dir}" />
<path refid="classpath" />
</path>
<target name="build" depends="clean, unit-test, assemble" />
<target name="dist" depends="build" />
<target name="clean">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${build.dir}" includes="**/*" />
</delete>
</target>
<target name="compile" >
<mkdir dir="${classes.dir}" />
<compile destdir="${classes.dir}" srcpath="${project.src}" classpathref="classpath"/>
</target>
<target name="unit-test" depends="compile, compile-tests">
<mkdir dir="${junit.tmp.dir}" />
<mkdir dir="${test.reports}" />
<test srcdir="${test.src}" classpathref="test-classpath" reportsdir="${test.reports}"/>
</target>
<target name="assemble">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/simple-dsl.jar">
<fileset dir="${classes.dir}">
<include name="com/**/*.*" />
</fileset>
</jar>
<jar destfile="${dist.dir}/simple-dsl-src.jar">
<fileset dir="${project.src}">
<include name="com/**/*.*" />
</fileset>
</jar>
</target>
<target name="compile-tests">
<mkdir dir="${test.build.dir}" />
<compile destdir="${test.build.dir}" srcpath="${test.src}" classpathref="test-classpath" />
</target>
<macrodef name="compile">
<attribute name="destdir" />
<attribute name="srcpath" />
<attribute name="classpathref" />
<sequential>
<javac debug="on" debuglevel="lines,source,vars" destdir="@{destdir}" includeantruntime="false" target="1.8" source="1.8">
<src path="@{srcpath}" />
<classpath refid="@{classpathref}" />
<compilerarg value="-g:vars"/>
</javac>
</sequential>
</macrodef>
<macrodef name="test">
<attribute name="srcdir" />
<attribute name="classpathref" />
<attribute name="reportsdir" />
<sequential>
<junit fork="yes"
forkmode="once"
printsummary="yes"
errorproperty="test.error"
failureproperty="test.failure"
tempDir="${junit.tmp.dir}"
dir="${project.dir}">
<classpath refid="@{classpathref}" />
<formatter type="xml" />
<batchtest todir="@{reportsdir}">
<fileset dir="@{srcdir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="@{reportsdir}">
<fileset dir="@{reportsdir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="@{reportsdir}" />
</junitreport>
<fail message="TESTS FAILED!!! See reports at @{reportsdir} for more details.">
<condition>
<or>
<isset property="test.error" />
<isset property="test.failure" />
</or>
</condition>
</fail>
</sequential>
</macrodef>
</project>