blob: d2c96af3b89a7bc5a29e5aa7087fe9e9d2b03108 [file] [log] [blame]
Marc R. Hoffmann36707f12009-06-07 21:17:19 +00001<?xml version="1.0" encoding="UTF-8"?>
2
3<project name="org.jacoco.build.bundle" default="package">
4
Marc R. Hoffmann22bc7f02009-07-07 13:01:04 +00005 <description>
6 This build file is executed for every JaCoCo bundle. Every bundle must
7 contain a buildhook.xml file that gets imported into this build file and
8 customizes the specific build actions for the bundle.
9 </description>
10
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000011 <property name="source.bundle.dir" location="${basedir}"/>
Marc R. Hoffmanna88d64c2009-07-03 08:41:53 +000012 <property name="source.bundle.java.dir" location="${source.bundle.dir}/src"/>
13
14 <!-- Additional resources to include with the compiled classes. By default
15 none, can be overwritten by the build hook. -->
16 <fileset dir="${source.bundle.java.dir}" excludes="**/*" id="classpathresources"/>
17
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000018
19 <import file="${source.bundle.dir}/buildhook.xml"/>
20
Marc R. Hoffmanna88d64c2009-07-03 08:41:53 +000021
22 <!-- ===================================================================
23 COMPILE
24 =================================================================== -->
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000025
26 <target name="compile" if="do.compile">
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000027 <property name="result.tmp.bundle.classes.dir" location="${result.tmp.bundle.dir}/classes"/>
28 <mkdir dir="${result.tmp.bundle.classes.dir}"/>
29 <javac srcdir="${source.bundle.java.dir}" destdir="${result.tmp.bundle.classes.dir}"
30 debug="true" source="1.5" target="1.5">
31 <classpath refid="dependencies"/>
32 </javac>
Marc R. Hoffmanna88d64c2009-07-03 08:41:53 +000033 <copy todir="${result.tmp.bundle.classes.dir}">
34 <fileset refid="classpathresources"/>
35 </copy>
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000036 </target>
37
38
Marc R. Hoffmanna88d64c2009-07-03 08:41:53 +000039 <!-- ===================================================================
40 PACKAGE
41 =================================================================== -->
42
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000043 <target name="manifest">
44 <property name="source.bundle.manifest.file" location="${source.bundle.dir}/META-INF/MANIFEST.MF"/>
45 <property name="result.temp.bundle.manifest.file" location="${result.tmp.bundle.dir}/MANIFEST.MF"/>
46 <copy file="${source.bundle.manifest.file}" tofile="${result.temp.bundle.manifest.file}"/>
47 <replace file="${result.temp.bundle.manifest.file}" token="qualifier" value="${build.qualifier}"/>
48 <property prefix="manifest" file="${result.temp.bundle.manifest.file}"/>
49 <property name="qualified.bundle.version" value="${manifest.Bundle-Version}"/>
50 </target>
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000051
52 <target name="runcustompackage" if="do.custompackage" depends="manifest">
53 <antcall target="custompackage" inheritall="true" inheritrefs="true"/>
54 </target>
55
56 <target name="package" if="do.package" depends="compile,runcustompackage,manifest">
57 <property name="result.dist.bundle.jar.file" location="${result.dist.lib.dir}/${manifest.Bundle-SymbolicName}_${qualified.bundle.version}.jar"/>
58 <mkdir dir="${result.dist.lib.dir}"/>
59 <jar destfile="${result.dist.bundle.jar.file}" manifest="${result.temp.bundle.manifest.file}">
60 <fileset dir="${result.tmp.bundle.classes.dir}"/>
61 <fileset file="${source.bundle.dir}/about.html"/>
62 </jar>
63 </target>
64
65
Marc R. Hoffmanna88d64c2009-07-03 08:41:53 +000066 <!-- ===================================================================
67 VERIFY
68 =================================================================== -->
69
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000070 <target name="runcustomverify" if="do.customverify">
71 <antcall target="customverify" inheritall="true" inheritrefs="true"/>
72 </target>
73
74 <target name="verify" if="do.verify" depends="compile,runcustomverify">
75 <property name="result.tmp.bundle.test.dir" location="${result.tmp.bundle.dir}/test"/>
76 <mkdir dir="${result.tmp.bundle.test.dir}"/>
Marc R. Hoffmann2bb2a372009-07-09 14:14:54 +000077 <junit haltonfailure="true">
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000078 <batchtest todir="${result.tmp.bundle.test.dir}" >
79 <fileset dir="${result.tmp.bundle.classes.dir}">
80 <include name="**/*Test.class"/>
81 </fileset>
82 </batchtest>
83 <classpath>
84 <pathelement location="${result.tmp.bundle.classes.dir}"/>
85 <path refid="dependencies"/>
86 </classpath>
87 <formatter type="xml"/>
88 </junit>
89 </target>
90
Marc R. Hoffmanna88d64c2009-07-03 08:41:53 +000091
92 <!-- ===================================================================
93 DOC
94 =================================================================== -->
95
Marc R. Hoffmann36707f12009-06-07 21:17:19 +000096 <target name="runcustomdoc" if="do.customdoc" depends="manifest">
97 <antcall target="customdoc" inheritall="true" inheritrefs="true"/>
98 </target>
99
100 <target name="doc" if="do.doc" depends="compile,runcustomdoc,manifest">
101 <mkdir dir="${result.dist.doc.bundle.dir}"/>
102 <javadoc destdir="${result.dist.doc.bundle.dir}"
103 overview="${source.bundle.java.dir}/overview.html"
104 windowtitle="${manifest.Bundle-SymbolicName} ${qualified.bundle.version}">
105 <sourcepath location="${source.bundle.java.dir}"/>
106 <classpath refid="dependencies"/>
107 </javadoc>
108 </target>
Marc R. Hoffmanna88d64c2009-07-03 08:41:53 +0000109
Marc R. Hoffmann36707f12009-06-07 21:17:19 +0000110
111 <target name="all" depends="compile,package,verify,doc"/>
112
113</project>