-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
217 lines (198 loc) · 6.6 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
<?xml version="1.0"?>
<project name="gag" default="current" basedir=".">
<property file="build.properties"/>
<path id="agent-classpath">
<fileset dir="${lib.dir}/agent">
<include name="asm-3.1.jar"/>
<include name="asm-commons-3.1.jar"/>
<include name="google-collect-1.0.jar"/>
</fileset>
</path>
<path id="test-classpath">
<fileset dir="${lib.dir}/test">
<include name="junit.jar"/>
</fileset>
</path>
<target name="clean-build">
<delete dir="${build.dir}" quiet="true"/>
</target>
<target name="clean-javadoc">
<delete dir="javadoc" quiet="true"/>
</target>
<target name="compile-gag"
description="Compile the annotations classes">
<mkdir dir="${build.dir}/classes/gag"/>
<javac
srcdir="${src.dir}"
destdir="${build.dir}/classes/gag"
sourcepath=""
includes="com/google/gag/annotation/**/*.java com/google/gag/enumeration/**/*.java"
debug="true"
deprecation="on"
includeantruntime="false"/>
</target>
<target name="jar-gag"
depends="compile-gag"
description="Build the annotations jar">
<delete file="${build.dir}/gag.jar" quiet="true"/>
<jar
jarfile="${build.dir}/gag.jar"
basedir="${build.dir}/classes/gag"
includes="**/*.class"/>
</target>
<target name="jar-gag-src"
depends="compile-gag"
description="Build the annotation jar with source">
<delete file="${build.dir}/gag-src.jar" quiet="true"/>
<jar jarfile="${build.dir}/gag-src.jar">
<fileset dir="${build.dir}/classes/gag"/>
<fileset
dir="${src.dir}"
includes="com/google/gag/annotation/**/*.java com/google/gag/enumeration/**/*.java"/>
</jar>
</target>
<target name="compile-agent"
depends="compile-gag"
description="Compile the agent classes">
<mkdir dir="${build.dir}/classes/gag-agent"/>
<javac
srcdir="${src.dir}"
destdir="${build.dir}/classes/gag-agent"
sourcepath=""
includes="com/google/gag/instrument/**/*.java com/google/gag/agent/**/*.java"
debug="true"
deprecation="on"
includeantruntime="false">
<classpath>
<path refid="agent-classpath"/>
<pathelement location="${build.dir}/classes/gag"/>
</classpath>
</javac>
</target>
<target name="jar-agent"
depends="compile-agent"
description="Build the agent jar">
<delete file="${build.dir}/gag-agent.jar" quiet="true"/>
<jar
jarfile="${build.dir}/gag-agent.jar"
basedir="${build.dir}/classes/gag-agent"
includes="**/*.class">
<manifest>
<attribute name="Premain-Class" value="com.google.gag.agent.GagTransformer"/>
<attribute name="Class-Path" value="asm-3.1.jar asm-commons-3.1.jar google-collect-1.0.jar"/>
</manifest>
</jar>
</target>
<target name="javadoc"
description="Generate Javadocs">
<mkdir dir="${build.dir}/javadoc"/>
<javadoc packagenames="${javadoc.packagenames}"
destdir="${build.dir}/javadoc"
author="false"
protected="true"
windowtitle="Google Annotations Gallery ${version}">
<sourcepath>
<pathelement location="${src.dir}"/>
<pathelement location="${demo.dir}"/>
</sourcepath>
<classpath refid="agent-classpath"/>
</javadoc>
</target>
<target name="dist"
depends="jar-gag, jar-agent, javadoc"
description="Build distribution zip file">
<mkdir dir="${build.dir}/dist"/>
<mkdir dir="${build.dir}/dist/demo"/>
<mkdir dir="${build.dir}/dist/lib"/>
<mkdir dir="${build.dir}/dist/src"/>
<mkdir dir="${build.dir}/dist/test"/>
<copy toDir="${build.dir}/dist" file="build.properties"/>
<copy toDir="${build.dir}/dist" file="build.xml"/>
<copy toDir="${build.dir}/dist" file="COPYING"/>
<copy toDir="${build.dir}/dist" file="README"/>
<copy toDir="${build.dir}/dist">
<fileset dir="${build.dir}" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="${build.dir}" includes="javadoc/**/*"/>
</copy>
<copy toDir="${build.dir}/dist/demo">
<fileset dir="${demo.dir}"/>
</copy>
<copy toDir="${build.dir}/dist/lib">
<fileset dir="${lib.dir}"/>
</copy>
<copy toDir="${build.dir}/dist/src">
<fileset dir="${src.dir}" includes="**/*"/>
</copy>
<copy toDir="${build.dir}/dist/test">
<fileset dir="${test.dir}" includes="**/*"/>
</copy>
<zip destfile="${build.dir}/gag-${version}.zip">
<zipfileset dir="${build.dir}/dist"/>
</zip>
</target>
<target name="compile-demo"
depends="compile-gag"
description="Compile the demo classes">
<mkdir dir="${build.dir}/classes/demo"/>
<javac
srcdir="${demo.dir}"
debug="true"
destdir="${build.dir}/classes/demo"
includes="**/*.java"
deprecation="on"
includeantruntime="false">
<classpath>
<pathelement location="${build.dir}/classes/gag"/>
</classpath>
</javac>
</target>
<target name="compile-test"
depends="compile-gag"
description="Compile the test classes">
<mkdir dir="${build.dir}/classes/test"/>
<javac
srcdir="${test.dir}"
debug="true"
destdir="${build.dir}/classes/test"
includes="**/*.java"
deprecation="on"
includeantruntime="false">
<classpath>
<pathelement location="${build.dir}/classes/gag"/>
<path refid="test-classpath"/>
</classpath>
</javac>
</target>
<target name="run-demo"
depends="compile-demo, jar-agent"
description="Run the demo">
<java
fork="true"
classname="com.google.gag.demo.RunDemo"
taskname="demo">
<jvmarg value="-javaagent:${build.dir}/gag-agent.jar"/>
<classpath>
<pathelement location="${build.dir}/classes/demo"/>
<pathelement location="${build.dir}/classes/gag"/>
<path refid="agent-classpath"/>
</classpath>
</java>
</target>
<target name="run-test"
depends="compile-test,jar-agent"
description="Run the tests">
<junit fork="yes" printsummary="yes" haltonfailure="no">
<jvmarg value="-javaagent:${build.dir}/gag-agent.jar"/>
<classpath>
<pathelement location="${build.dir}/classes/gag"/>
<pathelement location="${build.dir}/classes/test"/>
<path refid="test-classpath"/>
<path refid="agent-classpath"/>
</classpath>
<formatter type="plain" usefile="false"/>
<test name="com.google.gag.AllTests"/>
</junit>
</target>
</project>