<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<!-- | |
Copyright (c) 2012 Original authors and others. | |
All rights reserved. This program and the accompanying materials | |
are made available under the terms of the Eclipse Public License v1.0 | |
which accompanies this distribution, and is available at | |
http://www.eclipse.org/legal/epl-v10.html | |
Contributors: | |
Original authors and others - initial API and implementation | |
--> | |
<!-- | |
Common set of Ant tasks | |
These taks are invoked once for each module, via subant call | |
--> | |
<project basedir="." default="build" name="nattable"> | |
<tstamp /> | |
<property name="datetime.stamp" value="${DSTAMP}${TSTAMP}" /> | |
<property environment="env" /> | |
<!-- Look in the user home for the clipse install. You can override by | |
using -DECLIPSE_HOME="xxx" on the command line --> | |
<property name="ECLIPSE_HOME" value="${user.home}/eclipse_rcp_3_5" /> | |
<property name="debuglevel" value="source,lines,vars" /> | |
<property name="target" value="1.5" /> | |
<property name="source" value="1.5" /> | |
<property name="version" value="2.0.0" /> | |
<!-- src and binaries --> | |
<property name="src.dir" value="src" /> | |
<property name="build.tools.dir" value="../deps/tools" /> | |
<property name="target.dir" value="target" /> | |
<!-- Class files go here --> | |
<property name="build.dir" value="${target.dir}/bin" /> | |
<!-- Jars go here --> | |
<property name="dist.dir" value="${target.dir}/dist" /> | |
<property name="emma.metadata.dir" location="${target.dir}/emma/metadata" /> | |
<!-- Junit test reports --> | |
<property name="junit.reports.dir" value="${target.dir}/reports/junit" /> | |
<!-- Findbugs reports --> | |
<property name="findbugs.report.dir" value="${target.dir}/reports/findbugs" /> | |
<!-- Eclipse deps linked off an eclipse RCP install --> | |
<filelist id="eclipse.lib" dir="${ECLIPSE_HOME}/plugins"> | |
<file name="org.apache.commons.lang_2.3.0.v200803061910.jar" /> | |
<file name="org.apache.commons.logging_1.0.4.v200904062259.jar" /> | |
<file name="org.eclipse.core.commands_3.5.0.I20090525-2000.jar" /> | |
<file name="org.eclipse.core.runtime_3.5.0.v20090525.jar" /> | |
<file name="org.eclipse.equinox.common_3.5.0.v20090520-1800.jar" /> | |
<file name="org.eclipse.equinox.registry_3.4.100.v20090520-1800.jar" /> | |
<file name="org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800/runtime_registry_compatibility.jar" /> | |
<file name="org.eclipse.jface_3.5.0.I20090525-2000.jar" /> | |
<file name="org.eclipse.equinox.common_3.5.0.v20090520-1800.jar" /> | |
<file name="org.eclipse.equinox.registry_3.4.100.v20090520-1800.jar" /> | |
<file name="org.eclipse.osgi_3.5.0.v20090520.jar" /> | |
<file name="org.hamcrest.core_1.1.0.v20090501071000.jar" /> | |
<file name="org.junit4_4.5.0.v20090423/junit.jar" /> | |
<!-- SWT jar names are platform dependent --> | |
<file name="org.eclipse.swt_3.5.0.v3550b.jar" /> | |
</filelist> | |
<!-- SWT libs, pick up the available SWT jar depending on the platform --> | |
<filelist id="swt.lib" dir="${ECLIPSE_HOME}/plugins"> | |
<file name="org.eclipse.swt.gtk.linux.x86_3.5.0.v3550b.jar"/> | |
<file name="org.eclipse.swt.win32.win32.x86_3.5.0.v3550b.jar"/> | |
</filelist> | |
<!-- Glazed lists --> | |
<filelist id="glazedlists.lib" dir="../deps/plugins"> | |
<file name="glazedlists_java15-1.8.0.jar"/> | |
</filelist> | |
<!-- Setup Emma (code coverage) --> | |
<path id="emma.lib"> | |
<pathelement location="${build.tools.dir}/emma.jar" /> | |
<pathelement location="${build.tools.dir}/emma_ant.jar" /> | |
</path> | |
<taskdef resource="emma_ant.properties" classpathref="emma.lib" /> | |
<!-- Setup findbugs (static analysis) --> | |
<property name="FINDBUGS_HOME" value="${user.home}/findbugs-1.3.9" /> | |
<path id="findbugs.lib" location="${FINDBUGS_HOME}/lib/findbugs-ant.jar" /> | |
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.lib"/> | |
<path id="build.classpath"> | |
<filelist refid="eclipse.lib" /> | |
<filelist refid="swt.lib" /> | |
<filelist refid="glazedlists.lib" /> | |
<path refid="emma.lib" /> | |
<path refid="build.dependencies" /> | |
</path> | |
<target name="init" description="Create dirs and copy source"> | |
<mkdir dir="${build.dir}" /> | |
<mkdir dir="${dist.dir}" /> | |
<copy includeemptydirs="false" todir="${build.dir}"> | |
<fileset dir="${src.dir}"> | |
<exclude name="**/*.launch" /> | |
</fileset> | |
</copy> | |
</target> | |
<!-- Clean --> | |
<target name="clean"> | |
<echo message="Eclipse home: ${ECLIPSE_HOME}" /> | |
<echo message="Findbugs home: ${FINDBUGS_HOME}" /> | |
<delete dir="${target.dir}" /> | |
</target> | |
<!-- | |
Build | |
At the conclusion of the build the jars are generated and the class files | |
are instrumented for recording coverage | |
--> | |
<target name="build" depends="init" description="Compile all sources for the module"> | |
<echo message="Building ${basedir}/${src.dir}" /> | |
<javac fork="true" memoryInitialSize="128m" memoryMaximumSize="512m" debug="true" verbose="false" | |
debuglevel="${debuglevel}" destdir="${build.dir}" srcdir="${src.dir}" | |
source="${source}" target="${target}"> | |
<src path="${src.dir}" /> | |
<classpath> | |
<path refid="build.classpath" /> | |
<pathelement location="${build.dir}" /> | |
</classpath> | |
</javac> | |
<!-- | |
Build Jars and insrument for code coverage | |
Emma instruments the classfiles in place. Hence the jar need to be | |
build before the code is instrumented | |
--> | |
<antcall> | |
<target name="jar" /> | |
<target name="srcjar" /> | |
</antcall> | |
</target> | |
<!-- Jar --> | |
<target name="jar"> | |
<echo message="Creating jar in ${dist.dir}" /> | |
<jar jarfile="${dist.dir}/${jar.file.prefix}_${version}.${datetime.stamp}.jar" manifest="${basedir}/META-INF/MANIFEST.MF"> | |
<fileset dir="${build.dir}"> | |
<exclude name="**/*.java" /> | |
</fileset> | |
<manifest> | |
<attribute name="Build-date" value="${datetime.stamp}"/> | |
</manifest> | |
</jar> | |
</target> | |
<!-- Source Jar --> | |
<target name="srcjar" unless="no.source.jar"> | |
<echo message="Creating source jar in ${dist.dir}" /> | |
<jar jarfile="${dist.dir}/${jar.file.prefix}.source_${version}.${datetime.stamp}.jar" manifest="${basedir}/META-INF/MANIFEST.MF"> | |
<fileset dir="${build.dir}"/> | |
<manifest> | |
<attribute name="Build-date" value="${datetime.stamp}"/> | |
</manifest> | |
</jar> | |
</target> | |
<!-- Junit Test --> | |
<target name="test"> | |
<echo message="Instrumenting code in ${basedir}" /> | |
<antcall target="emma.instrument" /> | |
<echo message="Running tests in ${basedir}" /> | |
<mkdir dir="${emma.metadata.dir}" /> | |
<mkdir dir="${junit.reports.dir}" /> | |
<junit printsummary="yes" haltonerror="no" showoutput="true" fork="true"> | |
<classpath> | |
<path refid="build.classpath" /> | |
<pathelement location="${build.dir}" /> | |
</classpath> | |
<!-- Plug in emma code coverage --> | |
<jvmarg value="-Demma.coverage.out.file=${emma.metadata.dir}/coverage.emma" /> | |
<jvmarg value="-Demma.coverage.out.merge=true" /> | |
<jvmarg value="-Dosgi.bundlefile.limit=100"/> | |
<formatter type="xml" /> | |
<batchtest todir="${junit.reports.dir}"> | |
<fileset dir="${build.dir}" includes="**/*Test.class" /> | |
</batchtest> | |
</junit> | |
<!-- Create pretty report(s) --> | |
<antcall target="junit.report"/> | |
<antcall target="findbugs" /> | |
</target> | |
<!-- | |
Emma. Instrument the code for coverage analysis | |
Test files are not instrumented. This is truned off by setting the do.not.instrument | |
property in the test projects | |
--> | |
<target name="emma.instrument" unless="do.not.instrument"> | |
<emma enabled="true"> | |
<!-- Modifies the class files in place --> | |
<instr metadatafile="${emma.metadata.dir}/metadata.emma" | |
merge="true" mode="overwrite"> | |
<instrpath> | |
<pathelement location="${build.dir}" /> | |
</instrpath> | |
<!-- exclude UI classes --> | |
<filter includes="org.eclipse.nebula.widgets.*" excludes="**/*Dialog.class" /> | |
</instr> | |
</emma> | |
</target> | |
<!-- | |
Find Bugs | |
Assumes that the jar has been built and is available in the ${dist.dir} | |
--> | |
<target name="findbugs" unless="do.not.findbugs"> | |
<echo message="Findbugs home: ${FINDBUGS_HOME}"/> | |
<mkdir dir="${findbugs.report.dir}"/> | |
<findbugs home="${FINDBUGS_HOME}/lib" output="xml" outputFile="${findbugs.report.dir}/findbugs-output.xml" | |
jvmargs="-Xmx256m"> | |
<class location="${dist.dir}" /> | |
<auxClasspath refid="build.classpath"/> | |
<sourcePath path="${src.dir}" /> | |
</findbugs> | |
</target> | |
<!-- JUnit report --> | |
<target name="junit.report"> | |
<junitreport todir="${junit.reports.dir}"> | |
<fileset dir="${junit.reports.dir}"> | |
<include name="TEST-*.xml" /> | |
</fileset> | |
<report format="frames" todir="${junit.reports.dir}/html" /> | |
</junitreport> | |
</target> | |
</project> |