<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
The sole purpose of this project is to create a transitive dependency between the core and cilistener
projects.  If the tests resided with the core project, then core and cilistener would have a circular
dependency which would be more difficult to manage from a build perspective.
-->
<project name="FlexUnit4Test" basedir="." default="test">
	<property environment="env" />

	<!-- Configuration -->
	<property name="build.number" value="4.0.0" />
	<property name="build.useFlex" value="true" />
	<property name="test.artifact.name" value="TestRunner.swf" />
	<property name="instrument.metadata" value="flexunit-instrument-${build.number}.cvm" />
	<property name="instrument.report" value="flexunit-instrument-${build.number}.cvr" />

	<!-- Setup paths for build -->
	<property name="test.src.loc" location="${basedir}/src" />
	<property name="lib.loc" location="${basedir}/libs" />
	<property name="bin.loc" location="${basedir}/target/bin" />
	<property name="report.xunit.loc" location="${basedir}/target/report/xunit" />
	<property name="report.flexcover.loc" location="${basedir}/target/report/flexcover" />
	<property name="dist.loc" location="${basedir}/target" />

	<!-- Setup Flex Ant Resources -->
	<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
	<property name="FLEX_COVER_VIEWER" location="${env.FLEX_COVER_VIEWER}" />
	<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

	<target name="clean">
		<delete includeemptydirs="true" failonerror="false">
			<fileset dir="${dist.loc}" defaultexcludes="false">
				<include name="**/*" />
			</fileset>
		</delete>
	</target>

	<target name="init">
		<echo message="Project: ${ant.project.name}" />
		<echo message="Flex SDK: ${FLEX_HOME}" />
		<echo message="Use Flex: ${build.useFlex}" />
		<echo message="" />

		<!-- Create paths -->
		<mkdir dir="${bin.loc}" />
		<mkdir dir="${report.xunit.loc}" />
		<mkdir dir="${report.flexcover.loc}" />
		<mkdir dir="${dist.loc}" />
	</target>

	<target name="test-compile" depends="init">
		<!-- Are we running the deafult test runner or Flex Cover's runner? -->
		<condition property="test.application.name" value="InstrumentTestRunner.mxml" else="TestRunner.mxml">
			<available file="${lib.loc}/${instrument.metadata}" />
		</condition>
		
		<!-- Build test swf -->
		<mxmlc file="${test.src.loc}/${test.application.name}" output="${bin.loc}/${test.artifact.name}">
			<library-path dir="${lib.loc}" append="true">
				<include name="*.swc" />
			</library-path>
			<define name="CONFIG::useFlexClasses" value="${build.useFlex}" />
			<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
			<compiler.headless-server>true</compiler.headless-server>
		</mxmlc>
	</target>

	<target name="test-only" depends="test-compile" unless="build.instrument">
		<taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-${build.number}.jar" />
		
		<!-- Run FlexUnit Ant Task -->
		<flexunit swf="${bin.loc}/${test.artifact.name}" toDir="${report.xunit.loc}" haltonfailure="false" verbose="true" localTrusted="false" />
	</target>

	<target name="test-and-instrument" depends="test-compile" if="build.instrument">
		<taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-${build.number}.jar" />
		
		<parallel>
			<!-- Launch CoverageViewer to generate coverage report -->
			<sequential>
				<exec executable="${FLEX_COVER_VIEWER}" dir="${bin.loc}" spawn="true">
					<arg line="-output '${report.flexcover.loc}/${instrument.report}'" />
					<arg line="'${lib.loc}/${instrument.metadata}'" />
				</exec>
				<waitfor checkevery="3" checkeveryunit="second">
					<available file="${report.flexcover.loc}/${instrument.report}" />
				</waitfor>
			</sequential>
			<!-- Launch FlexUnit tests after a short delay -->
			<sequential><commit_msg>Removed spawn from coverageviewer call in FlexUnit4Test to see if Windows will launch for CI box.<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
The sole purpose of this project is to create a transitive dependency between the core and cilistener
projects.  If the tests resided with the core project, then core and cilistener would have a circular
dependency which would be more difficult to manage from a build perspective.
-->
<project name="FlexUnit4Test" basedir="." default="test">
	<property environment="env" />

	<!-- Configuration -->
	<property name="build.number" value="4.0.0" />
	<property name="build.useFlex" value="true" />
	<property name="test.artifact.name" value="TestRunner.swf" />
	<property name="instrument.metadata" value="flexunit-instrument-${build.number}.cvm" />
	<property name="instrument.report" value="flexunit-instrument-${build.number}.cvr" />

	<!-- Setup paths for build -->
	<property name="test.src.loc" location="${basedir}/src" />
	<property name="lib.loc" location="${basedir}/libs" />
	<property name="bin.loc" location="${basedir}/target/bin" />
	<property name="report.xunit.loc" location="${basedir}/target/report/xunit" />
	<property name="report.flexcover.loc" location="${basedir}/target/report/flexcover" />
	<property name="dist.loc" location="${basedir}/target" />

	<!-- Setup Flex Ant Resources -->
	<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
	<property name="FLEX_COVER_VIEWER" location="${env.FLEX_COVER_VIEWER}" />
	<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

	<target name="clean">
		<delete includeemptydirs="true" failonerror="false">
			<fileset dir="${dist.loc}" defaultexcludes="false">
				<include name="**/*" />
			</fileset>
		</delete>
	</target>

	<target name="init">
		<echo message="Project: ${ant.project.name}" />
		<echo message="Flex SDK: ${FLEX_HOME}" />
		<echo message="Use Flex: ${build.useFlex}" />
		<echo message="" />

		<!-- Create paths -->
		<mkdir dir="${bin.loc}" />
		<mkdir dir="${report.xunit.loc}" />
		<mkdir dir="${report.flexcover.loc}" />
		<mkdir dir="${dist.loc}" />
	</target>

	<target name="test-compile" depends="init">
		<!-- Are we running the deafult test runner or Flex Cover's runner? -->
		<condition property="test.application.name" value="InstrumentTestRunner.mxml" else="TestRunner.mxml">
			<available file="${lib.loc}/${instrument.metadata}" />
		</condition>
		
		<!-- Build test swf -->
		<mxmlc file="${test.src.loc}/${test.application.name}" output="${bin.loc}/${test.artifact.name}">
			<library-path dir="${lib.loc}" append="true">
				<include name="*.swc" />
			</library-path>
			<define name="CONFIG::useFlexClasses" value="${build.useFlex}" />
			<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
			<compiler.headless-server>true</compiler.headless-server>
		</mxmlc>
	</target>

	<target name="test-only" depends="test-compile" unless="build.instrument">
		<taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-${build.number}.jar" />
		
		<!-- Run FlexUnit Ant Task -->
		<flexunit swf="${bin.loc}/${test.artifact.name}" toDir="${report.xunit.loc}" haltonfailure="false" verbose="true" localTrusted="false" />
	</target>

	<target name="test-and-instrument" depends="test-compile" if="build.instrument">
		<taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-${build.number}.jar" />
		
		<parallel>
			<!-- Launch CoverageViewer to generate coverage report -->
			<sequential>
				<exec executable="${FLEX_COVER_VIEWER}" dir="${bin.loc}">
					<arg line="-output '${report.flexcover.loc}/${instrument.report}'" />
					<arg line="'${lib.loc}/${instrument.metadata}'" />
				</exec>
				<waitfor checkevery="3" checkeveryunit="second">
					<available file="${report.flexcover.loc}/${instrument.report}" />
				</waitfor>
			</sequential>
			<!-- Launch FlexUnit tests after a short delay -->
			<sequential>
{'fraction_non_alphanumeric': 0.19798956610255758, 'fraction_numerical': 0.0021631250795266575, 'mean_word_length': 4.728862973760933, 'pattern_counts': {'":': 0, '<': 155, '<?xml version=': 2, '>': 155, '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': '6237915', 'n_tokens_mistral': 2728, 'n_tokens_neox': 2453, 'n_words': 499}