<commit_before><project name="grails-unit-test">

    <target name="test-with-coverage"
            depends="build-test, instrument-for-coverage, run-test, coverage-report"
            description="Compile and Run the unit tests while measuring coverage"/>
    <target name="test"
            depends="clean-instrumented, run-test"
            description="Compile and Run the unit tests plainly"/>

    <taskdef resource="tasks.properties">
        <classpath>
	      <pathelement path="${grails.build}/core"/>			      
	      <pathelement path="${grails.build}/web"/>			      
	      <pathelement path="${grails.build}/gorm"/>			      						
	      <pathelement path="${grails.build}/crud"/>			      									
            <fileset dir="cruise/coverage/lib" includes="*.jar"/>
        </classpath>
	    <classpath refid="classpath"/>
    </taskdef>
    <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
    	 <classpath refid="classpath"/>
    </taskdef>


    <property name="coverage.build" value="cruise/coverage/build/instrumented-classes"/>
    <property name="coverage.report" value="cruise/coverage/report"/>

    <target name="clean-instrumented">
        <delete quiet="true" dir="${coverage.build}"/>
        <mkdir dir="${coverage.build}"/>
    </target>

    <target name="instrument-for-coverage" depends="clean-instrumented">
        <delete file="cobertura.ser" quiet="true"/>
        <cobertura-instrument todir="${coverage.build}">
            <fileset dir="${grails.build}"      includes="**/*.class" />
            <fileset dir="${grails.test.build}" includes="**/*.class" />
        </cobertura-instrument>
    </target>

    <target name="coverage-report">
        <delete quiet="true"><fileset dir="${coverage.report}"/></delete>
        <mkdir dir="${coverage.report}"/>
        <cobertura-report format="html" destdir="cruise/coverage/report" >
            <fileset dir="${grails.src.commons}"/>
            <fileset dir="${grails.src.web}"/>
            <fileset dir="${grails.src.persistence}"/>
            <fileset dir="${grails.src.scaffolding}"/>
            <fileset dir="${grails.test.src.commons}"/>
            <fileset dir="${grails.test.src.web}"/>
            <fileset dir="${grails.test.src.persistence}"/>
            <fileset dir="${grails.test.src.scaffolding}"/>
        </cobertura-report>
    </target>

    <target name="build-test" depends="build">
		<javac debug="on" deprecation="on" destdir="${grails.test.build}" source="1.3" target="1.3" includes="**/*">
			<src path="${grails.test.src.commons}"/>
			<src path="${grails.test.src.web}"/>
			<src path="${grails.test.src.persistence}"/>
			<src path="${grails.test.src.scaffolding}"/>
			<classpath refid="classpath"/>
	        <classpath>
		      <pathelement path="${grails.build}/core"/>			      
		      <pathelement path="${grails.build}/web"/>			      
		      <pathelement path="${grails.build}/gorm"/>			      						
		      <pathelement path="${grails.build}/crud"/>			      									
			</classpath>
		</javac>
		<groovyc srcdir="test/groovy" destdir="${grails.test.build}">    	
			<classpath refid="classpath"/>  
			<classpath location="${grails.test.build}" />
			<classpath location="${grails.build}"/>			
	        <classpath>
		      <pathelement path="${grails.build}/core"/>			      
		      <pathelement path="${grails.build}/web"/>			      
		      <pathelement path="${grails.build}/gorm"/>			      						
		      <pathelement path="${grails.build}/crud"/>			      									
			</classpath>
		</groovyc>
	</target>

	<target name="run-test" depends="build-test" >
        <delete dir="${grails.test.reports}"/>
        <mkdir dir="${grails.test.reports}"/>
        <junit fork="true" forkmode="once">                           <!-- only fork VMs as needed -->  
			<jvmarg value="-Xmx256M"/>
			<classpath location="${coverage.build}"/>                 <!-- must be first in cp!    -->
			<classpath location="cruise/coverage/lib/cobertura.jar"/> <!-- only neede for coverage -->
            <classpath refid="classpath"/>
	        <classpath>
		      <pathelement path="${grails.build}/core"/>			      
		      <pathelement path="${grails.build}/web"/>			      
		      <pathelement path="${grails.build}/gorm"/>			      						
		      <pathelement path="${grails.build}/crud"/>			      									
			</classpath>
			<classpath location="${grails.test.build}"/>
			<classpath location="${grails.test.src.web}"/>
			<classpath location="${grails.test.src.commons}"/>
			<classpath location="${grails.test.src.persistence}"/>
			<classpath location="${grails.test.src.scaffolding}"/>
			<classpath location="${grails.test.src.groovy}"/>			

			<formatter type="xml" />
			<batchtest todir="${grails.test.reports}" failureproperty="grails.test.failure">
				<fileset dir="${grails.test.build}" includes="**/*Tests.class"
                         excludes="**/Abstract*, **/ControllerScaffoldingTests.*,
                         **/GrailsHibernateConfigurationTests*,
                         **/ClassReloadingTests*"/>
			</batchtest>
            <!-- GrailsHibernateConfigurationTests needs it's own VM -->
            <test todir="${grails.test.reports}" name="org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateConfigurationTests" fork="true"/>
            <test todir="${grails.test.reports}" name="org.codehaus.groovy.grails.commons.ClassReloadingTests" fork="true"/>

        </junit>
        <fail if="grails.test.failure">The tests failed. Have a look at ${grails.test.reports}</fail>
    </target>

	<target name="test-report" depends="test" description="Runs unit tests and generates HTML report">
		<mkdir dir="${grails.test.html.reports}"/>
        <junitreport todir="${grails.test.html.reports}">
			<fileset dir="${grails.test.reports}">
				<include name="TEST-*.xml"/>
			</fileset>
			<report format="frames" todir="${grails.test.html.reports}"/>
		</junitreport>
	</target>
</project><commit_msg>reorganize test failure logic so reports are generated even if unit tests fail<commit_after><project name="grails-unit-test">

    <target name="test-with-coverage"
            depends="build-test, instrument-for-coverage, run-test, coverage-report"
            description="Compile and Run the unit tests while measuring coverage">
	    <fail if="grails.test.failure">The tests failed. Have a look at ${grails.test.reports}</fail>
	</target>
    <target name="test"
            depends="clean-instrumented, run-test"
            description="Compile and Run the unit tests plainly">
    	<fail if="grails.test.failure">The tests failed. Have a look at ${grails.test.reports}</fail>
	</target>

    <taskdef resource="tasks.properties">
        <classpath>
	      <pathelement path="${grails.build}/core"/>			      
	      <pathelement path="${grails.build}/web"/>			      
	      <pathelement path="${grails.build}/gorm"/>			      						
	      <pathelement path="${grails.build}/crud"/>			      									
            <fileset dir="cruise/coverage/lib" includes="*.jar"/>
        </classpath>
	    <classpath refid="classpath"/>
    </taskdef>
    <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
    	 <classpath refid="classpath"/>
    </taskdef>


    <property name="coverage.build" value="cruise/coverage/build/instrumented-classes"/>
    <property name="coverage.report" value="cruise/coverage/report"/>

    <target name="clean-instrumented">
        <delete quiet="true" dir="${coverage.build}"/>
        <mkdir dir="${coverage.build}"/>
    </target>

    <target name="instrument-for-coverage" depends="clean-instrumented">
        <delete file="cobertura.ser" quiet="true"/>
        <cobertura-instrument todir="${coverage.build}">
            <fileset dir="${grails.build}"      includes="**/*.class" />
            <fileset dir="${grails.test.build}" includes="**/*.class" />
        </cobertura-instrument>
    </target>

    <target name="coverage-report">
        <delete quiet="true"><fileset dir="${coverage.report}"/></delete>
        <mkdir dir="${coverage.report}"/>
        <cobertura-report format="html" destdir="cruise/coverage/report" >
            <fileset dir="${grails.src.commons}"/>
            <fileset dir="${grails.src.web}"/>
            <fileset dir="${grails.src.persistence}"/>
            <fileset dir="${grails.src.scaffolding}"/>
            <fileset dir="${grails.test.src.commons}"/>
            <fileset dir="${grails.test.src.web}"/>
            <fileset dir="${grails.test.src.persistence}"/>
            <fileset dir="${grails.test.src.scaffolding}"/>
        </cobertura-report>
    </target>

    <target name="build-test" depends="build">
		<javac debug="on" deprecation="on" destdir="${grails.test.build}" source="1.3" target="1.3" includes="**/*">
			<src path="${grails.test.src.commons}"/>
			<src path="${grails.test.src.web}"/>
			<src path="${grails.test.src.persistence}"/>
			<src path="${grails.test.src.scaffolding}"/>
			<classpath refid="classpath"/>
	        <classpath>
		      <pathelement path="${grails.build}/core"/>			      
		      <pathelement path="${grails.build}/web"/>			      
		      <pathelement path="${grails.build}/gorm"/>			      						
		      <pathelement path="${grails.build}/crud"/>			      									
			</classpath>
		</javac>
		<groovyc srcdir="test/groovy" destdir="${grails.test.build}">    	
			<classpath refid="classpath"/>  
			<classpath location="${grails.test.build}" />
			<classpath location="${grails.build}"/>			
	        <classpath>
		      <pathelement path="${grails.build}/core"/>			      
		      <pathelement path="${grails.build}/web"/>			      
		      <pathelement path="${grails.build}/gorm"/>			      						
		      <pathelement path="${grails.build}/crud"/>			      									
			</classpath>
		</groovyc>
	</target>

	<target name="run-test" depends="build-test" >
        <delete dir="${grails.test.reports}"/>
        <mkdir dir="${grails.test.reports}"/>
        <junit fork="true" forkmode="once">                           <!-- only fork VMs as needed -->  
			<jvmarg value="-Xmx256M"/>
			<classpath location="${coverage.build}"/>                 <!-- must be first in cp!    -->
			<classpath location="cruise/coverage/lib/cobertura.jar"/> <!-- only neede for coverage -->
            <classpath refid="classpath"/>
	        <classpath>
		      <pathelement path="${grails.build}/core"/>			      
		      <pathelement path="${grails.build}/web"/>			      
		      <pathelement path="${grails.build}/gorm"/>			      						
		      <pathelement path="${grails.build}/crud"/>			      									
			</classpath>
			<classpath location="${grails.test.build}"/>
			<classpath location="${grails.test.src.web}"/>
			<classpath location="${grails.test.src.commons}"/>
			<classpath location="${grails.test.src.persistence}"/>
			<classpath location="${grails.test.src.scaffolding}"/>
			<classpath location="${grails.test.src.groovy}"/>			

			<formatter type="xml" />
			<batchtest todir="${grails.test.reports}" failureproperty="grails.test.failure">
				<fileset dir="${grails.test.build}" includes="**/*Tests.class"
                         excludes="**/Abstract*, **/ControllerScaffoldingTests.*,
                         **/GrailsHibernateConfigurationTests*,
                         **/ClassReloadingTests*"/>
			</batchtest>
            <!-- GrailsHibernateConfigurationTests needs it's own VM -->
            <test todir="${grails.test.reports}" name="org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateConfigurationTests" fork="true"/>
            <test todir="${grails.test.reports}" name="org.codehaus.groovy.grails.commons.ClassReloadingTests" fork="true"/>
        </junit>
    </target>

	<target name="test-report" depends="clean-instrumented, run-test" description="Runs unit tests and generates HTML report">
		<mkdir dir="${grails.test.html.reports}"/>
        <junitreport todir="${grails.test.html.reports}">
			<fileset dir="${grails.test.reports}">
				<include name="TEST-*.xml"/>
			</fileset>
			<report format="frames" todir="${grails.test.html.reports}"/>
		</junitreport>
        <fail if="grails.test.failure">The tests failed. Have a look at ${grails.test.html.reports}/index.html</fail>
	</target>
</project>
{'fraction_non_alphanumeric': 0.18333333333333332, 'fraction_numerical': 0.0011437908496732027, 'mean_word_length': 2.6496720333929638, 'pattern_counts': {'":': 0, '<': 239, '<?xml version=': 0, '>': 239, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '478133', 'n_tokens_mistral': 4149, 'n_tokens_neox': 3688, 'n_words': 588}