Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
|
Marc R. Hoffmann | 7b5a7b8 | 2009-07-28 08:46:17 +0000 | [diff] [blame] | 3 | <project name="org.jacoco.build.bundle" default="package" xmlns:jacoco="antlib:org.jacoco.ant">
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 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}"/>
|
Marc R. Hoffmann | 9978c1b | 2009-08-11 20:19:15 +0000 | [diff] [blame^] | 59 | <jar destfile="${result.dist.bundle.jar.file}" manifest="${result.temp.bundle.manifest.file}" level="9">
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 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 |
|
Marc R. Hoffmann | 7b5a7b8 | 2009-07-28 08:46:17 +0000 | [diff] [blame] | 74 | <target name="verify" if="do.verify" depends="package,runcustomverify">
|
| 75 |
|
| 76 | <!-- of course we meassure code coverage for JaCoCo tests -->
|
| 77 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
|
| 78 | <classpath>
|
Marc R. Hoffmann | 3bcac15 | 2009-08-06 15:53:46 +0000 | [diff] [blame] | 79 | <file file="${result.dist.lib.dir}/jacocoant.jar"/>
|
Marc R. Hoffmann | 7b5a7b8 | 2009-07-28 08:46:17 +0000 | [diff] [blame] | 80 | </classpath>
|
| 81 | </taskdef>
|
| 82 |
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 83 | <property name="result.tmp.bundle.test.dir" location="${result.tmp.bundle.dir}/test"/>
|
| 84 | <mkdir dir="${result.tmp.bundle.test.dir}"/>
|
Brock Janiczak | bb67913 | 2009-07-29 09:41:10 +0000 | [diff] [blame] | 85 | <jacoco:coverage
|
| 86 | merge="true"
|
| 87 | file="${result.tmp.coverage.file}"
|
Marc R. Hoffmann | 2a6b5bf | 2009-08-11 12:54:36 +0000 | [diff] [blame] | 88 | exclClassLoader="sun.reflect.DelegatingClassLoader|org.jacoco.core.test.TargetLoader">
|
Brock Janiczak | bb67913 | 2009-07-29 09:41:10 +0000 | [diff] [blame] | 89 |
|
Marc R. Hoffmann | 7b5a7b8 | 2009-07-28 08:46:17 +0000 | [diff] [blame] | 90 | <junit haltonfailure="true" fork="true" forkmode="once">
|
| 91 | <batchtest todir="${result.tmp.bundle.test.dir}" >
|
| 92 | <fileset dir="${result.tmp.bundle.classes.dir}">
|
| 93 | <include name="**/*Test.class"/>
|
| 94 | </fileset>
|
| 95 | </batchtest>
|
| 96 | <classpath>
|
| 97 | <pathelement location="${result.tmp.bundle.classes.dir}"/>
|
| 98 | <path refid="dependencies"/>
|
| 99 | </classpath>
|
| 100 | <formatter type="xml"/>
|
| 101 | </junit>
|
Brock Janiczak | bb67913 | 2009-07-29 09:41:10 +0000 | [diff] [blame] | 102 | </jacoco:coverage>
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 103 | </target>
|
| 104 |
|
Marc R. Hoffmann | a88d64c | 2009-07-03 08:41:53 +0000 | [diff] [blame] | 105 |
|
| 106 | <!-- ===================================================================
|
| 107 | DOC
|
| 108 | =================================================================== -->
|
| 109 |
|
Marc R. Hoffmann | 4960413 | 2009-07-09 15:59:58 +0000 | [diff] [blame] | 110 | <target name="doc" if="do.customdoc" depends="manifest">
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 111 | <antcall target="customdoc" inheritall="true" inheritrefs="true"/>
|
Marc R. Hoffmann | 4960413 | 2009-07-09 15:59:58 +0000 | [diff] [blame] | 112 | </target>
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 113 |
|
Marc R. Hoffmann | 4960413 | 2009-07-09 15:59:58 +0000 | [diff] [blame] | 114 |
|
| 115 | <!-- ===================================================================
|
| 116 | ALL
|
| 117 | =================================================================== -->
|
| 118 |
|
Marc R. Hoffmann | 36707f1 | 2009-06-07 21:17:19 +0000 | [diff] [blame] | 119 | <target name="all" depends="compile,package,verify,doc"/>
|
| 120 |
|
| 121 | </project> |