<commit_before><project name="ZAP-Extensions (Alpha)" default="build-all" basedir=".">
	<description>Build ZAP extensions</description>

	<property name="src" location="../src" />
	<property name="src.version" value="1.7" />
	<property name="build" location="build" />
	<property name="build.lib.dir" location="lib" />
	<property name="temp" location="temp" />
	<property name="dist" location="zap-exts" />
	<property name="dist.lib.dir" location="../lib" />
	<property name="status" value="alpha" />
	<property name="versions.file" location="${dist}/ZapVersions.xml" />
	<property name="wiki.dir" location="../../zap-extensions-wiki" />
	<!-- This assumes you also have the zaproxy project -->
	<property name="zap.plugin.dir" location="../../zaproxy/src/plugin" />
	<!-- This assumes you also have the zaproxy_2.4 project (used for the weekly release -->
	<property name="zap-2.4.plugin.dir" location="../../zaproxy_2.4/src/plugin" />

	<path id="build.classpath">
		   <fileset dir="${build.lib.dir}" includes="*.jar"/>
	</path>

	<!-- Ant task to generate the wiki -->
	<taskdef classpathref="build.classpath" resource="wikitasks.properties" />

	<!-- Ant task to generate JavaHelp search indexes -->
	<taskdef classpathref="build.classpath" resource="javahelptasks.properties" />

	<!-- Ant task to append ZapAddOn.xml files to ZapVersions.xml -->
	<taskdef classpathref="build.classpath" resource="zapversionstasks.properties"/>
	
	<target name="clean">
		<delete dir="${dist}" includeEmptyDirs="true" />
		<delete dir="${build}" includeEmptyDirs="true" />
		<delete dir="${temp}" includeEmptyDirs="true" />
	</target>

	<target name="init">
		<!-- Create the build directory structure used by compile -->
		<mkdir dir="${dist}" />
		<mkdir dir="${build}" />
		<mkdir dir="${temp}" />
	</target>

	<target name="compile" depends="init" description="compile the source">
		<echo message="Compiling the source..." />
		
		<!-- Compile with debug information if the property "javac.debug" is set to true -->
		<local name="debug" />
		<condition property="debug" value="true" else="true">
			<istrue value="${javac.debug}" />
		</condition>

		<property name="debug" value="true" />
		<echo message="Debug = ${debug}" />

		<!-- Compile the java code from ${src} into ${build} -->
		<javac srcdir="${src}" destdir="${build}" source="${src.version}" target="${src.version}" includeantruntime="false" debug="${debug}" encoding="UTF-8">
			<classpath>
				<fileset dir="${dist.lib.dir}">
					<include name="**/*.jar" />
					<include name="**/*.zap" />
				</fileset>
			</classpath>
		</javac>
	</target>

	<macrodef name="generate-wiki" description="Generates the wiki of an add-on into zap-extensions wiki dir">
		<attribute name="addOn"/>
		<sequential>
			<local name="addOnCapitalised" />
			<capitalise name="addOnCapitalised" value="@{addOn}" />

			<xmlproperty file="${src}/org/zaproxy/zap/extension/@{addOn}/ZapAddOn.xml"/>
			<local name="version"/>
			<property name="version" value="${zapaddon.version}" />

			<generatewiki basesrcdir="${src}/org/zaproxy/zap/extension/@{addOn}/resources" basedestdir="${wiki.dir}"
				helpcontentsdir="contents/" helpcontentsinclude=".*\.html"
				srcimagesdir="contents/images/" destimagesdir="images" prefixlinkimages="https://github.com/zaproxy/zap-extensions/wiki/images/"
				outputfilenameprefix="HelpAddons${addOnCapitalised}" includeoutputfiles="HelpAddOns${addOnCapitalised}.*\.md"
				helpfileextension=".html" wikifileextension=".md"
				srctocfile="toc.xml" srcmapfile="map.jhm" wikitocfilename="_Sidebar-${addOnCapitalised}">

				<!-- Default language is at root of dest dir -->
				<helpdir src="help" dest="" />
				<!-- Do not generate for now.
				<helpdir src="help_bs_BA" dest="bs" />
				<helpdir src="help_de_DE" dest="de" />
				<helpdir src="help_el_GR" dest="el" />
				<helpdir src="help_es_ES" dest="es" />
				<helpdir src="help_fa_IR" dest="fa" />
				<helpdir src="help_fr_FR" dest="fr" />
				<helpdir src="help_it_IT" dest="it" />
				<helpdir src="help_ja_JP" dest="ja" />
				<helpdir src="help_pl_PL" dest="pl" />
				<helpdir src="help_pt_BR" dest="pt-BR" />
				<helpdir src="help_ru_RU" dest="ru" /> -->
			</generatewiki>
		</sequential>
	</macrodef>

	<!--
	 Build the specified extension
	 version should be an integer that increments on each release, starting at 1
	 -->

	<macrodef name="build-addon" description="build the specified addon">
		<attribute name="name"/>
		<element name="extra-actions" implicit="true" optional="true" />
		<sequential>
			<local name="zapaddon.version" />
			<xmlproperty file="${src}/org/zaproxy/zap/extension/@{name}/ZapAddOn.xml"/>
			<local name="file" />
			<property name="file" value="@{name}-${status}-${zapaddon.version}.zap" />

			<generatejavahelpsearchindexes jhalljar="${dist.lib.dir}/jhall.jar"
				helpcontentsdirname="contents" helpsetfilename="helpset*.hs">
				<dirset dir="${src}/org/zaproxy/zap/extension/@{name}/resources/">
					<include name="help" />
					<include name="help_*_*" />
				</dirset>
			</generatejavahelpsearchindexes>

			<local name="addon.libs.zip" />
			<property name="addon.libs.zip" value="${temp}/libs-@{name}.zip" />

			<delete file="${addon.libs.zip}" failonerror="true" />
			<zip destfile="${addon.libs.zip}" whenempty="create">
				<zipgroupfileset dir="${src}/org/zaproxy/zap/extension/@{name}/lib/" includes="*.jar" erroronmissingdir="false" />
			</zip>

			<jar jarfile="${dist}/${file}" update="true" compress="true">
				<zipfileset dir="${build}" prefix="">
					<include name="org/zaproxy/zap/extension/@{name}/**"/>
				</zipfileset>
				<zipfileset dir="${src}" prefix="">
					<include name="org/zaproxy/zap/extension/@{name}/Messages*"/>
				</zipfileset>
				<zipfileset dir="${src}" prefix="">
					<include name="org/zaproxy/zap/extension/@{name}/resources/**"/>
				</zipfileset>
				<zipfileset src="${addon.libs.zip}">
					<exclude name="META-INF/*.DSA" />
					<exclude name="META-INF/*.SF" />
				</zipfileset>
				<zipfileset dir="${src}" includes="org/zaproxy/zap/extension/@{name}/ZapAddOn.xml" fullpath="ZapAddOn.xml"/>
			</jar>
			<delete file="${addon.libs.zip}" />

			<!-- Remove search indexes previously generated, no longer needed. -->
			<delete dir="${src}/org/zaproxy/zap/extension/@{name}/resources/help/JavaHelpSearch" />
			<delete dir="${src}/org/zaproxy/zap/extension/@{name}/resources/help_*_*/JavaHelpSearch" />

			<!-- Include add-on files -->
			<jar jarfile="${dist}/${file}" update="true" compress="true">
				<zipfileset dir="${src}/org/zaproxy/zap/extension/@{name}/files/" prefix="" erroronmissingdir="false" />
			</jar>

			<!-- allow callers to do extra actions before generating the hash and determine the size of the file -->
			<extra-actions />

			<local name="length" />
			<length file="${dist}/${file}" property="length" />

			<local name="sha1hash" />
			<checksum file="${dist}/${file}"  algorithm="SHA-1"  property="sha1hash"/>

			<local name="hash" />
			<property name="hash"  value="SHA1:${sha1hash}"/>

			<local name="yyyymmdd" />
			<tstamp>
				<format property="yyyymmdd" pattern="yyyy-MM-dd"/>
			</tstamp><commit_msg>build: correct the deletion of JavaHelpSearch directories<commit_after><project name="ZAP-Extensions (Alpha)" default="build-all" basedir=".">
	<description>Build ZAP extensions</description>

	<property name="src" location="../src" />
	<property name="src.version" value="1.7" />
	<property name="build" location="build" />
	<property name="build.lib.dir" location="lib" />
	<property name="temp" location="temp" />
	<property name="dist" location="zap-exts" />
	<property name="dist.lib.dir" location="../lib" />
	<property name="status" value="alpha" />
	<property name="versions.file" location="${dist}/ZapVersions.xml" />
	<property name="wiki.dir" location="../../zap-extensions-wiki" />
	<!-- This assumes you also have the zaproxy project -->
	<property name="zap.plugin.dir" location="../../zaproxy/src/plugin" />
	<!-- This assumes you also have the zaproxy_2.4 project (used for the weekly release -->
	<property name="zap-2.4.plugin.dir" location="../../zaproxy_2.4/src/plugin" />

	<path id="build.classpath">
		   <fileset dir="${build.lib.dir}" includes="*.jar"/>
	</path>

	<!-- Ant task to generate the wiki -->
	<taskdef classpathref="build.classpath" resource="wikitasks.properties" />

	<!-- Ant task to generate JavaHelp search indexes -->
	<taskdef classpathref="build.classpath" resource="javahelptasks.properties" />

	<!-- Ant task to append ZapAddOn.xml files to ZapVersions.xml -->
	<taskdef classpathref="build.classpath" resource="zapversionstasks.properties"/>
	
	<target name="clean">
		<delete dir="${dist}" includeEmptyDirs="true" />
		<delete dir="${build}" includeEmptyDirs="true" />
		<delete dir="${temp}" includeEmptyDirs="true" />
	</target>

	<target name="init">
		<!-- Create the build directory structure used by compile -->
		<mkdir dir="${dist}" />
		<mkdir dir="${build}" />
		<mkdir dir="${temp}" />
	</target>

	<target name="compile" depends="init" description="compile the source">
		<echo message="Compiling the source..." />
		
		<!-- Compile with debug information if the property "javac.debug" is set to true -->
		<local name="debug" />
		<condition property="debug" value="true" else="true">
			<istrue value="${javac.debug}" />
		</condition>

		<property name="debug" value="true" />
		<echo message="Debug = ${debug}" />

		<!-- Compile the java code from ${src} into ${build} -->
		<javac srcdir="${src}" destdir="${build}" source="${src.version}" target="${src.version}" includeantruntime="false" debug="${debug}" encoding="UTF-8">
			<classpath>
				<fileset dir="${dist.lib.dir}">
					<include name="**/*.jar" />
					<include name="**/*.zap" />
				</fileset>
			</classpath>
		</javac>
	</target>

	<macrodef name="generate-wiki" description="Generates the wiki of an add-on into zap-extensions wiki dir">
		<attribute name="addOn"/>
		<sequential>
			<local name="addOnCapitalised" />
			<capitalise name="addOnCapitalised" value="@{addOn}" />

			<xmlproperty file="${src}/org/zaproxy/zap/extension/@{addOn}/ZapAddOn.xml"/>
			<local name="version"/>
			<property name="version" value="${zapaddon.version}" />

			<generatewiki basesrcdir="${src}/org/zaproxy/zap/extension/@{addOn}/resources" basedestdir="${wiki.dir}"
				helpcontentsdir="contents/" helpcontentsinclude=".*\.html"
				srcimagesdir="contents/images/" destimagesdir="images" prefixlinkimages="https://github.com/zaproxy/zap-extensions/wiki/images/"
				outputfilenameprefix="HelpAddons${addOnCapitalised}" includeoutputfiles="HelpAddOns${addOnCapitalised}.*\.md"
				helpfileextension=".html" wikifileextension=".md"
				srctocfile="toc.xml" srcmapfile="map.jhm" wikitocfilename="_Sidebar-${addOnCapitalised}">

				<!-- Default language is at root of dest dir -->
				<helpdir src="help" dest="" />
				<!-- Do not generate for now.
				<helpdir src="help_bs_BA" dest="bs" />
				<helpdir src="help_de_DE" dest="de" />
				<helpdir src="help_el_GR" dest="el" />
				<helpdir src="help_es_ES" dest="es" />
				<helpdir src="help_fa_IR" dest="fa" />
				<helpdir src="help_fr_FR" dest="fr" />
				<helpdir src="help_it_IT" dest="it" />
				<helpdir src="help_ja_JP" dest="ja" />
				<helpdir src="help_pl_PL" dest="pl" />
				<helpdir src="help_pt_BR" dest="pt-BR" />
				<helpdir src="help_ru_RU" dest="ru" /> -->
			</generatewiki>
		</sequential>
	</macrodef>

	<!--
	 Build the specified extension
	 version should be an integer that increments on each release, starting at 1
	 -->

	<macrodef name="build-addon" description="build the specified addon">
		<attribute name="name"/>
		<element name="extra-actions" implicit="true" optional="true" />
		<sequential>
			<local name="zapaddon.version" />
			<xmlproperty file="${src}/org/zaproxy/zap/extension/@{name}/ZapAddOn.xml"/>
			<local name="file" />
			<property name="file" value="@{name}-${status}-${zapaddon.version}.zap" />

			<generatejavahelpsearchindexes jhalljar="${dist.lib.dir}/jhall.jar"
				helpcontentsdirname="contents" helpsetfilename="helpset*.hs">
				<dirset dir="${src}/org/zaproxy/zap/extension/@{name}/resources/">
					<include name="help" />
					<include name="help_*_*" />
				</dirset>
			</generatejavahelpsearchindexes>

			<local name="addon.libs.zip" />
			<property name="addon.libs.zip" value="${temp}/libs-@{name}.zip" />

			<delete file="${addon.libs.zip}" failonerror="true" />
			<zip destfile="${addon.libs.zip}" whenempty="create">
				<zipgroupfileset dir="${src}/org/zaproxy/zap/extension/@{name}/lib/" includes="*.jar" erroronmissingdir="false" />
			</zip>

			<jar jarfile="${dist}/${file}" update="true" compress="true">
				<zipfileset dir="${build}" prefix="">
					<include name="org/zaproxy/zap/extension/@{name}/**"/>
				</zipfileset>
				<zipfileset dir="${src}" prefix="">
					<include name="org/zaproxy/zap/extension/@{name}/Messages*"/>
				</zipfileset>
				<zipfileset dir="${src}" prefix="">
					<include name="org/zaproxy/zap/extension/@{name}/resources/**"/>
				</zipfileset>
				<zipfileset src="${addon.libs.zip}">
					<exclude name="META-INF/*.DSA" />
					<exclude name="META-INF/*.SF" />
				</zipfileset>
				<zipfileset dir="${src}" includes="org/zaproxy/zap/extension/@{name}/ZapAddOn.xml" fullpath="ZapAddOn.xml"/>
			</jar>
			<delete file="${addon.libs.zip}" />

			<!-- Remove search indexes previously generated, no longer needed. -->
			<delete includeemptydirs="true" failonerror="false">
				<fileset dir="${src}/org/zaproxy/zap/extension/@{name}/resources/">
					<include name="help/JavaHelpSearch/**" />
					<include name="help_*_*/JavaHelpSearch/**" />
				</fileset>
			</delete>

			<!-- Include add-on files -->
			<jar jarfile="${dist}/${file}" update="true" compress="true">
				<zipfileset dir="${src}/org/zaproxy/zap/extension/@{name}/files/" prefix="" erroronmissingdir="false" />
			</jar>

			<!-- allow callers to do extra actions before generating the hash and determine the size of the file -->
			<extra-actions />

			<local name="length" />
			<length file="${dist}/${file}" property="length" />

			<local name="sha1hash" />
			<checksum file="${dist}/${file}"  algorithm="SHA-1"  property="sha1hash"/>

			<local name="hash" />
			<property name="hash"  value="SHA1:${sha1hash}"/>

			<local name="yyyymmdd" />
			<tstamp>
				<format property="yyyymmdd" pattern="yyyy-MM-dd"/>
			</tstamp>
{'fraction_non_alphanumeric': 0.20397012034859593, 'fraction_numerical': 0.0020749757919490937, 'mean_word_length': 4.214208438514245, 'pattern_counts': {'":': 0, '<': 285, '<?xml version=': 0, '>': 285, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, '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': '3548472', 'n_tokens_mistral': 5392, 'n_tokens_neox': 4732, 'n_words': 924}