Index: common-build.xml
===================================================================
--- common-build.xml	(revision 477522)
+++ common-build.xml	(working copy)
@@ -42,10 +42,22 @@
 
   <property name="junit.output.dir" location="${build.dir}/test"/>
   <property name="junit.reports" location="${build.dir}/test/reports"/>
+  <property name="emma.output.dir" location="${build.dir}/test/emma"/>
+  <property name="emma.reports" location="${build.dir}/test/emma"/>	
   <property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
   <property name="junit.excludes" value=""/>
 
   <available
+	property="emma.jar.present"
+	classname="com.vladium.emma.Processor"
+  />
+
+  <available
+	property="emma_ant.jar.present"
+	classname="com.vladium.emma.emmaTask"
+  />
+	
+  <available
     property="javacc.present"
     classname="org.javacc.parser.Main"
     classpath="${javacc.home}/bin/lib/javacc.jar"
@@ -111,6 +123,29 @@
 
   </target>
 
+  <target name="emma-check">
+	<fail unless="emma.jar.present">	
+      ##################################################################
+      Emma not found.
+      Please make sure emma.jar is in ANT_HOME/lib, or made available
+      to Ant using other mechanisms like -lib or CLASSPATH.
+		
+      You can download emma from 
+      &lt;http://emma.sourceforge.net/&gt;
+      ##################################################################
+    </fail>
+	<fail unless="emma_ant.jar.present">	
+      ##################################################################
+      Emma not found.
+      Please make sure emma_ant.jar is in ANT_HOME/lib, or made available
+      to Ant using other mechanisms like -lib or CLASSPATH.
+		
+      You can download emma from 
+      &lt;http://emma.sourceforge.net/&gt;
+      ##################################################################
+    </fail>
+  </target>
+	
 
   <target name="compile-core" depends="init"
           description="Compiles core classes">
@@ -176,6 +211,8 @@
       <!-- contrib/ant IndexTaskTest needs these two system properties -->
       <sysproperty key="docs.dir" file="src/test"/>
       <sysproperty key="index.dir" file="${build.dir}/test/index"/>
+      <jvmarg value="-Demma.coverage.out.file=${emma.output.dir}/metadata.emma" />
+      <jvmarg value="-Demma.coverage.out.merge=true" />
 
       <formatter type="xml"/>
       <formatter type="brief" usefile="false"/>
@@ -211,7 +248,38 @@
   </target>
 
   <target name="default" depends="jar-core"/>
+	
+  <target name="emma-instrument" depends="emma-check, compile-test" description="Lucene code coverage">
+	<echo message="Instrumenting Code" />
+   <taskdef resource="emma_ant.properties"/>
+	<mkdir dir="${emma.output.dir}"/>
+	<!-- Instrument the .class files. -->
+	<delete file="${emma.output.dir}/metadata.emma" />
+	<emma enabled="true">
+		<instr destdir="${build.dir}/classes/java" metadatafile="${emma.output.dir}/metadata.emma" merge="false" mode="overwrite">
+			<filter excludes="*Test*" />
+			<filter excludes="*test*" />
+			<instrpath>
+				<pathelement location="${build.dir}/classes/java" />
+			</instrpath>
+		</instr>
+	</emma>
+  </target>
 
+  <target name="generate-emma-report" depends ="emma-check" description="Lucene code coverage">
+	<echo message="Generating Code Coverage Reports" />
+   <taskdef resource="emma_ant.properties"/>
+	<emma enabled="true">
+		<report sourcepath="${basedir}/src/java">
+			<fileset dir="${emma.output.dir}">
+				<include name="*.emma" />
+			</fileset>
+			<txt outfile="${emma.output.dir}/coverage.txt" />
+			<html outfile="${emma.output.dir}/index.html" />
+		</report>
+	</emma>
+  </target>
+
   <!--+
       | M A C R O S
       +-->
