<commit_before><?xml version="1.0" encoding="UTF-8"?>
<project name="moxie+ant" default="main" xmlns:mx="antlib:org.moxie">

	<!-- Moxie tasks -->
	<taskdef resource="tasks.properties" uri="antlib:org.moxie">
		<classpath location="${basedir}/../toolkit/target/moxie.jar" />
	</taskdef>
	
	<target name="main">
		<delete dir="ext" includes="**/*" quiet="true" failonerror="false"/>
		
		<!-- initialize Moxie, retrieve dependencies, and setup classpaths --> 
		<mx:init />
		
		<!-- retrieve dependencies not defined in build.moxie -->
		<mx:get dest="${basedir}/ext" scope="compile">
			<dependency coordinates="javax.mail:mail:1.4" />
			<dependency coordinates="javax.activation:activation:1.1" />
			<dependency coordinates="mx:markdownpapers" />
			<dependency coordinates="mx:jgit" />
			<dependency coordinates="mx:rhino" />
		</mx:get>
			
		<delete dir="${mxp.targetFolder}" includes="**/*" quiet="true" failonerror="false"/>
		
		<property name="ant.release" value="apache-ant-${ant.version}" />
		<property name="ant.distribution" value="${ant.release}-bin.zip" />
		
		<!-- retrieve the Ant distribution, if necessary -->
		<mkdir dir="${mxp.outputFolder}"/>
		<get dest="${mxp.outputFolder}" skipexisting="true" verbose="true"
			src="http://www.apache.org/dist/ant/binaries/${ant.distribution}" />

		<!-- build a new Moxie+Ant distribution -->
		<delete dir="${mxp.outputFolder}/dist" includes="**/*" quiet="true" failonerror="false"/>
		<unzip dest="${mxp.outputFolder}/dist" src="${mxp.outputFolder}/${ant.distribution}" />

		<!-- rename ant scripts to moxie scripts, this avoids path confusion -->
		<property name="antbin" value="${mxp.outputFolder}/dist/${ant.release}/bin" />
		<property name="moxieMain" value="org.moxie.ant.Main" />
		
		<patchfile tofile="${antbin}/moxie" file="${antbin}/ant" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxie.cmd" file="${antbin}/ant.cmd" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxie.bat" file="${antbin}/ant.bat" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxieRun" file="${antbin}/antRun" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxieRun.bat" file="${antbin}/antRun.bat" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxieRun.pl" file="${antbin}/antRun.pl" main="${moxieMain}" />
		<patchfile tofile="${antbin}/complete-moxie-cmd.pl" file="${antbin}/complete-ant-cmd.pl" main="${moxieMain}" />
		<patchfile tofile="${antbin}/runmoxie.pl" file="${antbin}/runant.pl" main="${moxieMain}" />
		<patchfile tofile="${antbin}/runmoxie.py" file="${antbin}/runant.py" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxieenv.cmd" file="${antbin}/antenv.cmd" main="${moxieMain}" />

		<!-- create zip distribution -->
		<zip destfile="${mxp.targetFolder}/moxie+ant-${project.version}.zip">
			<zipfileset dir="${mxp.outputFolder}/dist/${ant.release}" prefix="moxie-${project.version}" />
			<zipfileset file="${basedir}/../toolkit/target/moxie.jar" prefix="moxie-${project.version}/lib" />
			<zipfileset dir="ext" prefix="moxie-${project.version}/lib" />
		</zip>
		
		<!-- create gzip distribution (preserves script execute permissions) -->
		<tar longfile="gnu" destfile="${mxp.outputFolder}/dist/moxie+ant-${project.version}.tar">
			<tarfileset dir="${mxp.outputFolder}/dist/${ant.release}" prefix="moxie-${project.version}"
				filemode="755" username="ant" group="ant">
				<include name="bin/moxie"/>
				<include name="bin/moxieRun"/>
				<include name="bin/moxieRun.pl"/>
				<include name="bin/complete-moxie-cmd.pl"/>
				<include name="bin/runmoxie.pl"/>
				<include name="bin/runmoxie.py"/>
			</tarfileset>
			<tarfileset dir="${mxp.outputFolder}/dist/${ant.release}" prefix="moxie-${project.version}"
				username="ant" group="ant">
				<include name="**/*"/>
				<exclude name="bin/*.pl"/>
				<exclude name="bin/*.py"/>
				<exclude name="bin/moxie"/>
				<exclude name="bin/moxieRun"/>
			</tarfileset>
			<tarfileset dir="ext" prefix="moxie-${project.version}/lib"
				username="ant" group="ant">
				<exclude name="ant*"/>
				<include name="*"/>
			</tarfileset>
			<tarfileset file="${basedir}/../toolkit/target/moxie.jar" prefix="moxie-${project.version}/lib"
				username="ant" group="ant" />
		</tar>		
		<gzip destfile="${mxp.targetFolder}/moxie+ant-${project.version}.tar.gz" 
			src="${mxp.outputFolder}/dist/moxie+ant-${project.version}.tar" />
	</target>
	
	<!-- Renames bin scripts and replaces all Ant-specific variables, paths, -->
	<!-- etc. with Moxie-specific alternatives. -->
	<macrodef name="patchfile">
	   <attribute name="file"/>
	   <attribute name="tofile"/>
		<attribute name="main"/>
	   <sequential>
	   		<move tofile="@{tofile}" file="@{file}" />
			<replace file="@{tofile}">
				<!-- rename ANT_ variable prefix to MOXIE_ to avoid collisions -->
				<replacefilter token="ANT_OPTS" value="MOXIE_OPTS"/>
				<replacefilter token="ANT_ARGS" value="MOXIE_ARGS"/>
				<replacefilter token="ANT_HOME" value="MOXIE_HOME"/>
				<replacefilter token="ANT_LIB" value="MOXIE_LIB"/>
				<replacefilter token="ANT_USE_CP" value="MOXIE_USE_CP"/>
				<replacefilter token="ANT_CMD_LINE_ARGS" value="MOXIE_CMD_LINE_ARGS"/>
				<replacefilter token="ANT_RUN_CMD" value="MOXIE_RUN_CMD"/>
				<replacefilter token="ANT_ERROR" value="MOXIE_ERROR"/>
				
				<!-- rename script file references to avoid path collisions -->
				<replacefilter token="antRun" value="moxieRun"/>				
				<replacefilter token="antenv" value="moxieenv"/>
				
				<!-- ensure that the Moxie main class is used instead of Ant -->
				<replacefilter token="org.apache.tools.ant.Main" value="@{main}"/>
				<replacefilter token="$MOXIE_ARGS" value="-main @{main} $MOXIE_ARGS"/>
				<replacefilter token="%MOXIE_ARGS%" value="-main @{main} %MOXIE_ARGS%"/>
				<replacefilter token="push @ARGS, &quot;org.apache.tools.ant.launch.Launcher&quot;, @MOXIE_ARGS;" value="push @ARGS, &quot;org.apache.tools.ant.launch.Launcher&quot;, &quot;-main&quot;, &quot;@{main}&quot;, @MOXIE_ARGS;"/>
				<replacefilter token="org.apache.tools.ant.launch.Launcher %s %s %s" value="org.apache.tools.ant.launch.Launcher -main @{main} %s %s %s"/>
				<replacefilter token="settings args antarg" value="settings -main @{main} args antarg"/>				
			</replace>
	      </sequential>
	</macrodef>
</project><commit_msg>Support OS X Lion java_home utility<commit_after><?xml version="1.0" encoding="UTF-8"?>
<project name="moxie+ant" default="main" xmlns:mx="antlib:org.moxie">

	<!-- Moxie tasks -->
	<taskdef resource="tasks.properties" uri="antlib:org.moxie">
		<classpath location="${basedir}/../toolkit/target/moxie.jar" />
	</taskdef>
	
	<target name="main">
		<delete dir="ext" includes="**/*" quiet="true" failonerror="false"/>
		
		<!-- initialize Moxie, retrieve dependencies, and setup classpaths --> 
		<mx:init />
		
		<!-- retrieve dependencies not defined in build.moxie -->
		<mx:get dest="${basedir}/ext" scope="compile">
			<dependency coordinates="javax.mail:mail:1.4" />
			<dependency coordinates="javax.activation:activation:1.1" />
			<dependency coordinates="mx:markdownpapers" />
			<dependency coordinates="mx:jgit" />
			<dependency coordinates="mx:rhino" />
		</mx:get>
			
		<delete dir="${mxp.targetFolder}" includes="**/*" quiet="true" failonerror="false"/>
		
		<property name="ant.release" value="apache-ant-${ant.version}" />
		<property name="ant.distribution" value="${ant.release}-bin.zip" />
		
		<!-- retrieve the Ant distribution, if necessary -->
		<mkdir dir="${mxp.outputFolder}"/>
		<get dest="${mxp.outputFolder}" skipexisting="true" verbose="true"
			src="http://www.apache.org/dist/ant/binaries/${ant.distribution}" />

		<!-- build a new Moxie+Ant distribution -->
		<delete dir="${mxp.outputFolder}/dist" includes="**/*" quiet="true" failonerror="false"/>
		<unzip dest="${mxp.outputFolder}/dist" src="${mxp.outputFolder}/${ant.distribution}" />

		<!-- rename ant scripts to moxie scripts, this avoids path confusion -->
		<property name="antbin" value="${mxp.outputFolder}/dist/${ant.release}/bin" />
		<property name="moxieMain" value="org.moxie.ant.Main" />
		
		<patchfile tofile="${antbin}/moxie" file="${antbin}/ant" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxie.cmd" file="${antbin}/ant.cmd" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxie.bat" file="${antbin}/ant.bat" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxieRun" file="${antbin}/antRun" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxieRun.bat" file="${antbin}/antRun.bat" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxieRun.pl" file="${antbin}/antRun.pl" main="${moxieMain}" />
		<patchfile tofile="${antbin}/complete-moxie-cmd.pl" file="${antbin}/complete-ant-cmd.pl" main="${moxieMain}" />
		<patchfile tofile="${antbin}/runmoxie.pl" file="${antbin}/runant.pl" main="${moxieMain}" />
		<patchfile tofile="${antbin}/runmoxie.py" file="${antbin}/runant.py" main="${moxieMain}" />
		<patchfile tofile="${antbin}/moxieenv.cmd" file="${antbin}/antenv.cmd" main="${moxieMain}" />

		<!-- create zip distribution -->
		<zip destfile="${mxp.targetFolder}/moxie+ant-${project.version}.zip">
			<zipfileset dir="${mxp.outputFolder}/dist/${ant.release}" prefix="moxie-${project.version}" />
			<zipfileset file="${basedir}/../toolkit/target/moxie.jar" prefix="moxie-${project.version}/lib" />
			<zipfileset dir="ext" prefix="moxie-${project.version}/lib" />
		</zip>
		
		<!-- create gzip distribution (preserves script execute permissions) -->
		<tar longfile="gnu" destfile="${mxp.outputFolder}/dist/moxie+ant-${project.version}.tar">
			<tarfileset dir="${mxp.outputFolder}/dist/${ant.release}" prefix="moxie-${project.version}"
				filemode="755" username="ant" group="ant">
				<include name="bin/moxie"/>
				<include name="bin/moxieRun"/>
				<include name="bin/moxieRun.pl"/>
				<include name="bin/complete-moxie-cmd.pl"/>
				<include name="bin/runmoxie.pl"/>
				<include name="bin/runmoxie.py"/>
			</tarfileset>
			<tarfileset dir="${mxp.outputFolder}/dist/${ant.release}" prefix="moxie-${project.version}"
				username="ant" group="ant">
				<include name="**/*"/>
				<exclude name="bin/*.pl"/>
				<exclude name="bin/*.py"/>
				<exclude name="bin/moxie"/>
				<exclude name="bin/moxieRun"/>
			</tarfileset>
			<tarfileset dir="ext" prefix="moxie-${project.version}/lib"
				username="ant" group="ant">
				<exclude name="ant*"/>
				<include name="*"/>
			</tarfileset>
			<tarfileset file="${basedir}/../toolkit/target/moxie.jar" prefix="moxie-${project.version}/lib"
				username="ant" group="ant" />
		</tar>		
		<gzip destfile="${mxp.targetFolder}/moxie+ant-${project.version}.tar.gz" 
			src="${mxp.outputFolder}/dist/moxie+ant-${project.version}.tar" />
	</target>
	
	<!-- Renames bin scripts and replaces all Ant-specific variables, paths, -->
	<!-- etc. with Moxie-specific alternatives. -->
	<macrodef name="patchfile">
	   <attribute name="file"/>
	   <attribute name="tofile"/>
		<attribute name="main"/>
	   <sequential>
	   		<move tofile="@{tofile}" file="@{file}" />
			<replace file="@{tofile}">
				<!-- rename ANT_ variable prefix to MOXIE_ to avoid collisions -->
				<replacefilter token="ANT_OPTS" value="MOXIE_OPTS"/>
				<replacefilter token="ANT_ARGS" value="MOXIE_ARGS"/>
				<replacefilter token="ANT_HOME" value="MOXIE_HOME"/>
				<replacefilter token="ANT_LIB" value="MOXIE_LIB"/>
				<replacefilter token="ANT_USE_CP" value="MOXIE_USE_CP"/>
				<replacefilter token="ANT_CMD_LINE_ARGS" value="MOXIE_CMD_LINE_ARGS"/>
				<replacefilter token="ANT_RUN_CMD" value="MOXIE_RUN_CMD"/>
				<replacefilter token="ANT_ERROR" value="MOXIE_ERROR"/>
				
				<!-- rename script file references to avoid path collisions -->
				<replacefilter token="antRun" value="moxieRun"/>				
				<replacefilter token="antenv" value="moxieenv"/>
				
				<!-- ensure that the Moxie main class is used instead of Ant -->
				<replacefilter token="org.apache.tools.ant.Main" value="@{main}"/>
				<replacefilter token="$MOXIE_ARGS" value="-main @{main} $MOXIE_ARGS"/>
				<replacefilter token="%MOXIE_ARGS%" value="-main @{main} %MOXIE_ARGS%"/>
				<replacefilter token="push @ARGS, &quot;org.apache.tools.ant.launch.Launcher&quot;, @MOXIE_ARGS;" value="push @ARGS, &quot;org.apache.tools.ant.launch.Launcher&quot;, &quot;-main&quot;, &quot;@{main}&quot;, @MOXIE_ARGS;"/>
				<replacefilter token="org.apache.tools.ant.launch.Launcher %s %s %s" value="org.apache.tools.ant.launch.Launcher -main @{main} %s %s %s"/>
				<replacefilter token="settings args antarg" value="settings -main @{main} args antarg"/>				
				
				<!-- replace the OS X folder with the app -->
				<replacefilter token="JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home" value="if [ -f &quot;/usr/libexec/java_home&quot; ] ; then&#xa;               JAVA_HOME=`/usr/libexec/java_home`&#xa;             else&#xa;               JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home&#xa;             fi&#xa;"/>
			</replace>
	      </sequential>
	</macrodef>
</project>
{'fraction_non_alphanumeric': 0.2101871739797484, 'fraction_numerical': 0.0015342129487572874, 'mean_word_length': 4.552385008517888, 'pattern_counts': {'":': 0, '<': 211, '<?xml version=': 2, '>': 211, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '615047', 'n_tokens_mistral': 4922, 'n_tokens_neox': 4373, 'n_words': 734}