-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathswinglabs-build-impl.xml
executable file
·259 lines (208 loc) · 9.71 KB
/
swinglabs-build-impl.xml
1
<?xml version="1.0" encoding="UTF-8"?><!-- TODO!! Fix the javadoc target. At the present, it requires tweaking for each sub project. This ANT build script provides common functionality that all SwingLabs projects may take advantage of. Similar to the NetBeans build-impl.xml file, this file declares a few ant tasks which may be overridden by the build.xml file, or simply called to directly. This file defines three core targets, "bundles", "javadoc", and "coverage". The "bundles" target will create the bin.zip and src.zip deliverables for the project. Properties that can be used to dictate the name of these bundles, and the location of these bundles, can be specified in the project.properties file. The "javadoc" target can be used to create more complete JavaDocs. References to core JDK classes will be linked, and methods with the @inheritDoc JavaDoc tag will actually inherit the doc. Note however, that this may require some setup on your system to work properly. The "coverage" target uses EMMA to compute the test coverage. That is, it computes what percentage of the project is covered by unit tests. Properties can also be set to govern how this coverage is computed. As with the NetBeans build-impl.xml file, there are -pre and -post targets declared for each of these core targets, allowing you to customize in the build.xml file how these targets are executed. This build script must be placed in the root directory alongside the build.xml file. For the purpose of easier reading the script is divided into following sections: - bundles - coverage - javadoc Version 1.1 --> <project name="swinglabs-build-impl" default="bundle" basedir="."> <!-- ====================== INITIALIZATION SECTION ====================== --> <!-- path element used by EMMA taskdef below: --> <!--<path id="emma.lib" > <pathelement location="${emma.dir}/emma.jar" /> <pathelement location="${emma.dir}/emma_ant.jar" /> </path>--> <!-- this loads <emma> and <emmajava> custom tasks: --> <!--<taskdef resource="emma_ant.properties" classpathref="emma.lib" />--> <!-- ====================== BUNDLES SECTION ====================== --> <target name="-pre-bundles-init" /> <!-- Configures the RELEASE_DSTAMP variable, which is used to create the timestamp used for building the bundles --> <target name="-bundles-init"> <tstamp> <format property="RELEASE_DSTAMP" pattern="yyyy_MM_dd" /> </tstamp> </target> <target name="-post-bundles-init" /> <!-- Creates the dist.bundles.dir directory --> <target name="-pre-bundles"> <mkdir dir="${dist.bundles.dir}" /> </target> <target name="-do-bundles" depends="-pre-bin-bundle,-do-bin-bundle,-post-bin-bundle,-pre-src-bundle,-do-src-bundle,-post-src-bundle,-pre-doc-bundle,-do-doc-bundle,-post-doc-bundle" /> <target name="-post-bundles" /> <target name="bundles" depends="init,jar,javadoc,-pre-bundles-init,-bundles-init,-post-bundles-init,-pre-bundles,-do-bundles,-post-bundles" /> <target name="update-posted-file" depends="init" if="posted.txt"> <tstamp> <format property="RELEASE_DSTAMP_LONG" pattern="'week'-w-yyyy-MM-dd" /> </tstamp> <!--MAIN week-42-2006-10-15 swingx-ws--> <!--NOTE: The spacing in this next tag is critical. --> <concat destfile="${posted.txt}" append="true">${build.branch} ${RELEASE_DSTAMP_LONG} ${projectname}</concat> </target> <target name="-pre-doc-bundle" /> <target name="-do-doc-bundle"> <zip basedir="${dist.javadoc.dir}" zipfile="${dist.bundles.dir}/${projectname}-${RELEASE_DSTAMP}-javadoc.zip" compress="0"/> </target> <target name="-post-doc-bundle" /> <target name="-pre-bin-bundle" /> <target name="-do-bin-bundle"> <mkdir dir="${build.bundles.dir}" /> <zip destfile="${dist.bundles.dir}/${projectname}-${RELEASE_DSTAMP}-bin.zip"> <zipfileset dir="${dist.javadoc.dir}" prefix="${projectname}-${RELEASE_DSTAMP}-bin/docs/javadoc"/> <zipfileset dir="lib" includes="**/*.jar" excludes="**/build-only/**" prefix="${projectname}-${RELEASE_DSTAMP}-bin/lib"/> <zipfileset file="${dist.jar}" fullpath="${projectname}-${RELEASE_DSTAMP}-bin/${projectname}-${RELEASE_DSTAMP}.jar"/> </zip> </target> <target name="-post-bin-bundle" /> <target name="-pre-src-bundle" /> <target name="-do-src-bundle"> <mkdir dir="${build.bundles.dir}" /> <zip destfile="${dist.bundles.dir}/${projectname}-${RELEASE_DSTAMP}-src.zip" > <zipfileset dir="." prefix="${projectname}-${RELEASE_DSTAMP}-src"> <exclude name="${build.dir}/**" /> <exclude name="${dist.dir}/**" /> <exclude name="www/**" /> <!-- TODO!! --> <exclude name="**/CVS/**" /> <!-- TODO!! --> <!-- If anything else needs to be exluded, do so here --> </zipfileset> </zip> <delete dir="${build.bundles.dir}/zipdir" /> </target> <target name="-post-src-bundle" /> <!-- ====================== COVERAGE SECTION ====================== --> <target name="-pre-coverage" /> <target name="-do-coverage"> <delete dir="${build.dir}/emma" /> <mkdir dir="${build.dir}/emma" /> <taskdef name="emma" classname="com.vladium.emma.emmaTask" classpath="${emma.dir}/emma.jar:${emma.dir}/emma_ant.jar" /> <emma> <instr instrpath="${build.classes.dir}" destdir="${build.dir}/emma" metadatafile="${basedir}/metadata.em"/> </emma> <echo message="${build.dir}/emma:${run.test.classpath}" /> <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed"> <batchtest todir="${build.test.results.dir}"> <fileset dir="${test.test.dir}" includes="**/*Test.java"/> </batchtest> <classpath> <path path="${build.dir}/emma" /> <path path="${emma.dir}/emma.jar" /> <path path="${emma.dir}/emma_ant.jar" /> <path path="${run.test.classpath}"/> </classpath> <syspropertyset> <propertyref prefix="test-sys-prop."/> <mapper type="glob" from="test-sys-prop.*" to="*"/> </syspropertyset> <formatter type="brief" usefile="false"/> <formatter type="xml"/> <jvmarg line="${run.jvmargs}"/> </junit> <delete dir="${build.dir}/emma" /> <mkdir dir="${dist.dir}/coverage" /> <emma> <report sourcepath="${emma.report.srcpath}"> <fileset dir="${basedir}" > <include name="coverage.ec" /> <include name="metadata.em" /> </fileset> <!-- shouldn't have had to use basedir here, but it looks like a bug makes me do it --> <html outfile="${basedir}/${dist.dir}/coverage/index.html" /> <xml outfile="${basedir}/${dist.dir}/coverage/coverage.xml" /> </report> </emma> <!--<delete file="${basedir}/coverage.ec" />--> </target> <target name="-post-coverage" /> <!-- this --> <target name="coverage" depends="init,jar,compile-test,-pre-test-run,-pre-coverage,-do-coverage,-post-coverage,test-report" if="emma.dir"><!-- <fail if="tests.failed">Some tests failed; see details above.</fail>--> </target> <!-- ====================== JAVADOC SECTION ====================== --> <target name="-javadoc-build" depends="init"> <property name="javadoc.core.src" value=""/> <property name="javadoc.core.linkexternal" value="http://java.sun.com/j2se/1.5.0/docs/api/"/> <property name="javadoc.core.packagelist" value=""/> <property name="javadoc.verbose" value="false"/> <echo>Using custom javadoc target: core src: ${javadoc.core.src} core external: ${javadoc.core.linkexternal} core packagelist: ${javadoc.core.packagelist} </echo> <mkdir dir="${dist.javadoc.dir}"/> <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="false" verbose="${javadoc.verbose}" maxmemory="1024M" sourcepath="${javadoc.srcpath}"> <link offline="true" href="${javadoc.core.linkexternal}" packagelistLoc="${javadoc.core.packagelist}"/> <classpath> <path path="${javac.classpath}"/> </classpath> <packageset dir="${java.dir}" includes="*/**"/> </javadoc> </target> <target name="grok" depends="init,jar"> <!-- <mkdir dir="${dist.dir}/opengrok" /> <java fork="true" jar ="lib/build-only/opengrok.jar"> <arg value="-c /usr/local/bin/ctags" /> <arg value="-s ${java.dir}" /> <arg value="${dist.dir}/opengrok" /> </java>--> </target></project>