-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.xml
143 lines (122 loc) · 4.61 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<project name="sams" default="dist-all" basedir=".">
<property name="dir.src" value="src/main"/>
<property name="dir.test" value="src/test"/>
<property name="dir.build" value="build"/>
<property name="dir.dist" value="dist"/>
<property name="dir.lib" location="lib"/>
<property name="reports.tests" location="reports"/>
<property name="dir.libDev" location="libDev"/>
<property name="dir.appjars" value="${dir.dist}/appjars"/>
<property name="dir.jar" value="${dir.dist}/jar"/>
<property name="dir.metainf" value="${dir.build}/META-INF"/>
<target id="clean" name="clean" description="Removing all autogenerated files.">
<delete dir="${dir.build}"/>
<delete dir="${dir.dist}"/>
<delete dir="${reports.tests}" />
</target>
<target id="setupBuildDir" name="setupBuildDir">
<mkdir dir="${dir.build}"/>
<mkdir dir="${dir.dist}"/>
<mkdir dir="${dir.src}"/>
<mkdir dir="${dir.jar}"/>
<mkdir dir="${dir.appjars}"/>
<mkdir dir="${reports.tests}" />
</target>
<target name="compile-src" depends="setupBuildDir" description="Compilation of all source code.">
<javac target="1.6" srcdir="${dir.src}" destdir="${dir.build}" fork="true">
<classpath>
<fileset dir="${dir.lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<!-- ok, now that we have a copy, compile this copy -->
<copy todir="${dir.appjars}" >
<fileset dir="${dir.build}" />
</copy>
</target>
<target name="compile-test" depends="compile-src" description="Compilation of all test code.">
<javac target="1.6" srcdir="${dir.test}" destdir="${dir.build}" fork="true">
<classpath>
<fileset dir="${dir.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${dir.libDev}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<!-- ok, now that we have a copy, compile this copy -->
<copy todir="${dir.appjars}" >
<fileset dir="${dir.build}" />
</copy>
</target>
<target name="getgitdetails" >
<exec executable="git" outputproperty="git.tagstring">
<arg value="describe"/>
</exec>
<property name="git.tag" value="${git.tagstring}"/>
</target>
<target name="manifest">
<mkdir dir="${dir.metainf}"/>
<!-- Time -->
<tstamp>
<format property="builtat" pattern="yyyyMMdd" />
</tstamp>
<manifest file="${dir.metainf}/MANIFEST.MF2">
<attribute name="Built-By" value="Miguel Rojas-Cherto" />
<attribute name="Implementation-Version" value="${git.tag}" />
<attribute name="Built-Date" value="${builtat}" />
<attribute name="Main-Class" value="org.sams.main.ProcessMZData" />
</manifest>
</target>
<target id="dist-all" name="dist-all" depends="getgitdetails,manifest,compile-src" description="Builds one big jar file for the SAMS, including third-party libraries.">
<!-- first unjar the third-party libraries that we need -->
<unjar dest="${dir.appjars}">
<fileset dir="${dir.lib}"/>
</unjar>
<!-- then zip up things -->
<jar jarfile="${dir.jar}/${ant.project.name}-${git.tag}-b${builtat}.jar" manifest="${dir.metainf}/MANIFEST.MF2">
<fileset dir="${dir.src}" includes="org/sams/config/data/**"/>
<fileset dir="${dir.appjars}">
<include name="**/*" />
</fileset>
</jar>
</target>
<target id="test-dist-all" name="test-dist-all" depends="compile-test" description="test-dist-all">
<!-- first unjar the third-party libraries that we need -->
<unjar dest="${dir.appjars}">
<fileset dir="${dir.lib}"/>
<fileset dir="${dir.libDev}"/>
</unjar>
<!-- then zip up things -->
<jar jarfile="${dir.jar}/test-${ant.project.name}.jar">
<fileset dir="${dir.src}" includes="org/sams/config/data/**"/>
<fileset dir="${dir.appjars}">
<include name="**/*" />
</fileset>
</jar>
</target>
<target id="test-all" name="test-all" depends="test-dist-all"
description="Performs a full JUnit test for the SAMS.">
<echo message="Testing classes for SAMS." />
<mkdir dir="${reports.tests}"/>
<junit printsummary="yes" haltonfailure="no" fork="yes" maxmemory="256m">
<classpath>
<fileset dir="${dir.lib}" >
<include name="**/*"/>
</fileset>
<fileset dir="${dir.libDev}" >
<include name="**/*"/>
</fileset>
<fileset dir="${dir.jar}" >
<include name="**/*"/>
</fileset>
</classpath>
<test name="org.sams.SAMSTest" haltonfailure="no" todir="${reports.tests}"
outfile="result-sams">
<formatter type="brief" />
</test>
</junit>
</target>
</project>