All Downloads are FREE. Search and download functionalities are using the official Maven repository.

woodstox.wstx-asl.3.2.9.source-code.build.xml Maven / Gradle / Ivy

There is a newer version: 4.0.6
Show newest version
<?xml version="1.0" standalone='yes'?>

    <project name="Woodstox XML processor" basedir="." default="readme">

    <property name="ProjectName" value="Woodstox XML processor" />

    <!-- Hmmh... Jikes is better at finding semantic problems
      than basic javac (not to mention faster). But is this a personal
      preference?
      Also, don't want to have a dependency to Jikes...
    <property name="build.compiler" value="jikes" />
    -->

    <!-- Source directories -->
    <property name="SrcDir" location="${basedir}/src" />
    <property name="JavaSrcDir" location="${SrcDir}/java" />
    <property name="JavaSamplesDir" location="${SrcDir}/samples" />
    <property name="TestSrcDir" location="${SrcDir}/test" />
    <property name="ResourcesDir" location="${SrcDir}/resources" />
    <property name="RelNotesDir" location="${basedir}/release-notes" />

    <!-- Libs -->
    <property name="LibDir" location="${basedir}/lib" />
    <!-- Build-related -->
    <property name="BuildDir" location="${basedir}/build" />
    <property name="BuildClassesDir" location="${BuildDir}/classes" />
    <property name="EmmaBuildClassesDir" location="${BuildDir}/emma-classes" />
    <!-- Documentation -->
    <property name="DocDir" location="${basedir}/doc" />
    <property name="JavaDocDir" location="${BuildDir}/javadoc" />
    <!-- Test suite -->
    <property name="TestDir" location="${basedir}/test" />
    <property name="TestClassesDir" location="${TestDir}/classes" />
    <property name="TestResultsDir" location="${TestDir}/results" />
    <property name="TestXmlResultsDir" location="${TestResultsDir}/xml" />
    <property name="StaxTestClassesDir" location="${TestDir}/staxtest-classes" />
    <!-- Distribution -->
    <property name="DistDir" location="${basedir}/dist" />

    <!-- Version information -->

    <!-- Woodstox version -->
    <property name="STAX_TITLE" value="StAX 1.0 API" />
    <property name="STAX_VERSION" value="1.0" />
    <property name="STAX_VENDOR" value="http://jcp.org/en/jsr/detail?id=173" />
    <property name="WSTX_TITLE" value="WoodSToX XML-processor" />
    <property name="WSTX_VERSION" value="3.2.9" />
    <property name="WSTX_VENDOR" value="woodstox.codehaus.org" />

    <!-- Extended API, working title "StAX2" (not necessarily version 2.0, but 2/squared)
      -->
    <property name="STAX2_TITLE" value="StAX2 API" />
    <property name="STAX2_VERSION" value="2.1" />
    <property name="STAX2_VENDOR" value="http://www.cowtowncoder.com" />

    <!-- jars needed for compilation -->
    <path id="compile-classpath">
        <fileset dir="${LibDir}" includes="stax-api*.jar" />
        <fileset dir="${LibDir}" includes="sax2.jar" />
        <!-- these are needed for optional MSV-based validators -->
        <fileset dir="${LibDir}/msv" includes="*.jar" />
    </path>
    <path id="junit-libs">
       <fileset dir="${LibDir}">
            <include name="junit/junit*.jar" />
       </fileset>
    </path>

    <!-- Source files to include in source packages (tar, zip) -->
    <patternset id="wstx-dist-src-files">
          <include name="src/java/**/*.java" />
          <include name="src/samples/**/*.java" />
          <include name="src/resources/*" />
          <include name="build.xml" />
          <include name="project.xml" />
    </patternset>

    <patternset id="wstx-dist-misc-files">
          <include name="src/test/**/*.java" />
          <include name="src/test/**/*.xml" />
          <include name="src/test/**/*.dtd" />
          <include name="src/java/**/*.html" />
          <include name="src/maven/*.pom" />
          <include name="release-notes/*" />
          <include name="release-notes/asl/*" />
          <include name="release-notes/lgpl/*" />
          <!-- need jars too; at least the api jar, but let's copy
               all for now... it's nice to have the unit tests in there
               too. This way src packages are proper subsets of binary ones
            -->
          <include name="lib/*.jar" />
          <include name="lib/msv/*.jar" />
    </patternset>

    <!-- Core Woodstox class files common to all license flavours: -->
    <patternset id="wstx-dist-class-files">
        <include name="com/ctc/**/*.class" />
        <include name="META-INF/services/javax.xml.stream.*" />
        <include name="META-INF/services/org.codehaus.stax2.*" />
    </patternset>

    <!-- StAX2 class files common to all license flavours: -->
    <patternset id="stax2-dist-class-files">
        <include name="org/codehaus/stax2/**/*.class" />
    </patternset>

    <!-- 02-Mar-2009, TSa: Let's try automating Maven builds
      -->
    <import file="build-maven-deploy.xml" />

    <!-- And then something nifty, for creating minimal jars! -->

    <classfileset id="j2meInputMinimal" dir="${BuildClassesDir}">
       <root classname="com.ctc.wstx.stax.MinimalInputFactory" />
       <rootfileset dir="${BuildClassesDir}" includes="com/ctc/wstx/compat/Jdk*Impl.class" />
    </classfileset>

    <classfileset id="j2eeInput" dir="${BuildClassesDir}">
       <root classname="com.ctc.wstx.stax.WstxInputFactory" />
       <rootfileset dir="${BuildClassesDir}" includes="com/ctc/wstx/compat/Jdk*Impl.class" />
    </classfileset>

    <classfileset id="j2meOutputMinimal" dir="${BuildClassesDir}">
       <root classname="com.ctc.wstx.stax.MinimalOutputFactory" />
       <rootfileset dir="${BuildClassesDir}" includes="com/ctc/wstx/compat/Jdk*Impl.class" />
    </classfileset>

    <!-- Enabling support for Emma (http://emma.sourceforge.net) code
       - coverage library
      -->
    <property name="emma.dir" value="${LibDir}" />
    <property name="emma.coverage.dir" value="${BuildDir}/coverage" />
    <path id="emma.lib">
      <pathelement location="${emma.dir}/emma.jar" />
      <pathelement location="${emma.dir}/emma_ant.jar" />
    </path>
    <taskdef resource="emma_ant.properties" classpathref="emma.lib" />

    <!--*********************************************************************-->
    <!-- The readme target shows a brief description of all targets          -->
    <!-- supported by this ant build file                                    -->
    <!--*********************************************************************-->
    <target name="readme">
        <echo message = "${ProjectName}'s Available Targets" />
        <echo message = "---------------------------------------------------" />
        <echo message = "1)  readme - Displays this information (default target)." />
        <echo message = "2)  clean - Remove any generated files/directories." />
        <echo message = "3)  compile - Compile all non-test ${ProjectName} code." />
        <echo message = "4)  jars - Compile and create all jars for non-test ${ProjectName} code (see below for specific ones)." />
        <echo message = "4a)  jar.wstx.lgpl - Compile and create jar for non-test ${ProjectName} cod, under LGPL license." />
        <echo message = "4b)  jar.wstx.asp - Compile and create jar for non-test ${ProjectName} cod, under Apache (2.0) license." />
        <echo message = "4b)  jar.j2me - Compile and create minimal non-test jar of ${ProjectName}, that implements J2ME subset of StAX." />
        <echo message = "5)  javadoc - Generate ${ProjectName} code documentation." />
        <echo message = "6)  test.compile - Compile ${ProjectName} code and test code" />
        <echo message = "       for JUnit tests." />
        <echo message = "7a)  test - Run Woodstox-specific JUnit tests." />
        <echo message = "7b)  staxtest - Run generic StAX JUnit tests." />
        <echo message = "8)  dist - Create distribution directory and copy necessary files there" />
        <echo message = "9) all - Run the clean, compile, javadoc," />
        <echo message = "         test and dist targets." />  
        <echo message = "" />
        <echo message = "Available command-line arguments:" />
        <echo message = "---------------------------------" />
        <echo message = "-Dlicense : allowed values 'asl', 'lgpl' (chooses license to use for jars)" />
    </target>

    <target name="prepare">
        <!-- make build directories -->
        <mkdir dir="${BuildDir}" />
        <mkdir dir="${BuildClassesDir}" />
        <mkdir dir="${EmmaBuildClassesDir}" />
        <mkdir dir="${emma.coverage.dir}" />

        <!-- make docs directories -->
        <mkdir dir="${DocDir}" />
        <mkdir dir="${JavaDocDir}" />

        <!-- make test output directories -->
        <mkdir dir="${TestDir}" />
        <mkdir dir="${TestClassesDir}" />
        <mkdir dir="${TestResultsDir}" />
        <mkdir dir="${TestXmlResultsDir}" />

        <!-- and finally distribution dir -->
        <mkdir dir="${DistDir}" />
    </target>

    <!-- ***********************************************
       - supporting dummy tasks
       - ***********************************************-->

    <!-- This task ensures that license is either set to a
       - valid value, or can use the default (ASL)
      -->
    <target name="check_license">
      <!-- Let's set license to default ("asl") if not
           explicitly specified on command-line args
        -->
      <property name="license" value="asl" />
      <!-- And then check that explicitly set one was valid
         - (default one will always be....)
        -->
      <condition property="license_ok">
        <or>
          <equals arg1="${license}" arg2="asl" />
          <equals arg1="${license}" arg2="lgpl" />
        </or>
      </condition>
      <fail unless="license_ok"
        message="Unrecognized license property value '${license}': excepted either 'asl' (for ASL2.0) or 'lgpl' (for LGPL2.1)"
      />
      <echo message="Ok, using license '${license}' for jar(s)." />
    </target>

    <!-- ***********************************************
       - clean - Removes all generated files/directories
       - ***********************************************-->

    <target name="clean">
        <delete dir="${BuildDir}"/>
        <delete dir="${DocDir}"/>
        <delete dir="${TestDir}"/>
        <delete dir="${DistDir}"/>
        <delete file="coverage.ec" />
    </target>

    <target name="compile" depends="prepare,copy-resources">
        <javac SrcDir="${JavaSrcDir}" destdir="${BuildClassesDir}"
            debug="true"
        >
            <include name="org/codehaus/stax2/**/*.java" />
            <include name="com/ctc/**/*.java" />
            <include name="test/**/*.java" />
            <classpath refid="compile-classpath" />
        </javac>
        <!-- 03-Aug-2006, TSa: Let's also compile samples, to ensure they
               won't get obsolete with impl/api changes
          -->
        <javac SrcDir="${JavaSamplesDir}" destdir="${BuildClassesDir}">
            <include name="*.java" />
            <classpath refid="compile-classpath" />
        </javac>
    </target>

    <target name="copy-resources" depends="prepare">
        <mkdir dir="${BuildClassesDir}/META-INF/services" />
        <copy toDir="${BuildClassesDir}/META-INF/services">    		
            <fileset dir="${ResourcesDir}">
                <include name="javax.xml.stream.*" />
                <include name="org.codehaus.stax2.*" />
            </fileset>           	
        </copy>
    </target>

    <!-- Dummy target that just includes all individual jars... --> 
    <target name="jars"
       depends="jar.stax2, jar.wstx.lgpl, jar.wstx.asl, jar.resources"
    />

    <target name="jars.j2me"
       depends="jar.j2me_input_min, jar.j2me_output_min, jar.j2me_both_min"
    />

    <target name="jar.wstx.lgpl" depends="compile,copy-resources">
        <jar jarfile="${BuildDir}/wstx-lgpl-${WSTX_VERSION}.jar" filesonly="true" >
          <manifest>
            <attribute name="Built-By" value="${user.name}"/>
            <attribute name="Specification-Title"   value="${STAX_TITLE}"/>
            <attribute name="Specification-Version" value="${STAX_VERSION}"/>
            <attribute name="Specification-Vendor"  value="${STAX_VENDOR}"/>
            <attribute name="Implementation-Title"   value="${WSTX_TITLE}"/>
            <attribute name="Implementation-Version" value="${WSTX_VERSION}"/>
            <attribute name="Implementation-Vendor"  value="${WSTX_VENDOR}"/>
          </manifest>
          <fileset dir="${BuildClassesDir}">
              <patternset refid="wstx-dist-class-files" />
              <patternset refid="stax2-dist-class-files" />
          </fileset>
          <fileset dir="${RelNotesDir}/lgpl">
            <include name="LICENSE" />
            <include name="NOTICE" />
            <include name="LGPL2.1" />
          </fileset>
        </jar>
    </target> 

    <!-- This jar is only needed for testing purposes, to specify 
       - which StAX implementation to use
      -->
    <target name="jar.resources" depends="compile,copy-resources">
        <jar jarfile="${BuildDir}/wstx-api-${WSTX_VERSION}.jar"
         filesonly="true" >
          <manifest>
            <attribute name="Built-By" value="${user.name}"/>
            <attribute name="Specification-Title"   value="${STAX_TITLE}"/>
            <attribute name="Specification-Version" value="${STAX_VERSION}"/>
            <attribute name="Specification-Vendor"  value="${STAX_VENDOR}"/>
            <attribute name="Implementation-Title"   value="${WSTX_TITLE}"/>
            <attribute name="Implementation-Version" value="${WSTX_VERSION}"/>
            <attribute name="Implementation-Vendor"  value="${WSTX_VENDOR}"/>
          </manifest>
          <fileset dir="${BuildClassesDir}">
              <include name="META-INF/services/javax.xml.stream.*" />
              <include name="META-INF/services/org.codehaus.stax2.*" />
          </fileset>
        </jar>
    </target> 

    <target name="jar.wstx.asl" depends="compile,copy-resources">
        <jar jarfile="${BuildDir}/wstx-asl-${WSTX_VERSION}.jar"
         filesonly="true" >
          <manifest>
            <attribute name="Built-By" value="${user.name}"/>
            <attribute name="Specification-Title"   value="${STAX_TITLE}"/>
            <attribute name="Specification-Version" value="${STAX_VERSION}"/>
            <attribute name="Specification-Vendor"  value="${STAX_VENDOR}"/>
            <attribute name="Implementation-Title"   value="${WSTX_TITLE}"/>
            <attribute name="Implementation-Version" value="${WSTX_VERSION}"/>
            <attribute name="Implementation-Vendor"  value="${WSTX_VENDOR}"/>
          </manifest>
          <fileset dir="${BuildClassesDir}">
              <patternset refid="wstx-dist-class-files" />
              <patternset refid="stax2-dist-class-files" />
          </fileset>
          <fileset dir="${RelNotesDir}/asl">
            <include name="LICENSE" />
            <include name="NOTICE" />
            <include name="ASL2.0" />
          </fileset>
        </jar>
    </target> 

    <target name="jar.stax2" depends="compile">
        <jar jarfile="${BuildDir}/stax2-${STAX2_VERSION}.jar" filesonly="true" >
          <manifest>
            <attribute name="Built-By" value="${user.name}"/>
            <attribute name="Specification-Title"   value="${STAX2_TITLE}"/>
            <attribute name="Specification-Version" value="${STAX2_VERSION}"/>
            <attribute name="Specification-Vendor"  value="${STAX2_VENDOR}"/>
            <attribute name="Implementation-Title"   value="${STAX2_TITLE}"/>
            <attribute name="Implementation-Version" value="${STAX2_VERSION}"/>
            <attribute name="Implementation-Vendor"  value="${STAX2_VENDOR}"/>
          </manifest>
          <fileset dir="${BuildClassesDir}">
             <include name="org/codehaus/stax2/**/*.class" />
          </fileset>
        </jar>
    </target> 

    <!-- J2ME subset basically only includes stream reader/writers,
       - not event based reader/writers.
      --> 
    <!-- !!! 11-Jul-2004: Start using nifty class dependency task Ant
           has, once dependencies are properly minimized to non-essential
           classes.
      -->

    <target name="jar.j2me_input_min" depends="compile,check_license">
        <jar jarfile="${BuildDir}/wstx-j2me-min-input.jar" filesonly="true">
          <fileset refid="j2meInputMinimal" />
          <fileset dir="${RelNotesDir}/lgpl">
            <include name="LICENSE" />
            <include name="NOTICE" />
            <include name="LGPL2.1" />
          </fileset>
        </jar>
    </target> 

    <target name="jar.j2me_output_min" depends="compile,check_license">
        <jar jarfile="${BuildDir}/wstx-j2me-min-output.jar" filesonly="true">
          <fileset refid="j2meOutputMinimal" />
          <fileset dir="${RelNotesDir}/lgpl">
            <include name="LICENSE" />
            <include name="NOTICE" />
            <include name="LGPL2.1" />
          </fileset>
        </jar>
    </target> 

    <target name="jar.j2me_both_min" depends="compile,check_license">
        <jar jarfile="${BuildDir}/wstx-j2me-min-both.jar" filesonly="true">
          <fileset refid="j2meInputMinimal" />
          <fileset refid="j2meOutputMinimal" />
          <fileset dir="${RelNotesDir}/lgpl">
            <include name="LICENSE" />
            <include name="NOTICE" />
            <include name="LGPL2.1" />
          </fileset>
        </jar>
    </target> 

    <target name="javadoc" depends="prepare">
        <!-- Build a dirpath that contains just the "source" tree -->
        <javadoc windowtitle="${ProjectName}"
            destdir="${JavaDocDir}" 
            author="true" 
            version="true">
            <packageset dir="${JavaSrcDir}" defaultexcludes="yes">
                <include name="org/codehaus/stax2/**" />
                <include name="com/ctc/**" />
            </packageset>
            <classpath refid="compile-classpath" />
        </javadoc>
    </target> 
 
    <target name="dist" depends="compile,jars,javadoc"
    >
       <!-- First, let's copy the binary jars to dist -->
       <copy todir="${DistDir}">
          <fileset dir="${BuildDir}" includes="wstx*.jar" />
          <fileset dir="${BuildDir}" includes="stax2*.jar" />
          <fileset dir="${BuildDir}" includes="sax2.jar" />
       </copy>
       <!-- Including MSV jars?
         -->
       <copy todir="${DistDir}">
          <fileset dir="${LibDir}" includes="msv/*.jar" />
       </copy>
       <!-- Then let's create the source distribution tar package
          -->
       <tar basedir="${basedir}" destfile="${DistDir}/wstx-src-${WSTX_VERSION}.tar">
          <patternset refid="wstx-dist-src-files" />
          <patternset refid="wstx-dist-misc-files" />
       </tar>
       <gzip zipfile="${DistDir}/wstx-src-${WSTX_VERSION}.tar.gz" src="${DistDir}/wstx-src-${WSTX_VERSION}.tar" />
       <delete file="${DistDir}/wstx-src-${WSTX_VERSION}.tar" />

       <!-- as well as zip
          -->
       <zip basedir="${basedir}" destfile="${DistDir}/wstx-src-${WSTX_VERSION}.zip">
          <patternset refid="wstx-dist-src-files" />
          <patternset refid="wstx-dist-misc-files" />
       </zip>

       <!-- And create source jars for IDE support -->
       <jar jarfile="${DistDir}/wstx-asl-${WSTX_VERSION}-sources.jar" filesonly="true" >
          <fileset dir="${basedir}">
              <patternset refid="wstx-dist-src-files" />
          </fileset>
       </jar>
       <jar jarfile="${DistDir}/wstx-lgpl-${WSTX_VERSION}-sources.jar" filesonly="true" >
          <fileset dir="${basedir}">
              <patternset refid="wstx-dist-src-files" />
          </fileset>
       </jar>

       <!-- Then copy javadocs -->
       <copy todir="${DistDir}">
         <fileset dir="${JavaDocDir}/.." includes="javadoc/**/*" />
       </copy>
       <!-- Plus, let's also just copy README and compatibility files, in
            addition to being included in source package
         -->
       <copy todir="${DistDir}" >
            <fileset dir="." includes="release-notes/*" />
            <fileset dir="." includes="release-notes/asl/*" />
            <fileset dir="." includes="release-notes/lgpl/*" />
       </copy>
       <!-- And also additional Maven stuff -->
       <copy todir="${DistDir}">
            <fileset dir="${SrcDir}/maven" includes="*.pom" />
            <globmapper from="*.pom" to="*-${WSTX_VERSION}.pom" />
            <filterset>
              <filter token="VERSION" value="${WSTX_VERSION}" />
            </filterset>
       </copy>
    </target>

    <target name="all" depends="clean,javadoc,test,dist">
        <!-- This target simply depends on others to do its job -->
    </target>

    <!--*********************************************************************-->
    <!-- Tasks from here down are in support of junit tests.                 -->
    <!--*********************************************************************-->
    <target name="all-tests" depends="test,staxtest" />

    <!-- Running generic StAX tests -->
    <target name="staxtest" depends="prepare-staxtest">
       <!-- showoutput 'yes' to allow outputting debug msgs... -->
        <junit fork="yes" forkmode="once" maxmemory="128M"
          printsummary="yes" haltonfailure="no" showoutput="yes">
            <batchtest fork="yes" todir="${TestXmlResultsDir}">
                <fileset dir="${StaxTestClassesDir}">
                    <!-- Need to exclude inner classes... -->
                    <exclude name="**/*$*.class"/>
                    <include name="org/codehaus/**/Test*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <classpath refid="compile-classpath" />
            <classpath path="${StaxTestClassesDir}" />
            <classpath>
              <pathelement path="${BuildClassesDir}" />
             <!-- Note: need to add the dummy wstx.jar, since it has properties
                -  to point StAX to use correct implementation classes!
               -->
              <fileset dir="${BuildDir}">
                <include name="wstx-api-*.jar" />
              </fileset> 
              <path refid="junit-libs"/>
           </classpath>  
        </junit>

        <junitreport todir="${TestResultsDir}">
            <fileset dir="${TestXmlResultsDir}">
                <include name="TEST-*.xml" />
            </fileset>
            <report todir="${TestResultsDir}" />
        </junitreport>
    </target>

    <target name="prepare-staxtest" depends="jar.resources">
        <mkdir dir="${StaxTestClassesDir}" />
        <!-- and unpack test classes... unfortunately needed so JUnit
             can find classes (maybe there's a way to refer to a jar too,
             have not found one so far)
          -->
        <unzip dest="${StaxTestClassesDir}" overwrite="false">
           <fileset dir="${LibDir}">
              <include name="staxtest_*.jar" />
           </fileset>
        </unzip>
    </target>

    <!-- Running a single Unit Test -->
    <target name="test.single" depends="test.compile">
         <fail unless="test" message="Must define -Dtest" />
       <!-- showoutput 'yes' to allow outputting debug msgs... -->
        <junit fork="no" maxmemory="128M" showoutput="yes" printsummary="yes">
          <formatter type="plain" usefile="no" />
          <test name="${test}" />
          <classpath>
                <pathelement path="${BuildClassesDir}" />
                <pathelement path="${StaxTestClassesDir}" />
                <pathelement location="${TestClassesDir}" /> 
                <path refid="junit-libs"/>
          </classpath>     
        </junit>
    </target>

    <!-- Compiling and running Woodstox-specific tests
       - (including, for now, StAX2 tests)
      -->

    <target name="test.compile" depends="compile">
        <javac SrcDir="${TestSrcDir}" destdir="${TestClassesDir}"
            debug="true"
        >
            <include name="**/*.java" />
            <classpath refid="compile-classpath" />
            <classpath>
                <pathelement path="${BuildClassesDir}"/>  
                <path refid="junit-libs"/>
            </classpath>
        </javac>
    </target>


    <target name="test" depends="test.compile">
       <!-- showoutput 'yes' to allow outputting debug msgs... -->
        <junit fork="yes" forkmode="once" maxmemory="128M"
         printsummary="yes" haltonfailure="no" showoutput="yes">
            <batchtest fork="yes" todir="${TestXmlResultsDir}">
                <fileset dir="${TestClassesDir}">
                    <!-- Need to exclude inner classes... -->
                    <exclude name="**/*$*.class"/>
                    <include name="**/Test*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <classpath refid="compile-classpath" />
            <classpath>
                <pathelement path="${BuildClassesDir}" />
                <pathelement location="${TestClassesDir}" /> 
                <path refid="junit-libs"/>
            </classpath>     
        </junit>

        <junitreport todir="${TestResultsDir}">
            <fileset dir="${TestXmlResultsDir}">
                <include name="TEST-*.xml" />
            </fileset>
            <report todir="${TestResultsDir}" />
        </junitreport>
    </target>

    <target name="test-emma" depends="test.compile, prepare-staxtest">

      <!-- First, need to instrument using Emma -->
      <property name="emma.instr.dir" value="${BuildDir}/emma-instr" />
      <!-- 20-Dec-2005, TSa: How the hell do I exclude specific sub-dirs
         -    from being instrumented? Ugh. There has to be a way... but
         -    so far nothing has worked to just exclude test.* classes.
         -
         -    Will probably just need to copy the real classes to a temporary
         -    location to make it work
        --> 
      <property name="emma.tmp.dir" value="${BuildDir}/emma-tmp" />
      <mkdir dir="${emma.tmp.dir}" />
      <copy toDir="${emma.tmp.dir}">
        <fileset dir="${BuildClassesDir}">
          <include name="org/codehaus/stax2/**/*.class" />
          <include name="com/ctc/**/*.class" />
        </fileset>           	
      </copy>
      <path id="emma-classpath">
          <pathelement location="${emma.tmp.dir}">
          </pathelement>
      </path>
      <mkdir dir="${emma.instr.dir}" />
      <emma enabled="true"> <!--  verbosity="verbose" -->
        <instr instrpathref="emma-classpath"
             destdir="${EmmaBuildClassesDir}"	
             metadatafile="${emma.coverage.dir}/metadata.emma"
             merge="true"
 mode="fullcopy"
        />
      </emma>
      <!-- Ok, so let's just nuke the stupid test classes...
        -  ... for which there are 2 possible locations...
        -->
      <delete dir="${EmmaBuildClassesDir}/classes/test"/>
      <delete dir="${EmmaBuildClassesDir}/test"/>

      <!-- Then run tests. Note: need to fork for Emma to work...? -->
      <junit fork="yes" printsummary="yes" haltonfailure="no"
         showoutput="yes">
            <batchtest fork="no" todir="${TestXmlResultsDir}">
                <!-- Generic StAX tests -->
                <fileset dir="${StaxTestClassesDir}">
                    <!-- Need to exclude inner classes... -->
                    <exclude name="**/*$*.class"/>
                    <include name="org/codehaus/**/Test*.class"/>
                </fileset>
                <!-- Woodstox-specific tests -->
                <fileset dir="${TestClassesDir}">
                    <exclude name="**/*$*.class"/>
                    <include name="**/Test*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <!-- StAX API: -->
            <classpath refid="compile-classpath" />
            <!-- Actual tests: -->
            <classpath path="${TestClassesDir}" />
            <classpath path="${StaxTestClassesDir}" />
            <!-- Emma jars: -->
            <classpath>
                <pathelement path="${EmmaBuildClassesDir}/classes" />
                <pathelement location="${LibDir}/emma.jar" /> 
                <!-- need resource (service) files so stax(2) knows which
                   - impl to use
                 -->
                <fileset dir="${BuildDir}">
                  <include name="wstx-api-*.jar" />
                </fileset>
                <path refid="junit-libs"/>
            </classpath>     
        </junit>

       <!-- Then Emma coverage reporting... -->

       <emma enabled="true"> <!-- verbosity="verbose" -->
        <report sourcepath="${JavaSrcDir}" >
          <fileset dir="${emma.coverage.dir}" >
            <include name="*.emma" />
          </fileset>
          <fileset dir="${basedir}" >
            <include name="coverage.ec" />
          </fileset>
         <txt outfile="${emma.coverage.dir}/coverage.txt" />
         <html outfile="${emma.coverage.dir}/coverage.html" />
        </report>
       </emma>

        <!-- Don't really need actual JUnit output do we? -->
        <junitreport todir="${TestResultsDir}">
            <fileset dir="${TestXmlResultsDir}">
                <include name="TEST-*.xml" />
            </fileset>
            <report todir="${TestResultsDir}" />
        </junitreport>
        <!--
        -->
    </target>


</project>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy