forked from linkedin/parseq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
243 lines (210 loc) · 10.4 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
241
242
243
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="parseq" default="build" basedir=".">
<description>ParSeq Project</description>
<property name="example.dir" value="${basedir}/example" />
<property name="src.dir" value="${basedir}/src" />
<property name="test.dir" value="${basedir}/test" />
<property name="tools.dir" value="${basedir}/tools" />
<property name="build.dir" value="${basedir}/build" />
<property name="example.build.dir" value="${build.dir}/example" />
<property name="src.build.dir" value="${build.dir}/src" />
<property name="lib.build.dir" value="${build.dir}/lib" />
<property name="test.build.dir" value="${build.dir}/test" />
<property name="test.result.dir" value="${test.build.dir}/reports"/>
<property name="doc.build.dir" value="${build.dir}/doc"/>
<property name="dist.dir" value="${basedir}/dist" />
<!-- IVY configuration -->
<property name="ivy.jar.version" value="2.2.0" />
<property name="ivy.jar.file" value="${build.dir}/ivy.jar" />
<property name="ivy.jar.url" value="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/ivy-${ivy.jar.version}.jar" />
<!-- This has special meaning for the ivy:retrieve task: it points to the location the JARs will be placed -->
<property name="ivy.lib.dir" value="${lib.build.dir}"/>
<property name="javac.source" value="1.6" />
<property name="javac.target" value="1.6" />
<!-- Enables/disables inclusion of debug symbols in .class files. -->
<property name="debug" value="true" />
<!-- How verbose should testng be? A value of 2 or greater logs tests that
are run and test failure stack traces to the console -->
<property name="testng.verbosity" value="1"/>
<path id="build.classpath">
<pathelement location="${src.build.dir}"/>
<fileset dir="${lib.build.dir}/build" includes="*.jar"/>
</path>
<path id="test.classpath">
<path refid="build.classpath"/>
<pathelement location="${test.build.dir}"/>
<fileset dir="${lib.build.dir}/test" includes="*.jar"/>
</path>
<target name="bootstrap" unless="bootstrap.done">
<mkdir dir="${lib.build.dir}"/>
<!-- Pull down IVY and load taskdefs -->
<get src="${ivy.jar.url}" dest="${ivy.jar.file}" usetimestamp="true" />
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant">
<classpath>
<fileset file="${ivy.jar.file}" />
</classpath>
</taskdef>
<ivy:resolve file="ivy.xml" conf="bootstrap"/>
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact].[ext]"/>
<!-- load testng taskdefs -->
<taskdef resource="testngtasks">
<classpath>
<fileset file="${lib.build.dir}/bootstrap/testng.jar"/>
</classpath>
</taskdef>
<property name="bootstrap.done" value="true"/>
</target>
<target name="version-props" unless="version">
<loadproperties srcFile="${basedir}/version.properties"/>
</target>
<target name="prepare" depends="bootstrap, version-props">
<mkdir dir="${example.build.dir}" />
<mkdir dir="${src.build.dir}" />
<mkdir dir="${lib.build.dir}" />
<mkdir dir="${test.build.dir}" />
<mkdir dir="${test.result.dir}"/>
<mkdir dir="${doc.build.dir}" />
<mkdir dir="${dist.dir}" />
<ivy:resolve file="ivy.xml" conf="*"/>
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact].[ext]"/>
</target>
<target name="build-src" depends="prepare" description="Builds src and example files.">
<javac includeantruntime="false" destdir="${src.build.dir}" source="${javac.source}" target="${javac.target}" debug="${debug}">
<src path="${src.dir}"/>
<classpath refid="build.classpath"/>
<compilerarg value="-Xlint"/>
</javac>
<javac includeantruntime="false" destdir="${example.build.dir}" source="${javac.source}" target="${javac.target}" debug="${debug}">
<src path="${example.dir}"/>
<classpath refid="build.classpath"/>
<compilerarg value="-Xlint"/>
</javac>
</target>
<target name="jar-src" depends="build-src" description="Creates a JAR for src classes">
<make-jar destfile="${dist.dir}/${ant.project.name}-${version}.jar" basedir="${src.build.dir}" />
</target>
<target name="zip-src" depends="prepare" description="Creates a ZIP for the src files">
<make-jar destfile="${dist.dir}/${ant.project.name}-${version}-sources.jar" basedir="${src.dir}" />
</target>
<target name="tar-tracevis" depends="prepare" description="Creates a tarball of the tracevis tool">
<tar destfile="${dist.dir}/${ant.project.name}-tracevis-${version}.tar.gz" compression="gzip">
<tarfileset dir="${tools.dir}/tracevis" prefix="tracevis" />
</tar>
</target>
<target name="doc" description="Build the javadoc." depends="build-src">
<javadoc destdir="${doc.build.dir}">
<packageset dir="${src.dir}">
<exclude name="com/linkedin/parseq/internal"/>
</packageset>
<classpath refid="build.classpath"/>
</javadoc>
</target>
<target name="zip-doc" depends="doc" description="Creates a ZIP for the javadoc files">
<make-jar destfile="${dist.dir}/${ant.project.name}-${version}-javadoc.jar" basedir="${doc.build.dir}" />
</target>
<target name="build-test" depends="build-src" description="Builds test files.">
<javac includeantruntime="false" destdir="${test.build.dir}" source="${javac.source}" target="${javac.target}" debug="${debug}">
<src path="${test.dir}"/>
<classpath refid="test.classpath"/>
<compilerarg value="-Xlint"/>
</javac>
<copy file="${test.dir}/log4j.properties" todir="${test.build.dir}"/>
</target>
<target name="test" depends="test-unit, test-tracevis"
description="Runs the unit and integration tests. Set property no.test.tracevis to skip visualization tests."/>
<target name="test-unit" depends="build-test" description="Runs the unit tests.">
<testng haltonfailure="true" outputDir="${test.result.dir}" verbose="${testng.verbosity}">
<classfileset dir="${test.build.dir}" includes="**/Test*.class"/>
<classpath refid="test.classpath"/>
</testng>
</target>
<target name="build" depends="build-src,build-test" description="Builds everything" />
<target name="dist" depends="jar-src, zip-src, tar-tracevis, zip-doc"
description="Builds all distributables to ${dist.dir}">
<ivy:deliver deliverpattern="${dist.dir}/[artifact]-[revision].[ext]" pubrevision="${version}" validate="true"/>
<ivy:resolve file="ivy-tracevis.xml" conf="default"/>
<ivy:deliver deliverpattern="${dist.dir}/tracevis-[artifact]-[revision].[ext]" pubrevision="${version}" validate="true"/>
<property name="ivy.pom.description" value="ParSeq is a framework that makes it easier to write and maintain fast, scalable applications in Java"/>
<property name="ivy.pom.url" value="https://github.com/linkedin/parseq"/>
<ivy:makepom ivyfile="${dist.dir}/ivy-${version}.xml" pomfile="${dist.dir}/parseq-${version}.pom" templatefile="${basedir}/build-templates/template.pom" conf="build">
<mapping conf="build" scope="compile"/>
</ivy:makepom>
</target>
<target name="bundle" depends="dist"
description="Builds a release bundle to ${dist.dir}/bundle.jar">
<sign file="${dist.dir}/parseq-${version}.pom"/>
<sign file="${dist.dir}/parseq-${version}.jar"/>
<sign file="${dist.dir}/parseq-${version}-sources.jar"/>
<sign file="${dist.dir}/parseq-${version}-javadoc.jar"/>
<jar destfile="${dist.dir}/parseq-${version}-bundle.jar" basedir="${dist.dir}">
<include name="parseq-${version}.pom"/>
<include name="parseq-${version}.pom.asc"/>
<include name="parseq-${version}.jar"/>
<include name="parseq-${version}.jar.asc"/>
<include name="parseq-${version}-sources.jar"/>
<include name="parseq-${version}-sources.jar.asc"/>
<include name="parseq-${version}-javadoc.jar"/>
<include name="parseq-${version}-javadoc.jar.asc"/>
</jar>
</target>
<target name="clean" description="Cleans build and dist dirs">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<make dir="${tools.dir}/tracevis" >
<args>
<arg value="clean" />
</args>
</make>
</target>
<target name="test-tracevis" unless="no.test.tracevis" description="Run visualization tests">
<make dir="${tools.dir}/tracevis">
<args>
<arg value="test" />
</args>
</make>
</target>
<macrodef name="sign">
<attribute name="file"/>
<sequential>
<echo message="Signing @{file}"/>
<!-- Note: we currently use the default key for signing. We can add
support for alternate keys using the -u option. -->
<exec executable="gpg" failonerror="true">
<arg value="-a"/>
<arg value="-b"/>
<arg value="@{file}"/>
</exec>
</sequential>
</macrodef>
<macrodef name="make-jar">
<attribute name="destfile"/>
<attribute name="basedir"/>
<sequential>
<git-sha1 outputproperty="sha1"/>
<jar destfile="@{destfile}" basedir="@{basedir}">
<manifest>
<attribute name="Implementation-Version" value="${sha1}"/>
</manifest>
</jar>
</sequential>
</macrodef>
<macrodef name="make">
<attribute name="dir" />
<element name="args" />
<sequential>
<exec executable="make" failonerror="true" dir="@{dir}">
<args/>
</exec>
</sequential>
</macrodef>
<macrodef name="git-sha1">
<attribute name="outputproperty"/>
<sequential>
<exec executable="git" dir="${basedir}" outputproperty="@{outputproperty}">
<arg value="show-ref"/>
<arg value="-s"/>
<arg value="HEAD"/>
</exec>
</sequential>
</macrodef>
</project>