blob: 0c98e245d10f1e6ba9a9f1bab5988ace8273498c [file] [log] [blame]
The Android Open Source Projectf6fe8972009-03-03 19:29:29 -08001<?xml version="1.0"?>
2<!-- ============= [build file for ANT v1.5.x] ====================== -->
3<!DOCTYPE project
4[
5 <!ENTITY dependencies SYSTEM "dependencies.xml" >
6]>
7
8<project name="emma" default="build" basedir="." >
9 <!-- $Id: build.xml,v 1.2.2.3 2005/06/13 00:20:55 vlad_r Exp $ -->
10 <property name="app.short.name" value="${ant.project.name}" />
11 <property name="app.project.start.date" value="2001/02/01" />
12
13 <!-- TODO: build log -->
14
15 <!-- ============================================================== -->
16
17 <!-- pull in the OS environment variables; an OS env variable VAR can be used as ${env.VAR}: -->
18 <property environment="env" />
19
20 <!-- ============================================================== -->
21 <!-- build branch properties and local customization overrides: -->
22
23 <!-- first, load the official build settings file: -->
24 <property file="build.properties" />
25
26 <!-- next, load the CVS-versioned release/branch properties file: -->
27 <property file="release.properties" />
28
29 <!-- next, load an optional global properties file: -->
30 <property file="${env.ANT_BLDENV}/ant.properties" />
31
32 <!-- ============================================================== -->
33 <!-- global compiler settings: -->
34
35 <property name="build.debug" value="on" /> <!-- default for a release build is "on" -->
36 <property name="build.deprecation" value="off" />
37 <property name="build.compiler" value="modern" />
38 <property name="build.sysclasspath" value="ignore" />
39 <property name="build.target" value="1.2" /> <!-- all .class files are stamped as compatible with 1.2 JVMs: -->
40
41 <!-- ============================================================== -->
42 <!-- main/default build target: -->
43
44 <target name="build" depends="dist"
45 description="-> full build [without 'clean']"
46 />
47
48 <!-- helper build subtargets: -->
49
50 <target name="build.core.compile" depends="core.compile"
51 description="-> re-compiles updated core sources [no 'clean']"
52 />
53 <target name="build.core.package" depends="core.package"
54 description="-> re-packages core classes [no 'clean']"
55 />
56
57 <!-- build modifier targets: -->
58
59 <target name="official"
60 description="-> switches 'build' into official, CVS-aware mode" >
61 <property name="build.is.official" value="yes" />
62 </target>
63
64 <target name="release"
65 description="-> [RELEASE]" >
66 <property name="build.is.on.a.branch" value="yes" />
67 <property name="app.build.release.tag" value="" /> <!-- no tag means official release -->
68 <property name="file.release.prefix" value="" />
69 <property name="cvs.ready.label.prefix" value="RELEASE" />
70 </target>
71
72 <target name="stable"
73 description="-> [STABLE]" >
74 <property name="app.build.release.tag" value=" (stable)" />
75 <property name="file.release.prefix" value="-stable" />
76 <property name="cvs.ready.label.prefix" value="STABLE" />
77 </target>
78
79 <!-- ============================================================== -->
80 <!-- init targets: -->
81 <!-- ============================================================== -->
82
83 <!-- static (checked-in) build structure: -->
84 <property file="module.dirs.properties" />
85
86 <!-- work (created by the build) build structure: -->
87 <property file="work.dirs.properties" />
88
89 <target name="init.work.dirs" >
90 <mkdir dir="${out.dir}" />
91 <mkdir dir="${dist.dir}" />
92 <mkdir dir="${release.dir}" />
93 <mkdir dir="${temp.dir}" />
94
95 <mkdir dir="${tools.classes.out.dir}" />
96
97 <mkdir dir="${core.classes.out.dir}" />
98 <mkdir dir="${core.srcgen.out.dir}" />
99 <mkdir dir="${core.res.out.dir}" />
100
101 <mkdir dir="${ant.classes.out.dir}" />
102 </target>
103
104 <target name="init" depends="init.work.dirs">
105 <!-- NOTE: the official build machine sets these explicitly,
106 these unofficial defaults are provided for private builds only: -->
107 <property name="build.target.j2se.14.home" value="${java.home}" />
108 <property name="build.target.j2se.12.home" value="${build.target.j2se.14.home}" />
109 <property name="build.target.j2se.13.home" value="${build.target.j2se.14.home}" />
110
111 <property name="build.target.ant.15.home" value="${env.ANT_HOME}" />
112 <property name="build.target.ant.14.home" value="${build.target.ant.15.home}" />
113
114
115 <!-- verify that we have J2SE 1.4+: -->
116 <available property="j2se.is.14+" classname="java.lang.CharSequence" />
117 <fail unless="j2se.is.14+">location [${build.target.j2se.14.home}] does not specify J2SE 1.4+</fail>
118
119 <available file="${temp.dir}/.ready.build.stamp" type="file" property="build.is.dirty" value="yes" />
120
121 <!-- include dependencies.xml (a dynamic include by design): -->
122 &dependencies;
123
124 <echo message="ANT version: ${ant.version}" />
125 <echo message="JDK version: ${ant.java.version}" />
126 <echo message="build debug flag: ${build.debug}" />
127 </target>
128
129 <!-- ============================================================== -->
130 <!-- support targets: -->
131 <!-- ============================================================== -->
132
133 <target name="clean" depends="clean.out, clean.dist" description="-> complete clean (output + distribution)" />
134
135 <target name="clean.out" description="-> output clean" >
136 <delete dir="${out.dir}" />
137 </target>
138
139 <target name="clean.dist" description="-> distribution clean" >
140 <delete dir="${dist.dir}"/>
141 <delete dir="${release.dir}"/>
142 </target>
143
144
145 <target name="timestamp" depends="init, -timestamp.1, -timestamp.2, -timestamp.3, -timestamp.4, -timestamp.5">
146 </target>
147
148 <target name="-timestamp.1" depends="init" unless="build.is.dirty" >
149 <java classname="com.vladium.util.version.VersionStampTool"
150 classpathref="lib.internal.classpath"
151 output="${temp.dir}/.ready.build.stamp"
152 append="no"
153 >
154 <arg value="-start" />
155 <arg value="${app.project.start.date}" />
156 <arg value="-format" />
157 <arg value="~F~" />
158 </java>
159 <java classname="com.vladium.util.version.VersionStampTool"
160 classpathref="lib.internal.classpath"
161 output="${temp.dir}/timestamp.properties"
162 append="no"
163 >
164 <arg value="-start" />
165 <arg value="${app.project.start.date}" />
166 <arg value="-fend" />
167 <arg value="${temp.dir}/.ready.build.stamp" />
168 <arg value="-format" />
169 <arg value="app.build.id=${app.build.id.format}\napp.build.date=${app.build.date.format}" />
170 </java>
171 <!-- TODO: this is ugly and breaks private builds (constant appending is bad any way): -->
172 <!-- <echo message="file.release.prefix=${file.release.prefix}" file="${temp.dir}/timestamp.properties" append="yes" /> -->
173 </target>
174
175 <target name="-timestamp.2" depends="init" >
176 <property file="${temp.dir}/timestamp.properties" />
177
178 <!-- private/Eclipse build defaults: -->
179 <property name="app.build.release.tag" value=" (unsupported private build)" />
180 <property name="app.bug.report.link" value="this private build is unsupported" />
181 <property name="file.release.prefix" value="-private" />
182
183 <property name="file.release.label" value="${app.major.version}.${app.minor.version}.${app.build.id}" />
184 <echo message="build id: ${file.release.label}${app.build.release.tag}" />
185 </target>
186
187 <target name="-timestamp.2a" depends="init" if="build.is.on.a.branch" >
188 <property name="cvs.branch.label" value="BRANCH_${app.major.version}_${app.minor.version}" />
189 </target>
190
191 <target name="-timestamp.3" depends="init, -timestamp.2a" if="build.is.official" >
192 <property name="cvs.ready.label" value="${cvs.ready.label.prefix}_${app.major.version}_${app.minor.version}_${app.build.id}" />
193 <property name="cvs.branch.label" value="HEAD" /> <!-- default to a trunk/stable build -->
194 <echo message="CVS branch label: ${cvs.branch.label}" />
195 <echo message="release version (CVS ready label): ${cvs.ready.label}" />
196 </target>
197
198 <target name="-timestamp.4" depends="init, build.cvs.ready" if="build.is.official" >
199 </target>
200
201 <target name="-timestamp.5" depends="init" unless="build.is.dirty" >
202 <copy overwrite="yes" todir="${core.srcgen.out.dir}" >
203 <fileset dir="${core.data.dir}" includes="**/*.java" />
204 <filterset>
205 <filter token="APP_MAJOR_VERSION" value='*/ ${app.major.version}; // ' />
206 <filter token="APP_MINOR_VERSION" value='*/ ${app.minor.version}; // ' />
207 <filter token="APP_BUILD_ID" value='*/ ${app.build.id}; // ' />
208 <filter token="APP_BUILD_RELEASE_TAG" value='*/ "${app.build.release.tag}"; // ' />
209 <filter token="APP_BUILD_DATE" value='*/ "${app.build.date}"; // ' />
210 <filter token="APP_BUG_REPORT_LINK" value='*/ "${app.bug.report.link}"; // ' />
211 <filter token="APP_HOME_SITE_LINK" value='*/ "${app.home.site.link}"; // ' />
212 </filterset>
213 </copy>
214 <copy overwrite="yes" file="${core.data.dir}/MANIFEST.MF" todir="${temp.dir}" >
215 <filterset>
216 <filter token="JDK_ID" value="JDK_${ant.java.version}" />
217 <filter token="BUILD_USER_NAME" value="${user.name} on ${os.name}:${os.version}:${os.arch}" />
218
219 <filter token="APP_NAME" value="${app.short.name}" />
220 <filter token="APP_MAJOR_VERSION" value="${app.major.version}" />
221 <filter token="APP_MINOR_VERSION" value="${app.minor.version}" />
222 <filter token="APP_BUILD_ID" value="${app.build.id}" />
223 <filter token="APP_BUILD_RELEASE_TAG" value="${app.build.release.tag}" />
224 <filter token="APP_BUILD_DATE" value="${app.build.date}" />
225 <filter token="APP_BUG_REPORT_LINK" value="${app.bug.report.link}" />
226 <filter token="APP_HOME_SITE_LINK" value="${app.home.site.link}" />
227 </filterset>
228 </copy>
229 </target>
230
231 <target name="-pre-compile" depends="init, timestamp" >
232 </target>
233
234 <!-- ============================================================== -->
235 <!-- compilation targets: -->
236 <!-- ============================================================== -->
237
238 <target name="compile" depends="init, core.compile, ant.compile, tools.compile" />
239
240 <!-- ========================== -->
241 <!-- core module: -->
242
243 <target name="core.bootstrap.compile" depends="init, -pre-compile" >
244 <javac destdir="${core.classes.out.dir}"
245 debug="${build.debug}"
246 deprecation="${build.deprecation}"
247 target="${build.target}"
248 bootclasspathref="boot.j2se.12.classpath"
249 extdirs="${ext.j2se.12.classpath}"
250 classpathref="core.classpath"
251 >
252 <!-- include IAppVersion.java: -->
253 <src path="${core.srcgen.out.dir}" />
254
255 <!-- classes used by core.src.java12.dir sources: -->
256 <src path="${core.src.java12.dir}" />
257 <include name="**/util/Property.java" />
258 <include name="**/IAppConstants.java" />
259 </javac>
260 </target>
261
262 <target name="core.java14.compile" depends="init, core.bootstrap.compile" >
263 <javac destdir="${core.classes.out.dir}"
264 debug="${build.debug}"
265 deprecation="${build.deprecation}"
266 target="${build.target}"
267 bootclasspathref="boot.j2se.14.classpath"
268 extdirs="${ext.j2se.14.classpath}"
269 classpathref="core.classpath"
270 >
271 <src path="${core.src.java14.dir}" />
272 </javac>
273 </target>
274
275 <target name="core.java13.compile" depends="init, core.java14.compile" >
276 <javac destdir="${core.classes.out.dir}"
277 debug="${build.debug}"
278 deprecation="${build.deprecation}"
279 target="${build.target}"
280 bootclasspathref="boot.j2se.13.classpath"
281 extdirs="${ext.j2se.13.classpath}"
282 classpathref="core.classpath"
283 >
284 <src path="${core.src.java13.dir}" />
285 </javac>
286 </target>
287
288 <!-- the bulk of core compilation: -->
289 <target name="core.compile" depends="init, core.java13.compile" >
290 <javac destdir="${core.classes.out.dir}"
291 debug="${build.debug}"
292 deprecation="${build.deprecation}"
293 target="${build.target}"
294 bootclasspathref="boot.j2se.12.classpath"
295 extdirs="${ext.j2se.12.classpath}"
296 classpathref="core.classpath"
297 >
298 <src path="${core.src.java12.dir}" />
299 <exclude name="**/util/Property.java" />
300 <exclude name="**/IAppConstants.java" />
301 </javac>
302 </target>
303
304 <!-- ========================== -->
305 <!-- tools module: -->
306
307 <target name="tools.compile" depends="init, core.compile" >
308 <javac destdir="${tools.classes.out.dir}"
309 debug="${build.debug}"
310 deprecation="${build.deprecation}"
311 target="${build.target}"
312 bootclasspathref="boot.j2se.14.classpath"
313 extdirs="${ext.j2se.14.classpath}"
314 classpathref="tools.classpath"
315 >
316 <src path="${tools.src.dir}" />
317 </javac>
318 </target>
319
320 <!-- ========================== -->
321 <!-- ant module: -->
322
323 <target name="ant.15.compile" depends="init, core.compile" >
324 <javac destdir="${ant.classes.out.dir}"
325 debug="${build.debug}"
326 deprecation="${build.deprecation}"
327 target="${build.target}"
328 bootclasspathref="boot.j2se.12.classpath"
329 extdirs="${ext.j2se.12.classpath}"
330 classpathref="ant.15.classpath"
331 >
332 <src path="${ant.src.ant15.dir}" />
333 </javac>
334 </target>
335
336 <!-- the bulk of ant compilation: -->
337 <target name="ant.compile" depends="init, core.compile, ant.15.compile" >
338 <javac destdir="${ant.classes.out.dir}"
339 debug="${build.debug}"
340 deprecation="${build.deprecation}"
341 target="${build.target}"
342 bootclasspathref="boot.j2se.12.classpath"
343 extdirs="${ext.j2se.12.classpath}"
344 classpathref="ant.14.classpath"
345 >
346 <src path="${ant.src.ant14.dir}" />
347 </javac>
348 </target>
349
350
351 <!-- ============================================================== -->
352 <!-- packaging targets: -->
353 <!-- ============================================================== -->
354
355 <target name="package" depends="init, core.package, ant.package" />
356
357 <!-- ========================== -->
358 <!-- run tools: -->
359
360 <target name="rtclosure.gen" depends="init, compile" >
361 <property name="rtclosure.resource" value="com/vladium/emma/rt/RTExitHook.closure" />
362 <property name="rtclosure.classpath" refid="core.classpath" />
363
364 <java classname="com.vladium.tools.ClassDep"
365 classpathref="tools.classpath"
366 >
367 <arg value="${rtclosure.classpath}" />
368 <arg value="${core.res.out.dir}/${rtclosure.resource}" />
369 <arg value="com.vladium.emma.rt.RTExitHook" />
370 <arg value="com.vladium.emma.data.CoverageData" />
371 </java>
372 </target>
373
374 <!-- ========================== -->
375 <!-- core module: -->
376
377 <target name="core.package" depends="init, core.compile, rtclosure.gen" >
378 <jar jarfile="${out.dir}/${app.short.name}.jar"
379 manifest="${temp.dir}/MANIFEST.MF"
380 compress="true"
381 index="false"
382 >
383 <!-- classes: -->
384 <fileset dir="${core.classes.out.dir}" includes="**/*.class" />
385 <!-- classloader resources: -->
386 <fileset dir="${core.res.dir}" excludes="**/*.exclude" />
387 <fileset dir="${core.res.out.dir}" excludes="**/*.exclude" />
388 <manifest>
389 <attribute name="Main-Class" value="${app.short.name}run" />
390 </manifest>
391 </jar>
392 </target>
393
394 <!-- ========================== -->
395 <!-- ant module: -->
396
397 <target name="ant.package" depends="init, ant.compile" >
398 <jar jarfile="${out.dir}/${app.short.name}_ant.jar"
399 manifest="${temp.dir}/MANIFEST.MF"
400 compress="true"
401 index="false"
402 >
403 <!-- classes: -->
404 <fileset dir="${ant.classes.out.dir}" includes="**/*.class" />
405 <!-- classloader resources: -->
406 <fileset dir="${ant.res.dir}" excludes="**/*.exclude" />
407 <manifest>
408 <attribute name="Main-Class" value="com.vladium.${app.short.name}.ANTMain" />
409 </manifest>
410 </jar>
411 </target>
412
413 <!-- ============================================================== -->
414 <!-- distribution targets: -->
415 <!-- ============================================================== -->
416
417 <target name="dist" depends="init, core.dist, ant.dist" />
418
419 <!-- ========================== -->
420 <!-- core module: -->
421 <target name="core.dist" depends="init, core.package" >
422 <copy file="${out.dir}/${app.short.name}.jar" todir="${dist.dir}" />
423 </target>
424
425 <!-- ========================== -->
426 <!-- ant module: -->
427 <target name="ant.dist" depends="init, ant.package" >
428 <copy file="${out.dir}/${app.short.name}_ant.jar" todir="${dist.dir}" />
429 </target>
430
431 <!-- ============================================================== -->
432 <!-- file release targets: -->
433 <!-- ============================================================== -->
434
435 <target name="publish.release" depends="init, release, publish.property.check, release.lib, release.full, release.src" >
436 </target>
437
438 <target name="publish.stable" depends="init, stable, publish.property.check, release.lib" >
439 <fail unless="file.release.label">need ${file.release.label}</fail>
440 </target>
441
442 <target name="publish.property.check" depends="init" >
443 <fail unless="file.release.label">property ${file.release.label} must be set</fail>
444 <fail unless="docs.dist.dir">property ${docs.dist.dir} must be set</fail>
445 <property name="publish.ok" value="true" />
446 </target>
447
448
449 <target name="release.lib" depends="init" if="publish.ok" >
450 <!-- lib distribution: -->
451 <zip destfile="${release.dir}/${app.short.name}${file.release.prefix}-${file.release.label}-lib.zip"
452 basedir="${dist.dir}"
453 includes="*.jar"
454 />
455 </target>
456
457 <target name="release.src" depends="init" if="publish.ok" >
458 <!-- source files: -->
459 <zip destfile="${release.dir}/${app.short.name}-${file.release.label}-src.zip" >
460 <zipfileset prefix="${app.short.name}-${file.release.label}"
461 dir="${basedir}"
462 includes="${tools}/**, ${core}/**, ${ant}/**, ${lib}/**"
463 excludes="*/CVS/*"
464 />
465 <!-- license, build script and instructions, etc: -->
466 <zipfileset prefix="${app.short.name}-${file.release.label}"
467 dir="${basedir}"
468 includes="*.txt, *.xml, *.html, *.properties"
469 excludes="build.properties"
470 />
471 </zip>
472 </target>
473
474 <target name="release.full" depends="init" if="publish.ok" >
475 <zip destfile="${release.dir}/${app.short.name}-${file.release.label}.zip" >
476 <!-- license: -->
477 <zipfileset prefix="${app.short.name}-${file.release.label}"
478 dir="${basedir}/"
479 includes="cpl*.html"
480 />
481 <!-- examples and related instructions: -->
482 <zipfileset prefix="${app.short.name}-${file.release.label}"
483 dir="${basedir}/install/data"
484 />
485 <!-- lib distribution: -->
486 <zipfileset prefix="${app.short.name}-${file.release.label}/lib"
487 dir="${dist.dir}"
488 includes="*.jar"
489 />
490 <!-- doc distribution: -->
491 <zipfileset prefix="${app.short.name}-${file.release.label}/docs"
492 dir="${docs.dist.dir}/docs"
493 />
494 </zip>
495 </target>
496
497
498 <!-- ============================================================== -->
499 <!-- CVS targets: -->
500 <!-- ============================================================== -->
501
502 <target name="build.cvs.ready" if="cvs.ready.label">
503 <cvs failonerror="yes" output="${out.dir}/cvs.txt" error="${out.dir}/cvs.error.txt"
504 command="-t rtag -r ${cvs.branch.label} -F -a ${cvs.ready.label} ${app.short.name}" />
505 </target>
506
507 <target name="build.cvs.unready" if="cvs.ready.label">
508 <cvs failonerror="yes" output="${out.dir}/cvs.txt" error="${out.dir}/cvs.error.txt"
509 command="-t rtag -r ${cvs.branch.label} -d -a ${cvs.ready.label} ${app.short.name}" />
510 </target>
511
512</project>
513<!-- ========= END OF FILE ========================================== -->
514