Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
|
| 3 | <project name="org.jacoco.build.bundle" default="package">
|
| 4 |
|
Marc R. Hoffmann | 22bc7f0 | 2009-07-07 13:01:04 +0000 | [diff] [blame] | 5 | <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. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 11 | <property name="source.bundle.dir" location="${basedir}"/>
|
Marc R. Hoffmann | a88d64c | 2009-07-03 08:41:53 +0000 | [diff] [blame] | 12 | <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. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 18 |
|
| 19 | <import file="${source.bundle.dir}/buildhook.xml"/>
|
| 20 |
|
Marc R. Hoffmann | a88d64c | 2009-07-03 08:41:53 +0000 | [diff] [blame] | 21 |
|
| 22 | <!-- ===================================================================
|
| 23 | COMPILE
|
| 24 | =================================================================== -->
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 25 |
|
| 26 | <target name="compile" if="do.compile">
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 27 | <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. Hoffmann | a88d64c | 2009-07-03 08:41:53 +0000 | [diff] [blame] | 33 | <copy todir="${result.tmp.bundle.classes.dir}">
|
| 34 | <fileset refid="classpathresources"/>
|
| 35 | </copy>
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 36 | </target>
|
| 37 |
|
| 38 |
|
Marc R. Hoffmann | a88d64c | 2009-07-03 08:41:53 +0000 | [diff] [blame] | 39 | <!-- ===================================================================
|
| 40 | PACKAGE
|
| 41 | =================================================================== -->
|
| 42 |
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 43 | <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. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 51 |
|
| 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. Hoffmann | a88d64c | 2009-07-03 08:41:53 +0000 | [diff] [blame] | 66 | <!-- ===================================================================
|
| 67 | VERIFY
|
| 68 | =================================================================== -->
|
| 69 |
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 70 | <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. Hoffmann | 2bb2a37 | 2009-07-09 14:14:54 +0000 | [diff] [blame] | 77 | <junit haltonfailure="true">
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 78 | <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. Hoffmann | a88d64c | 2009-07-03 08:41:53 +0000 | [diff] [blame] | 91 |
|
| 92 | <!-- ===================================================================
|
| 93 | DOC
|
| 94 | =================================================================== -->
|
| 95 |
|
Marc R. Hoffmann | 4960413 | 2009-07-09 15:59:58 +0000 | [diff] [blame^] | 96 | <target name="doc" if="do.customdoc" depends="manifest">
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 97 | <antcall target="customdoc" inheritall="true" inheritrefs="true"/>
|
Marc R. Hoffmann | 4960413 | 2009-07-09 15:59:58 +0000 | [diff] [blame^] | 98 | </target>
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 99 |
|
Marc R. Hoffmann | 4960413 | 2009-07-09 15:59:58 +0000 | [diff] [blame^] | 100 |
|
| 101 | <!-- ===================================================================
|
| 102 | ALL
|
| 103 | =================================================================== -->
|
| 104 |
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 105 | <target name="all" depends="compile,package,verify,doc"/>
|
| 106 |
|
| 107 | </project> |