<commit_before><project name="hamcrest" default="all">

    <property name="version" value="SNAPSHOT" description="Version number to use in build files"/>
    <property name="haltonfailure" value="true" description="Whether to halt the build if the tests fail"/>
    <property name="debug" value="true" description="Whether to build with debug information"/>
    <property name="javaversion" value="1.5" description="Java version to target"/>
    <tstamp><format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss" timezone="GMT"/></tstamp>

    <target name="all" depends="clean, bigjar" description="Performs clean build, runs tests and packages for distribution"/>

    <target name="clean" description="Clean up all built files">
        <delete dir="build"/>
    </target>

    <target name="api" description="Build Hamcrest APIs">
        <path id="cp-hamcrest-api-main" path=""/>
        <path id="cp-hamcrest-api-test" path=""/>
        <compile-module modulename="hamcrest-api"/>
        <jar-module modulename="hamcrest-api"/>
        <test-module modulename="hamcrest-api"/>
    </target>

    <target name="generator" depends="api" description="Build code generator tool">
        <path id="cp-hamcrest-generator-main" path="lib/generator/qdox-1.12.jar;build/hamcrest-api-${version}.jar"/>
        <path id="cp-hamcrest-generator-test" path=""/>
        <compile-module modulename="hamcrest-generator"/>
        <jar-module modulename="hamcrest-generator"/>
        <test-module modulename="hamcrest-generator"/>

        <!-- Include QDox classes in hamcrest-generator.jar using JarJar to place classes under a different package -->
        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/generator/jarjar-1.3.jar"/>
        <copy file="build/hamcrest-generator-${version}.jar" tofile="build/hamcrest-generator-${version}-nodep.jar"/>
        <jarjar jarfile="build/hamcrest-generator-${version}.jar">
            <zipfileset src="build/hamcrest-generator-${version}-nodep.jar"/>
            <zipfileset src="lib/generator/qdox-1.12.jar"/>
            <rule pattern="com.thoughtworks.qdox.**" result="org.hamcrest.generator.qdox.@1"/>
        </jarjar>
    </target>

    <target name="core" depends="generator" description="Build core Hamcrest library">
        <path id="cp-hamcrest-core-main" path="build/hamcrest-api-${version}.jar"/>
        <path id="cp-hamcrest-core-test" path=""/>
        <compile-module modulename="hamcrest-core"/>
        <generate-module-factory modulename="hamcrest-core" configurationfile="core-matchers.xml" targetclass="org.hamcrest.CoreMatchers"/>
        <jar-module modulename="hamcrest-core"/>
        <test-module modulename="hamcrest-core"/>
    </target>

    <target name="library" depends="core" description="Build library of matchers">
        <path id="cp-hamcrest-library-main" path="build/hamcrest-api-${version}.jar;build/hamcrest-core-${version}.jar"/>
        <path id="cp-hamcrest-library-test" path="build/hamcrest-core-${version}-tests.jar"/>
        <compile-module modulename="hamcrest-library"/>
        <generate-module-factory modulename="hamcrest-library" configurationfile="matchers.xml" targetclass="org.hamcrest.Matchers"/>
        <jar-module modulename="hamcrest-library"/>
        <test-module modulename="hamcrest-library"/>
    </target>

    <target name="integration" depends="library" description="Build integration with external tools">
        <path id="cp-hamcrest-integration-main">
            <fileset file="build/hamcrest-api-${version}.jar"/>
            <fileset file="build/hamcrest-core-${version}.jar"/>
            <fileset file="build/hamcrest-library-${version}.jar"/>
            <fileset dir="lib/integration" includes="**/*.jar"/>
        </path>
        <path id="cp-hamcrest-integration-test" path="build/hamcrest-core-${version}-tests.jar"/>
        <compile-module modulename="hamcrest-integration"/>
        <jar-module modulename="hamcrest-integration"/>
        <test-module modulename="hamcrest-integration"/>
    </target>

    <target name="examples" depends="core, library, integration" description="Build and run unit tests.">
        <path id="cp-hamcrest-examples-main">
            <fileset file="build/hamcrest-api-${version}.jar"/>
            <fileset file="build/hamcrest-core-${version}.jar"/>
            <fileset file="build/hamcrest-library-${version}.jar"/>
            <fileset file="build/hamcrest-integration-${version}.jar"/>
            <fileset dir="lib/integration" includes="**/*.jar"/>
        </path>
        <compile-module modulename="hamcrest-examples"/>
        <jar-module modulename="hamcrest-examples"/>
    </target>

    <target name="bigjar" depends="core,library,integration,generator" description="Build composite jars">
        <!-- Bundle api into core jar -->
        <copy todir="build/temp/hamcrest-core-${version}.jar.contents">
            <fileset dir="build/temp/hamcrest-api-${version}.jar.contents"/>
        </copy>
        <copy todir="build/temp/hamcrest-core-${version}-sources.jar.contents">
            <fileset dir="build/temp/hamcrest-api-${version}-sources.jar.contents"/>
        </copy>
        <jar-module modulename="hamcrest-core"/>

        <!-- Bundle core, library, integration, and generator into all jar-->
        <copy todir="build/temp/hamcrest-all-${version}.jar.contents">
            <fileset dir="build/temp/hamcrest-core-${version}.jar.contents"/>
            <fileset dir="build/temp/hamcrest-library-${version}.jar.contents"/>
            <fileset dir="build/temp/hamcrest-integration-${version}.jar.contents"/>
            <fileset dir="build/temp/hamcrest-generator-${version}.jar.contents"/>
        </copy>
        <copy todir="build/temp/hamcrest-all-${version}-sources.jar.contents">
            <fileset dir="build/temp/hamcrest-core-${version}-sources.jar.contents"/>
            <fileset dir="build/temp/hamcrest-library-${version}-sources.jar.contents"/>
            <fileset dir="build/temp/hamcrest-integration-${version}-sources.jar.contents"/>
            <fileset dir="build/temp/hamcrest-generator-${version}-sources.jar.contents"/>
        </copy>
        <path id="cp-hamcrest-all-main">
            <path refid="cp-hamcrest-core-main"/>
            <path refid="cp-hamcrest-library-main"/>
            <path refid="cp-hamcrest-integration-main"/>
            <path refid="cp-hamcrest-generator-main"/>
        </path>
        <jar-module modulename="hamcrest-all"/>
    </target>

    <target name="javadoc" depends="bigjar" description="build javadoc jars">
        <javadoc-module modulename="hamcrest-generator"/>
        <javadoc-module modulename="hamcrest-core"/>
        <javadoc-module modulename="hamcrest-library"/>
        <javadoc-module modulename="hamcrest-integration"/>
        <javadoc-module modulename="hamcrest-all"/>
    </target>

    <target name="bundle" description="Create a release bundle for deployment to maven central" depends="clean, javadoc">
        <copy todir="build">
            <fileset dir="pom" includes="*.pom"/>
            <filterset><filter token="VERSION" value="${version}"/></filterset>
            <mapper type="regexp" from="(.*)\.pom" to="\1-${version}.pom"/>
        </copy>

        <sign target="hamcrest-parent-${version}.pom"/>
        <jar-bundle modulename="hamcrest-parent"/>

        <bundle-module modulename="hamcrest-core"/>
        <bundle-module modulename="hamcrest-generator"/>
        <bundle-module modulename="hamcrest-library"/>
        <bundle-module modulename="hamcrest-integration"/>
        <bundle-module modulename="hamcrest-all"/>
    </target>

    <macrodef name="make-manifest">
        <attribute name="modulename" description="Name of the module"/>
        <sequential>
            <mkdir dir="build/temp/@{modulename}-${version}.jar.manifest"/>
            <manifest file="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF">
               <attribute name="Implementation-Title" value="@{modulename}"/>
               <attribute name="Implementation-Vendor" value="hamcrest.org"/>
               <attribute name="Implementation-Version" value="${version}"/>
               <attribute name="Built-By" value="${user.name}"/>
               <attribute name="Built-Date" value="${build.timestamp}"/>
           </manifest>
        </sequential>
    </macrodef>

    <macrodef name="compile-module">
        <attribute name="modulename" description="Name of the module to jar"/>
        <sequential>
            <compile-content srcdir="@{modulename}/src/main/java" jarname="@{modulename}-${version}" classpathref="cp-@{modulename}-main" />
            <path id="cp-@{modulename}-test-complete">
                <path path="lib/integration/junit-dep-4.10.jar"/>
                <path refid="cp-@{modulename}-main"/>
                <path refid="cp-@{modulename}-test"/>
                <path path="build/temp/@{modulename}-${version}.jar.contents"/>
            </path>
            <compile-content srcdir="@{modulename}/src/test/java" jarname="@{modulename}-${version}-tests" classpathref="cp-@{modulename}-test-complete" />
        </sequential>
    </macrodef>

    <macrodef name="compile-content">
        <attribute name="srcdir"/>
        <attribute name="jarname" description="Name of the jar whose content is being compiled (without .jar suffix)"/>
        <attribute name="classpathref"/>
        <sequential>
            <mkdir dir="build/temp/@{jarname}-sources.jar.contents"/>
            <copy todir="build/temp/@{jarname}-sources.jar.contents">
                <fileset dir="@{srcdir}"/>
            </copy>
            <mkdir dir="build/temp/@{jarname}.jar.contents"/>
            <javac srcdir="build/temp/@{jarname}-sources.jar.contents"
                   destdir="build/temp/@{jarname}.jar.contents"
                   debug="${debug}" source="${javaversion}" target="${javaversion}" includeantruntime="false">
                <classpath refid="@{classpathref}"/><commit_msg>dont fail when copying non-existant src folder, as this prevents examples building<commit_after><project name="hamcrest" default="all">

    <property name="version" value="SNAPSHOT" description="Version number to use in build files"/>
    <property name="haltonfailure" value="true" description="Whether to halt the build if the tests fail"/>
    <property name="debug" value="true" description="Whether to build with debug information"/>
    <property name="javaversion" value="1.5" description="Java version to target"/>
    <tstamp><format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss" timezone="GMT"/></tstamp>

    <target name="all" depends="clean, bigjar" description="Performs clean build, runs tests and packages for distribution"/>

    <target name="clean" description="Clean up all built files">
        <delete dir="build"/>
    </target>

    <target name="api" description="Build Hamcrest APIs">
        <path id="cp-hamcrest-api-main" path=""/>
        <path id="cp-hamcrest-api-test" path=""/>
        <compile-module modulename="hamcrest-api"/>
        <jar-module modulename="hamcrest-api"/>
        <test-module modulename="hamcrest-api"/>
    </target>

    <target name="generator" depends="api" description="Build code generator tool">
        <path id="cp-hamcrest-generator-main" path="lib/generator/qdox-1.12.jar;build/hamcrest-api-${version}.jar"/>
        <path id="cp-hamcrest-generator-test" path=""/>
        <compile-module modulename="hamcrest-generator"/>
        <jar-module modulename="hamcrest-generator"/>
        <test-module modulename="hamcrest-generator"/>

        <!-- Include QDox classes in hamcrest-generator.jar using JarJar to place classes under a different package -->
        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/generator/jarjar-1.3.jar"/>
        <copy file="build/hamcrest-generator-${version}.jar" tofile="build/hamcrest-generator-${version}-nodep.jar"/>
        <jarjar jarfile="build/hamcrest-generator-${version}.jar">
            <zipfileset src="build/hamcrest-generator-${version}-nodep.jar"/>
            <zipfileset src="lib/generator/qdox-1.12.jar"/>
            <rule pattern="com.thoughtworks.qdox.**" result="org.hamcrest.generator.qdox.@1"/>
        </jarjar>
    </target>

    <target name="core" depends="generator" description="Build core Hamcrest library">
        <path id="cp-hamcrest-core-main" path="build/hamcrest-api-${version}.jar"/>
        <path id="cp-hamcrest-core-test" path=""/>
        <compile-module modulename="hamcrest-core"/>
        <generate-module-factory modulename="hamcrest-core" configurationfile="core-matchers.xml" targetclass="org.hamcrest.CoreMatchers"/>
        <jar-module modulename="hamcrest-core"/>
        <test-module modulename="hamcrest-core"/>
    </target>

    <target name="library" depends="core" description="Build library of matchers">
        <path id="cp-hamcrest-library-main" path="build/hamcrest-api-${version}.jar;build/hamcrest-core-${version}.jar"/>
        <path id="cp-hamcrest-library-test" path="build/hamcrest-core-${version}-tests.jar"/>
        <compile-module modulename="hamcrest-library"/>
        <generate-module-factory modulename="hamcrest-library" configurationfile="matchers.xml" targetclass="org.hamcrest.Matchers"/>
        <jar-module modulename="hamcrest-library"/>
        <test-module modulename="hamcrest-library"/>
    </target>

    <target name="integration" depends="library" description="Build integration with external tools">
        <path id="cp-hamcrest-integration-main">
            <fileset file="build/hamcrest-api-${version}.jar"/>
            <fileset file="build/hamcrest-core-${version}.jar"/>
            <fileset file="build/hamcrest-library-${version}.jar"/>
            <fileset dir="lib/integration" includes="**/*.jar"/>
        </path>
        <path id="cp-hamcrest-integration-test" path="build/hamcrest-core-${version}-tests.jar"/>
        <compile-module modulename="hamcrest-integration"/>
        <jar-module modulename="hamcrest-integration"/>
        <test-module modulename="hamcrest-integration"/>
    </target>

    <target name="examples" depends="core, library, integration" description="Build and run unit tests.">
        <path id="cp-hamcrest-examples-main">
            <fileset file="build/hamcrest-api-${version}.jar"/>
            <fileset file="build/hamcrest-core-${version}.jar"/>
            <fileset file="build/hamcrest-library-${version}.jar"/>
            <fileset file="build/hamcrest-integration-${version}.jar"/>
            <fileset dir="lib/integration" includes="**/*.jar"/>
        </path>
        <compile-module modulename="hamcrest-examples"/>
        <jar-module modulename="hamcrest-examples"/>
    </target>

    <target name="bigjar" depends="core,library,integration,generator" description="Build composite jars">
        <!-- Bundle api into core jar -->
        <copy todir="build/temp/hamcrest-core-${version}.jar.contents">
            <fileset dir="build/temp/hamcrest-api-${version}.jar.contents"/>
        </copy>
        <copy todir="build/temp/hamcrest-core-${version}-sources.jar.contents">
            <fileset dir="build/temp/hamcrest-api-${version}-sources.jar.contents"/>
        </copy>
        <jar-module modulename="hamcrest-core"/>

        <!-- Bundle core, library, integration, and generator into all jar-->
        <copy todir="build/temp/hamcrest-all-${version}.jar.contents">
            <fileset dir="build/temp/hamcrest-core-${version}.jar.contents"/>
            <fileset dir="build/temp/hamcrest-library-${version}.jar.contents"/>
            <fileset dir="build/temp/hamcrest-integration-${version}.jar.contents"/>
            <fileset dir="build/temp/hamcrest-generator-${version}.jar.contents"/>
        </copy>
        <copy todir="build/temp/hamcrest-all-${version}-sources.jar.contents">
            <fileset dir="build/temp/hamcrest-core-${version}-sources.jar.contents"/>
            <fileset dir="build/temp/hamcrest-library-${version}-sources.jar.contents"/>
            <fileset dir="build/temp/hamcrest-integration-${version}-sources.jar.contents"/>
            <fileset dir="build/temp/hamcrest-generator-${version}-sources.jar.contents"/>
        </copy>
        <path id="cp-hamcrest-all-main">
            <path refid="cp-hamcrest-core-main"/>
            <path refid="cp-hamcrest-library-main"/>
            <path refid="cp-hamcrest-integration-main"/>
            <path refid="cp-hamcrest-generator-main"/>
        </path>
        <jar-module modulename="hamcrest-all"/>
    </target>

    <target name="javadoc" depends="bigjar" description="build javadoc jars">
        <javadoc-module modulename="hamcrest-generator"/>
        <javadoc-module modulename="hamcrest-core"/>
        <javadoc-module modulename="hamcrest-library"/>
        <javadoc-module modulename="hamcrest-integration"/>
        <javadoc-module modulename="hamcrest-all"/>
    </target>

    <target name="bundle" description="Create a release bundle for deployment to maven central" depends="clean, javadoc">
        <copy todir="build">
            <fileset dir="pom" includes="*.pom"/>
            <filterset><filter token="VERSION" value="${version}"/></filterset>
            <mapper type="regexp" from="(.*)\.pom" to="\1-${version}.pom"/>
        </copy>

        <sign target="hamcrest-parent-${version}.pom"/>
        <jar-bundle modulename="hamcrest-parent"/>

        <bundle-module modulename="hamcrest-core"/>
        <bundle-module modulename="hamcrest-generator"/>
        <bundle-module modulename="hamcrest-library"/>
        <bundle-module modulename="hamcrest-integration"/>
        <bundle-module modulename="hamcrest-all"/>
    </target>

    <macrodef name="make-manifest">
        <attribute name="modulename" description="Name of the module"/>
        <sequential>
            <mkdir dir="build/temp/@{modulename}-${version}.jar.manifest"/>
            <manifest file="build/temp/@{modulename}-${version}.jar.manifest/MANIFEST.MF">
               <attribute name="Implementation-Title" value="@{modulename}"/>
               <attribute name="Implementation-Vendor" value="hamcrest.org"/>
               <attribute name="Implementation-Version" value="${version}"/>
               <attribute name="Built-By" value="${user.name}"/>
               <attribute name="Built-Date" value="${build.timestamp}"/>
           </manifest>
        </sequential>
    </macrodef>

    <macrodef name="compile-module">
        <attribute name="modulename" description="Name of the module to jar"/>
        <sequential>
            <compile-content srcdir="@{modulename}/src/main/java" jarname="@{modulename}-${version}" classpathref="cp-@{modulename}-main" />
            <path id="cp-@{modulename}-test-complete">
                <path path="lib/integration/junit-dep-4.10.jar"/>
                <path refid="cp-@{modulename}-main"/>
                <path refid="cp-@{modulename}-test"/>
                <path path="build/temp/@{modulename}-${version}.jar.contents"/>
            </path>
            <compile-content srcdir="@{modulename}/src/test/java" jarname="@{modulename}-${version}-tests" classpathref="cp-@{modulename}-test-complete" />
        </sequential>
    </macrodef>

    <macrodef name="compile-content">
        <attribute name="srcdir"/>
        <attribute name="jarname" description="Name of the jar whose content is being compiled (without .jar suffix)"/>
        <attribute name="classpathref"/>
        <sequential>
            <mkdir dir="build/temp/@{jarname}-sources.jar.contents"/>
            <copy failonerror="false" todir="build/temp/@{jarname}-sources.jar.contents">
                <fileset dir="@{srcdir}"/>
            </copy>
            <mkdir dir="build/temp/@{jarname}.jar.contents"/>
            <javac srcdir="build/temp/@{jarname}-sources.jar.contents"
                   destdir="build/temp/@{jarname}.jar.contents"
                   debug="${debug}" source="${javaversion}" target="${javaversion}" includeantruntime="false">
                <classpath refid="@{classpathref}"/>
{'fraction_non_alphanumeric': 0.16993301910195982, 'fraction_numerical': 0.0014884644008930786, 'mean_word_length': 3.0457647531112, 'pattern_counts': {'":': 0, '<': 331, '<?xml version=': 0, '>': 331, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3450576', 'n_tokens_mistral': 6066, 'n_tokens_neox': 5834, 'n_words': 957}