forked from HubSpot/jmte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
240 lines (206 loc) · 9.16 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?xml version="1.0"?>
<project name="jmte" default="jar" basedir=".">
<!--
===================================================================
Set build properties
===================================================================
-->
<property file="${basedir}/common.properties" />
<property file="${basedir}/local.properties" />
<property name="creator" value="floreysoft GmbH" />
<property name="final.name" value="${name}-${version}" />
<property name="nocompiler.name" value="${name}-unbundled-${version}" />
<property name="dist.name" value="${name}-${version}-full.zip" />
<property name="jar.name" value="${final.name}.jar" />
<property name="nocompiler.jar.name" value="${nocompiler.name}.jar" />
<property name="asm" value="lib/asm-3.3.1.jar" />
<tstamp>
<format property="TODAY.DATE" pattern="yyyy-MM-dd" locale="us" />
<format property="TODAY.TIME" pattern="HH:mm:ss" locale="us" />
</tstamp>
<property name="today" value="${TODAY.DATE} ${TODAY.TIME}" />
<!--
===================================================================
Set the properties related to the source tree
===================================================================
-->
<property name="src.dir" value="${basedir}/src" />
<property name="java.dir" value="${src.dir}" />
<property name="test.dir" value="${basedir}/test" />
<property name="example.dir" value="${basedir}/example" />
<!--
===================================================================
Set the properties for the build area
===================================================================
-->
<property name="build.dir" value="${basedir}/bin" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="manifest.file.name" value="MANIFST.MF" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="tmp.dir" value="${build.dir}/tmp" />
<property name="doc.dir" value="${basedir}/doc" />
<property name="api.dir" value="${doc.dir}/api" />
<path id="classpath">
<pathelement location="${build.dir}" />
<fileset dir="${lib.dir}" />
</path>
<!--
===================================================================
Prepare the build
===================================================================
-->
<target name="prepare">
<tstamp />
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!--
===================================================================
Build the code
===================================================================
-->
<target name="tag-version" depends="prepare">
<mkdir dir="${tmp.dir}/src"/>
<copy todir="${tmp.dir}/src" >
<fileset dir="${src.dir}"/>
</copy>
<replace dir="${tmp.dir}/src" token="@version@" value="${version}"/>
</target>
<target name="build" depends="prepare,tag-version" description="Compiles the main classes">
<javac destdir="${build.dir}" source="${compile.source}" target="${compile.target}" debug="${compile.debug}"
deprecation="${compile.deprecation}" optimize="${compile.optimize}">
<src path="${tmp.dir}/src"/>
<src path="${test.dir}" />
<classpath refid="classpath" />
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}" includes="**/*.properties" />
<fileset dir="${test.dir}" includes="**/*.jmte" />
<fileset dir="${test.dir}" includes="**/*.txt" />
</copy>
</target>
<!--
===================================================================
Archive the code
===================================================================
-->
<target name="archive-jars" depends="build" description="Builds the exectutable jar-archives">
<jar destfile="${dist.dir}/${nocompiler.jar.name}" filesetmanifest="skip">
<manifest>
<attribute name="Built-By" value="${creator}" />
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Version" value="${version}" />
<attribute name="Build-Date" value="${today}" />
</manifest>
<fileset dir="${build.dir}" excludes="**/*Test*.class,**/*Tests*.class,**/sample/**,**/realLife/**,tmp/**" />
</jar>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/jarjar-1.0.jar" />
<jarjar jarfile="${dist.dir}/${jar.name}">
<manifest>
<attribute name="Built-By" value="${creator}" />
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Version" value="${version}" />
<attribute name="Build-Date" value="${today}" />
</manifest>
<zipfileset src="${dist.dir}/${nocompiler.jar.name}" />
<zipfileset src="${asm}" />
<rule pattern="org.objectweb.asm.**" result="com.floreysoft.jmte.internal.asm.@1" />
<keep pattern="com.floreysoft.jmte.**" />
</jarjar>
</target>
<!--
===================================================================
Distribute the code
===================================================================
-->
<target name="all" depends="full-dist" description="Creates all distributions" />
<target name="jar" depends="clean,build,test,archive-jars" description="Creates the testet release jar" />
<target name="deploy" description="Deploys jar" if="deploy.dir">
<copy todir="${deploy.dir}">
<fileset file="${dist.dir}/${jar.name}" />
</copy>
</target>
<target name="full-dist" depends="jar,javadoc" description="Source distribution">
<zip destfile="${dist.dir}/${dist.name}">
<zipfileset dir="${example.dir}" prefix="${final.name}/example" />
<zipfileset dir="${test.dir}" prefix="${final.name}/test" />
<zipfileset dir="${src.dir}" prefix="${final.name}/src" />
<zipfileset dir="${doc.dir}" prefix="${final.name}/doc" />
<zipfileset dir="${lib.dir}" prefix="${final.name}/lib" />
<zipfileset dir="${dist.dir}" includes="${jar.name}, ${nocompiler.jar.name}" prefix="${final.name}" />
<zipfileset dir="${basedir}" includes="build.xml, Caliper*, common.properties, COPYING, local.properties.sample, Releasenotes.txt" prefix="${final.name}" />
</zip>
</target>
<target name="javadoc" depends="build" description="Generates the public API">
<delete dir="${api.dir}" />
<javadoc destdir="${api.dir}" author="true" version="true" use="true" access="public" windowtitle="${full.name} - Public API">
<packageset dir="src" defaultexcludes="yes">
<exclude name="**/token/**" />
</packageset>
<link href="http://java.sun.com/javase/6/docs/api/" />
</javadoc>
</target>
<!--
===================================================================
Cleans up build directories
===================================================================
-->
<target name="clean" description="Removes temporaray files">
<delete dir="${build.dir}" />
</target>
<!--
===================================================================
Do tests
===================================================================
-->
<target name="test" depends="build" description="Exectutes JUnit tests">
<mkdir dir="${tmp.dir}" />
<junit printsummary="yes" haltonfailure="yes">
<classpath refid="classpath" />
<formatter type="plain" />
<test name="${test.class}" haltonfailure="yes" todir="${tmp.dir}" />
</junit>
</target>
<target name="caliper" depends="caliper-basic, caliper-miniparser, caliper-compiler, caliper-compiler-large" description="Exectutes Caliper MicroBenchmark tests">
</target>
<target name="caliper-miniparser" depends="build" description="Exectutes Caliper MicroBenchmark tests for MiniParser">
<mkdir dir="${tmp.dir}" />
<java classname="com.google.caliper.Runner" dir="${tmp.dir}" fork="true">
<arg value="com.floreysoft.jmte.MiniParserCaliperTest.PortfolioBenchmark" />
<classpath>
<path refid="classpath" />
<pathelement path="${build.dir}" />
</classpath>
</java>
</target>
<target name="caliper-basic" depends="build" description="Exectutes basic Caliper MicroBenchmark tests">
<mkdir dir="${tmp.dir}" />
<java classname="com.google.caliper.Runner" dir="${tmp.dir}" fork="true">
<arg value="com.floreysoft.jmte.EngineCaliperTest.PortfolioBenchmark" />
<classpath>
<path refid="classpath" />
<pathelement path="${build.dir}" />
</classpath>
</java>
</target>
<target name="caliper-compiler" depends="build" description="Exectutes Caliper MicroBenchmark tests for compilation">
<mkdir dir="${tmp.dir}" />
<java classname="com.google.caliper.Runner" dir="${tmp.dir}" fork="true">
<arg value="com.floreysoft.jmte.CompiledCaliperTest.PortfolioBenchmark" />
<classpath>
<path refid="classpath" />
<pathelement path="${build.dir}" />
</classpath>
</java>
</target>
<target name="caliper-compiler-large" depends="build" description="Exectutes Caliper MicroBenchmark tests for compilation">
<mkdir dir="${tmp.dir}" />
<java classname="com.google.caliper.Runner" dir="${tmp.dir}" fork="true">
<arg value="com.floreysoft.jmte.LargeScaleCaliperTest.PortfolioBenchmark" />
<classpath>
<path refid="classpath" />
<pathelement path="${build.dir}" />
</classpath>
</java>
</target>
</project>