<commit_before><?xml version="1.0"?>
<!-- Version: $Revision$ $Date$ -->

<project name="tcases" default="none" basedir=".">

  <!-- Root directory -->
  <property name="root.path" value="."/>
  <property name="root.dir" location="${root.path}"/>

  <!-- Global properties -->
  <import file="${root.dir}/global-properties.xml"/>

  <!-- Standard targets -->
  <target name="build" description="Create all distribution packages." depends="compile,javadoc">
    <delete dir="${release.dir}"/>

    <mkdir dir="${release.dir}/lib"/>
    <jar destfile="${release.dir}/lib/tcases.jar" basedir="${class.dir}">
      <include name="**/*.class"/>
    </jar>
    <copy todir="${release.dir}/lib">
      <fileset dir="${lib.dir}">
        <include name="*.jar"/>
      </fileset>
      <fileset dir="${resources.dir}">
        <include name="*.xml"/>
        <include name="*.xsl"/>
      </fileset>
    </copy>

    <mkdir dir="${release.dir}/docs"/>
    <copy todir="${release.dir}/docs">
      <fileset dir="${docs.dir}">
        <include name="*.xsd"/>
      </fileset>
    </copy>
    <mkdir dir="${release.dir}/docs/api"/>
    <copy todir="${release.dir}/docs/api">
      <fileset dir="${javadoc.dir}">
        <include name="**/*"/>
      </fileset>
    </copy>
    <copy todir="${release.dir}/docs">
      <fileset dir="${docs.dir}">
        <include name="examples/**/*"/>
      </fileset>
    </copy>

    <mkdir dir="${release.dir}/bin"/>
    <copy todir="${release.dir}/bin">
      <fileset dir="${bin.dir}">
        <include name="*.sh"/>
      </fileset>
    </copy>

    <zip destfile="${distrib.dir}/${release.tag}.zip">
      <fileset dir="${distrib.dir}">
        <include name="${release.tag}/**/*"/>
      </fileset>
    </zip>

    <tar destfile="${distrib.dir}/${release.tag}.tgz" compression="gzip">
      <fileset dir="${distrib.dir}">
        <include name="${release.tag}/**/*"/>
      </fileset>
    </tar>
  </target>

  <target name="clean" description="Delete all generated files." depends="clean.build, clean.test, clean.javadoc"> 
  </target>

  <target name="compile" description="Compile all source files." depends="init">
    <mkdir dir="${class.dir}"/>
    <javac srcdir="${src.dir}" destdir="${class.dir}"
      debug="${javac.debug}"
      deprecation="${javac.deprecation}"
      includeantruntime="true"
      >
      <classpath refid="javac.classpath"/>
      <compilerarg line="${javac.lint}"/>
    </javac>
  </target>

  <target name="init" description="Setup for building"> 
  </target>

  <target name="rebuild" description="Equivalent to 'clean', followed by 'build'." depends="clean,build"> 
  </target>

  <target name="test" description="Run all unit tests." depends="compile.test">
    <property name="test.failure.property" value="test.failed"/>
    <property name="testclass" value="Test*"/>

    <property name="tcases.log.file" value="${java.io.tmpdir}/tcases.log"/>
    <delete file="${tcases.log.file}"/>

    <mkdir dir="${test.reports.dir}"/>
    <junit 
      haltonfailure="no"
      failureproperty="${test.failure.property}"
      errorproperty="${test.failure.property}"
      printsummary="yes">
      <classpath>
        <path refid="javac.test.classpath"/>
      </classpath>
      <sysproperty key="tcases.log.file" value="${tcases.log.file}"/>
      <formatter type="xml" if="test.continue"/> 
      <formatter type="plain" usefile="no" unless="test.continue"/>
      <batchtest fork="yes" todir="${test.reports.dir}">
        <fileset dir="${test.src.dir}">
          <include name="**/${testclass}.java"/>
        </fileset>
      </batchtest>
    </junit>

    <!-- Record occurrence of any test failure -->
    <if>
      <isset property="${test.failure.property}"/>
      <then>
        <touch file="${test.failed.file}"/>
        <fail unless="test.continue" message="One or more tests failed"/>
      </then>
    </if>
  </target>

  <!-- Other targets -->

  <target name="test.report" description="Run all unit tests and create an HTML report of test results.">
    <delete file="${test.failed.file}"/>
    <delete dir="${test.reports.dir}"/>
    <mkdir dir="${test.reports.dir}"/>

    <antcall target="test">
      <param name="test.continue" value="true"/>
    </antcall>
    
    <junitreport todir="${test.reports.dir}">
      <fileset dir="${test.reports.dir}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${test.reports.dir}/html"/>
    </junitreport>

    <fail message="One or more tests failed">
      <condition>
        <available file="${test.failed.file}"/>
      </condition>
    </fail>
  </target>

  <target name="javadoc" depends="compile">    
    <mkdir dir="${javadoc.dir}"/>
    <javadoc 
      destdir="${javadoc.dir}"
      verbose="off"
      >
      <classpath>
        <path refid="javac.classpath"/>
      </classpath>
      <sourcefiles>
        <fileset dir="${src.dir}" includes="**/*.java"/>
      </sourcefiles>
    </javadoc>
  </target>

  <target name="javadoc.test" depends="compile.test">    
    <mkdir dir="${test.javadoc.dir}"/>
    <javadoc 
      destdir="${test.javadoc.dir}"
      verbose="off"
      >
      <classpath>
        <path refid="javac.test.classpath"/>
      </classpath>
      <sourcefiles>
        <fileset dir="${src.dir}" includes="**/*.java"/>
        <fileset dir="${test.src.dir}" includes="**/*.java"/>
      </sourcefiles><commit_msg>javadoc: Must include Ant runtime libs on classpath.<commit_after><?xml version="1.0"?>
<!-- Version: $Revision$ $Date$ -->

<project name="tcases" default="none" basedir=".">

  <!-- Root directory -->
  <property name="root.path" value="."/>
  <property name="root.dir" location="${root.path}"/>

  <!-- Global properties -->
  <import file="${root.dir}/global-properties.xml"/>

  <!-- Standard targets -->
  <target name="build" description="Create all distribution packages." depends="compile,javadoc">
    <delete dir="${release.dir}"/>

    <mkdir dir="${release.dir}/lib"/>
    <jar destfile="${release.dir}/lib/tcases.jar" basedir="${class.dir}">
      <include name="**/*.class"/>
    </jar>
    <copy todir="${release.dir}/lib">
      <fileset dir="${lib.dir}">
        <include name="*.jar"/>
      </fileset>
      <fileset dir="${resources.dir}">
        <include name="*.xml"/>
        <include name="*.xsl"/>
      </fileset>
    </copy>

    <mkdir dir="${release.dir}/docs"/>
    <copy todir="${release.dir}/docs">
      <fileset dir="${docs.dir}">
        <include name="*.xsd"/>
      </fileset>
    </copy>
    <mkdir dir="${release.dir}/docs/api"/>
    <copy todir="${release.dir}/docs/api">
      <fileset dir="${javadoc.dir}">
        <include name="**/*"/>
      </fileset>
    </copy>
    <copy todir="${release.dir}/docs">
      <fileset dir="${docs.dir}">
        <include name="examples/**/*"/>
      </fileset>
    </copy>

    <mkdir dir="${release.dir}/bin"/>
    <copy todir="${release.dir}/bin">
      <fileset dir="${bin.dir}">
        <include name="*.sh"/>
      </fileset>
    </copy>

    <zip destfile="${distrib.dir}/${release.tag}.zip">
      <fileset dir="${distrib.dir}">
        <include name="${release.tag}/**/*"/>
      </fileset>
    </zip>

    <tar destfile="${distrib.dir}/${release.tag}.tgz" compression="gzip">
      <fileset dir="${distrib.dir}">
        <include name="${release.tag}/**/*"/>
      </fileset>
    </tar>
  </target>

  <target name="clean" description="Delete all generated files." depends="clean.build, clean.test, clean.javadoc"> 
  </target>

  <target name="compile" description="Compile all source files." depends="init">
    <mkdir dir="${class.dir}"/>
    <javac srcdir="${src.dir}" destdir="${class.dir}"
      debug="${javac.debug}"
      deprecation="${javac.deprecation}"
      includeantruntime="true"
      >
      <classpath refid="javac.classpath"/>
      <compilerarg line="${javac.lint}"/>
    </javac>
  </target>

  <target name="init" description="Setup for building"> 
  </target>

  <target name="rebuild" description="Equivalent to 'clean', followed by 'build'." depends="clean,build"> 
  </target>

  <target name="test" description="Run all unit tests." depends="compile.test">
    <property name="test.failure.property" value="test.failed"/>
    <property name="testclass" value="Test*"/>

    <property name="tcases.log.file" value="${java.io.tmpdir}/tcases.log"/>
    <delete file="${tcases.log.file}"/>

    <mkdir dir="${test.reports.dir}"/>
    <junit 
      haltonfailure="no"
      failureproperty="${test.failure.property}"
      errorproperty="${test.failure.property}"
      printsummary="yes">
      <classpath>
        <path refid="javac.test.classpath"/>
      </classpath>
      <sysproperty key="tcases.log.file" value="${tcases.log.file}"/>
      <formatter type="xml" if="test.continue"/> 
      <formatter type="plain" usefile="no" unless="test.continue"/>
      <batchtest fork="yes" todir="${test.reports.dir}">
        <fileset dir="${test.src.dir}">
          <include name="**/${testclass}.java"/>
        </fileset>
      </batchtest>
    </junit>

    <!-- Record occurrence of any test failure -->
    <if>
      <isset property="${test.failure.property}"/>
      <then>
        <touch file="${test.failed.file}"/>
        <fail unless="test.continue" message="One or more tests failed"/>
      </then>
    </if>
  </target>

  <!-- Other targets -->

  <target name="test.report" description="Run all unit tests and create an HTML report of test results.">
    <delete file="${test.failed.file}"/>
    <delete dir="${test.reports.dir}"/>
    <mkdir dir="${test.reports.dir}"/>

    <antcall target="test">
      <param name="test.continue" value="true"/>
    </antcall>
    
    <junitreport todir="${test.reports.dir}">
      <fileset dir="${test.reports.dir}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${test.reports.dir}/html"/>
    </junitreport>

    <fail message="One or more tests failed">
      <condition>
        <available file="${test.failed.file}"/>
      </condition>
    </fail>
  </target>

  <target name="javadoc" depends="compile">    
    <mkdir dir="${javadoc.dir}"/>
    <javadoc 
      destdir="${javadoc.dir}"
      verbose="off"
      >
      <classpath>
        <path refid="javac.classpath"/>
        <fileset dir="${integration.ant.lib}">
          <include name="*.jar"/>
        </fileset>
      </classpath>
      <sourcefiles>
        <fileset dir="${src.dir}" includes="**/*.java"/>
      </sourcefiles>
    </javadoc>
  </target>

  <target name="javadoc.test" depends="compile.test">    
    <mkdir dir="${test.javadoc.dir}"/>
    <javadoc 
      destdir="${test.javadoc.dir}"
      verbose="off"
      >
      <classpath>
        <path refid="javac.test.classpath"/>
      </classpath>
      <sourcefiles>
        <fileset dir="${src.dir}" includes="**/*.java"/>
        <fileset dir="${test.src.dir}" includes="**/*.java"/>
      </sourcefiles>
{'fraction_non_alphanumeric': 0.21585421412300684, 'fraction_numerical': 0.00036446469248291574, 'mean_word_length': 2.831064572425829, 'pattern_counts': {'":': 0, '<': 286, '<?xml version=': 2, '>': 286, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7601598', 'n_tokens_mistral': 3528, 'n_tokens_neox': 3389, 'n_words': 649}