<commit_before><?xml version="1.0" encoding="UTF-8"?>
<project name="master" default="none">

	<!-- 
	     INIT
	     The target is a dependent of all other targets.
	     It's purpose is to set up the environment only once
	     and avoid it being repeatedly done for each antcall.
	-->

	<target name="init" unless="initialized">
		<tstamp>
			<format property="NOW" pattern="yyyyMMdd-HHmmss" timezone="UTC"/>
		</tstamp>
		
		<dirname property="projectdir" file="${ant.file}" />
		<dirname property="workspacedir" file="${projectdir}" />
		<taskdef resource="aQute/bnd/ant/taskdef.properties">
			<classpath>
				<path location="${workspacedir}/cnf/repo/biz.aQute.bnd/biz.aQute.bnd-latest.jar"/>
			</classpath>
		</taskdef>

		<bndprepare basedir="${projectdir}" print="false" top="${release.dir}" />

		<taskdef resource="net/sf/antcontrib/antlib.xml">
			<classpath>
				<pathelement location="${workspacedir}/cnf/ant-contrib/ant-contrib-1.0b3.jar"/>
			</classpath>
		</taskdef>

		<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
			<classpath>
				<fileset dir="${workspacedir}/cnf/findbugs/lib">
					<include name="**/*.jar" />
				</fileset>
			</classpath>
		</taskdef>

		<!-- mark init has been run -->
		<property name="initialized" value="set" />
		<echo message="Enter project ${project.name}"/>
	</target>

	<!-- 
		DEPENDENCIES
		Build project dependencies.
	-->
	<target name="dependencies" depends="init" if="project.dependson" unless="donotrecurse">
		<subant target="build" inheritAll="false" buildpath="${project.dependson}">
			<property name="donotrecurse" value="true" />
		</subant>
	</target>

	<!--
	     Test
	-->
	<target name="test" depends="compile">
		<bnd command="test" exceptions="true" basedir="${project}" />
	</target>

	<!--
	     COMPILE
	     Compile the sources. 
	-->
	<target name="compile" depends="dependencies" if="project.sourcepath">
		<mkdir dir="${project.output}"/>
		<javac fork="yes" executable="${javac}" srcdir="${project.sourcepath}" destdir="${project.output}" classpath="${project.buildpath}" bootclasspath="${project.bootclasspath}" deprecation="true" listfiles="true" target="${javac.target}" source="${javac.source}" debug="${javac.debug}" includeAntRuntime="no" verbose="${verbose}" />
		<!-- 
		  The eclipse compiler copies resources but the Javac compiler does not
		  If ${src} == ${bin} then this is not necessary, but unfortunately, now 
		  it is. 
		-->
		<copy todir="${project.output}" verbose="${verbose}" preservelastmodified="true">
			<fileset dir="${project.sourcepath}">
				<exclude name="**/*.java" />
				<exclude name="**/*.class" />
			</fileset>
		</copy>
	</target>

	<!-- 
		JARS
		Iterate of the jars to build.
	-->
	<target name="build" depends="compile">
		<mkdir dir="${target}"/>
		<bnd command="build" exceptions="true" basedir="${project}" />
	</target>
	
	<target name="release" depends="build">
		<subant target="release" inheritAll="false" buildpath="${project.dependson}">
			<property name="donotrecurse" value="true" />
		</subant>
		<bnd command="release" exceptions="true" basedir="${project}"/>
	</target>

	<target name="junit" depends="build">
		<junit showoutput="false" printsummary="true" failureproperty='stop' errorproperty='stop' fork="true" dir="${basedir}">
			<classpath path="${project.buildpath}" />
			<formatter type="xml"/>
			<batchtest todir="${target}" >
			    <fileset dir="${src}">
			      <include name="test/**.java"/>
			    </fileset>
			</batchtest>
		</junit>
	</target>

	<target name="findbugs" depends="init,build">
		<propertyregex property="project.buildpath.adjusted"
			input="${project.buildpath}"
			defaultValue="${project.buildpath}"
			regexp="(.*)(:${project.output}|${project.output}:)(.*)"
			global="yes"
			select="\1\3" />

		<findbugs
			home="${workspacedir}/cnf/findbugs"
			includeFilter="${workspacedir}/cnf/findbugs.include.xml"
			excludeFilter="${workspacedir}/cnf/findbugs.exclude.xml"
			output="xml:withMessages"
			outputFile="${target}/${project.name}.findbugs.xml">
			<sourcePath path="${project.sourcepath}" />
			<auxClasspath path="${project.bootclasspath}:${project.buildpath.adjusted}:${project.testpath}" />
			<class location="${target}" />
		</findbugs>
	</target>

	<!--
	     CLEAN
	-->
	<target name="deepclean" depends="init,clean" if="project.dependson">
		<subant target="clean" inheritAll="false" buildpath="${project.dependson}" />
	</target>

	<target name="clean" depends="init">
		<bnd command="clean" exceptions="true" basedir="${project}" />
		<delete dir="bin"/>
		<delete dir="bin_test"/>
		<delete dir="${target}"/>
		
		<delete dir="${workspacedir}/cnf/tmp"/>
		<delete dir="${workspacedir}/cnf/p2target"/>
	</target>

	<!--
	     ECHO
	-->
	<target name="echo" depends="init">
		<echo>verbose:                ${verbose}</echo>
		<echo>project.name:           ${project.name}</echo>
		<echo>Bundle-Version:         ${Bundle-Version}</echo><commit_msg>findbugs: filter out j2se jars<commit_after><?xml version="1.0" encoding="UTF-8"?>
<project name="master" default="none">

	<!-- 
	     INIT
	     The target is a dependent of all other targets.
	     It's purpose is to set up the environment only once
	     and avoid it being repeatedly done for each antcall.
	-->

	<target name="init" unless="initialized">
		<tstamp>
			<format property="NOW" pattern="yyyyMMdd-HHmmss" timezone="UTC"/>
		</tstamp>
		
		<dirname property="projectdir" file="${ant.file}" />
		<dirname property="workspacedir" file="${projectdir}" />
		<taskdef resource="aQute/bnd/ant/taskdef.properties">
			<classpath>
				<path location="${workspacedir}/cnf/repo/biz.aQute.bnd/biz.aQute.bnd-latest.jar"/>
			</classpath>
		</taskdef>

		<bndprepare basedir="${projectdir}" print="false" top="${release.dir}" />

		<taskdef resource="net/sf/antcontrib/antlib.xml">
			<classpath>
				<pathelement location="${workspacedir}/cnf/ant-contrib/ant-contrib-1.0b3.jar"/>
			</classpath>
		</taskdef>

		<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
			<classpath>
				<fileset dir="${workspacedir}/cnf/findbugs/lib">
					<include name="**/*.jar" />
				</fileset>
			</classpath>
		</taskdef>

		<!-- mark init has been run -->
		<property name="initialized" value="set" />
		<echo message="Enter project ${project.name}"/>
	</target>

	<!-- 
		DEPENDENCIES
		Build project dependencies.
	-->
	<target name="dependencies" depends="init" if="project.dependson" unless="donotrecurse">
		<subant target="build" inheritAll="false" buildpath="${project.dependson}">
			<property name="donotrecurse" value="true" />
		</subant>
	</target>

	<!--
	     Test
	-->
	<target name="test" depends="compile">
		<bnd command="test" exceptions="true" basedir="${project}" />
	</target>

	<!--
	     COMPILE
	     Compile the sources. 
	-->
	<target name="compile" depends="dependencies" if="project.sourcepath">
		<mkdir dir="${project.output}"/>
		<javac fork="yes" executable="${javac}" srcdir="${project.sourcepath}" destdir="${project.output}" classpath="${project.buildpath}" bootclasspath="${project.bootclasspath}" deprecation="true" listfiles="true" target="${javac.target}" source="${javac.source}" debug="${javac.debug}" includeAntRuntime="no" verbose="${verbose}" />
		<!-- 
		  The eclipse compiler copies resources but the Javac compiler does not
		  If ${src} == ${bin} then this is not necessary, but unfortunately, now 
		  it is. 
		-->
		<copy todir="${project.output}" verbose="${verbose}" preservelastmodified="true">
			<fileset dir="${project.sourcepath}">
				<exclude name="**/*.java" />
				<exclude name="**/*.class" />
			</fileset>
		</copy>
	</target>

	<!-- 
		JARS
		Iterate of the jars to build.
	-->
	<target name="build" depends="compile">
		<mkdir dir="${target}"/>
		<bnd command="build" exceptions="true" basedir="${project}" />
	</target>
	
	<target name="release" depends="build">
		<subant target="release" inheritAll="false" buildpath="${project.dependson}">
			<property name="donotrecurse" value="true" />
		</subant>
		<bnd command="release" exceptions="true" basedir="${project}"/>
	</target>

	<target name="junit" depends="build">
		<junit showoutput="false" printsummary="true" failureproperty='stop' errorproperty='stop' fork="true" dir="${basedir}">
			<classpath path="${project.buildpath}" />
			<formatter type="xml"/>
			<batchtest todir="${target}" >
			    <fileset dir="${src}">
			      <include name="test/**.java"/>
			    </fileset>
			</batchtest>
		</junit>
	</target>

	<target name="findbugs" depends="init,build">
		<property name="project.bootclasspath.adjusted" value="${project.bootclasspath}"/>
		<property name="project.buildpath.adjusted" value="${project.buildpath}"/>
		<property name="project.testpath.adjusted" value="${project.testpath}"/>

		<!-- filter out some jars and directories -->
		<for
			list="[^:]+/ee\.j2se-[0-9\.]+\.jar#${project.output}#^:+#:+$"
			delimiter="#"
			param="regex">
			<sequential>
				<propertyregex
					property="project.bootclasspath.adjusted"
					input="${project.bootclasspath.adjusted}"
					defaultValue="${project.bootclasspath.adjusted}"
					regexp="@{regex}"
					replace=""
					override="true"
					global="yes" />
				<propertyregex
					property="project.buildpath.adjusted"
					input="${project.buildpath.adjusted}"
					defaultValue="${project.buildpath.adjusted}"
					regexp="@{regex}"
					replace=""
					override="true"
					global="yes" />
				<propertyregex
					property="project.testpath.adjusted"
					input="${project.testpath.adjusted}"
					defaultValue="${project.testpath.adjusted}"
					regexp="@{regex}"
					replace=""
					override="true"
					global="yes" />
			</sequential>
		</for>
		<!-- fixups -->
		<propertyregex
			property="project.bootclasspath.adjusted"
			input="${project.bootclasspath.adjusted}"
			defaultValue="${project.bootclasspath.adjusted}"
			regexp=":+"
			replace=":"
			override="true"
			global="yes" />
		<propertyregex
			property="project.buildpath.adjusted"
			input="${project.buildpath.adjusted}"
			defaultValue="${project.buildpath.adjusted}"
			regexp=":+"
			replace=":"
			override="true"
			global="yes" />
		<propertyregex
			property="project.testpath.adjusted"
			input="${project.testpath.adjusted}"
			defaultValue="${project.testpath.adjusted}"
			regexp=":+"
			replace=":"
			override="true"
			global="yes" />

		<findbugs
			home="${workspacedir}/cnf/findbugs"
			includeFilter="${workspacedir}/cnf/findbugs.include.xml"
			excludeFilter="${workspacedir}/cnf/findbugs.exclude.xml"
			output="xml:withMessages"
			outputFile="${target}/${project.name}.findbugs.xml">
			<sourcePath path="${project.sourcepath}" />
			<auxClasspath path="${project.bootclasspath.adjusted}:${project.buildpath.adjusted}:${project.testpath.adjusted}" />
			<class location="${target}" />
		</findbugs>
	</target>

	<!--
	     CLEAN
	-->
	<target name="deepclean" depends="init,clean" if="project.dependson">
		<subant target="clean" inheritAll="false" buildpath="${project.dependson}" />
	</target>

	<target name="clean" depends="init">
		<bnd command="clean" exceptions="true" basedir="${project}" />
		<delete dir="bin"/>
		<delete dir="bin_test"/>
		<delete dir="${target}"/>
		
		<delete dir="${workspacedir}/cnf/tmp"/>
		<delete dir="${workspacedir}/cnf/p2target"/>
	</target>

	<!--
	     ECHO
	-->
	<target name="echo" depends="init">
		<echo>verbose:                ${verbose}</echo>
		<echo>project.name:           ${project.name}</echo>
		<echo>Bundle-Version:         ${Bundle-Version}</echo>
{'fraction_non_alphanumeric': 0.1990161387762147, 'fraction_numerical': 0.0017260723224303098, 'mean_word_length': 4.224526600541028, 'pattern_counts': {'":': 6, '<': 223, '<?xml version=': 2, '>': 223, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '7339058', 'n_tokens_mistral': 4261, 'n_tokens_neox': 3645, 'n_words': 665}