<commit_before><!--
    Inject eXist as a Cocoon block into the Cocoon source distribution.
    Execute this script with

    build.sh -f build/scripts/cocoon/build.xml

    BEFORE compiling Cocoon.

    Based on the original exist-as-block distribution created by
    <NAME> (http://heml.mta.ca)
-->
<project name="exist_block" default="all" basedir=".">

    <property file="build.properties"/>

    <property name="exist.home" value="../.."/>

    <property name="cocoon.libs" value="${cocoon.home}/lib"/>
    <property name="cocoon.blocks" value="${cocoon.home}/src/blocks"/>
    <property name="cocoon.tasks" value="${cocoon.home}/tools/anttasks"/>

    <property name="exist.deploy" value="${cocoon.blocks}/exist"/>

    <property name="backup.dir" value="backup"/>

    <available file="${cocoon.home}" property="cocoon.present"/>

    <target name="all" if="cocoon.present" depends="check-cocoon">
        <echo message="-----------------------------------------------"/>
        <echo message="Preparing eXist as Cocoon block"/>
        <echo message="-----------------------------------------------"/>
        <echo message="Cocoon directory: ${cocoon.home}"/>
        <echo message="Installing block into: ${exist.deploy}"/>
 
        <antcall target="prepare"/>

        <echo message="-----------------------------------------------"/>
        <echo message="Cocoon has been prepared. You may now change to"/>
        <echo message="${cocoon.home}"/>
        <echo message="and call build.sh or build.bat to build Cocoon."/>
    </target>

    <target description="Prepare the src/blocks/exist directory, copy jars and patch cocoon files"
            name="prepare" depends="prepare-dirs, xpatch_gump, xpatch_jars">
        <mkdir dir="${backup.dir}"/>
        <mkdir dir="${exist.deploy}"/>
        <mkdir dir="${exist.deploy}/conf"/>
        <mkdir dir="${exist.deploy}/java"/>
        <mkdir dir="${exist.deploy}/samples"/>
        <mkdir dir="${exist.deploy}/WEB-INF"/>
        <mkdir dir="${exist.deploy}/WEB-INF/data"/>
        <mkdir dir="${exist.deploy}/WEB-INF/data/journal"/>
        <mkdir dir="${exist.deploy}/WEB-INF/exist-samples"/>
        <mkdir dir="${exist.deploy}/WEB-INF/entities"/>
    </target>

    <target description="Prepare the src/blocks/exist directory"
            name="prepare-dirs" depends="prepare-conf,copy-jars, prepare-samples"/>

    <target description="Copy configuration files"
            name="prepare-conf">
        <copy todir="${exist.deploy}/conf">
            <fileset dir=".">
                <include name="*.xweb"/>
                <include name="*.xsamples"/>
                <include name="*.xconf"/>
                <include name="*.xmap"/>
            </fileset>
        </copy>
        <xslt in="${exist.home}/conf.xml"  out="${exist.deploy}/WEB-INF/conf.xml"
              style="../dist-war-conf.xsl"/>
    </target>

    <target description="Copy jars" name="copy-jars">
        <!-- Delete conflicting jars from Cocoon lib dir -->
        <delete file="${cocoon.home}/lib/optional/xmldb-api-20030701.jar"/>
        <delete file="${cocoon.home}/lib/optional/xmldb-common-20030701.jar"/>
        <delete file="${cocoon.home}/lib/optional/xmldb-xupdate-20040205.jar"/>
        <delete file="${cocoon.home}/lib/optional/xmlrpc-1.1.jar"/>
        <delete file="${cocoon.home}/lib/core/log4j-1.2.14.jar"/>
        <delete file="${cocoon.home}/lib/optional/antlr-2.7.6.jar"/>
        <delete file="${cocoon.home}/lib/optional/commons-pool-1.2.jar"/>
        <delete file="${cocoon.home}/lib/optional/lucene-1.4.3.jar"/>

        <!-- Copy eXist jars to Cocoon lib dir -->
        <copy todir="${cocoon.libs}/endorsed" overwrite="yes">
            <fileset dir="${exist.home}/lib/core">
                <include name="stax*.jar"/>
            </fileset>
        </copy>
        <copy todir="${cocoon.libs}/optional" overwrite="yes">
            <fileset dir="${exist.home}">
                <include name="exist.jar"/>
                <include name="exist-optional.jar"/>
                <include name="exist-modules.jar"/>
                <include name="start.jar"/>
            </fileset>
            <fileset dir="${exist.home}/lib/endorsed">
                <include name="resolver*.jar"/>
            </fileset>
            <fileset dir="${exist.home}/lib/core">
                <include name="xmlrpc*.jar"/>
                <include name="xmldb.jar"/>
                <include name="jline*.jar"/>
                <include name="jEdit-syntax*.jar"/>
                <include name="jgroups-all*.jar"/>
                <include name="excalibur-cli*.jar"/>
                <include name="commons-pool*.jar"/>
                <include name="antlr*.jar"/>
            </fileset>
            <fileset dir="${exist.home}/lib/optional">
                <include name="commons-fileupload*.jar"/>
            </fileset>
            <fileset dir="${exist.home}/lib/extensions">
                <include name="exist-modules.jar"/>
                <include name="exist-lucene-module.jar"/>
                <include name="exist-ngram-module.jar"/>
                <include name="exist-versioning.jar"/>
                <include name="xprocxq.jar"/>
            </fileset>
        </copy>
        <copy todir="${cocoon.libs}/optional" overwrite="yes">
            <fileset dir="${exist.home}/extensions/indexes/lucene/lib">
                <include name="lucene-core-2.4.1.jar"/>
                <include name="lucene-regex-2.4.1.jar"/>
            </fileset>
        </copy>
        <copy todir="${cocoon.libs}/core" overwrite="yes">
            <fileset dir="${exist.home}/lib/core">
                <include name="log4j*.jar"/>
            </fileset>
        </copy>
        <copy todir="${exist.deploy}/samples/WEB-INF/exist-samples">
            <fileset dir="${exist.home}/samples">
            </fileset>
        </copy>
        <copy todir="${exist.deploy}/samples/WEB-INF">
        	<fileset dir="${exist.home}/webapp/WEB-INF">
        		<include name="catalog.xml"/>
        	</fileset>
        </copy>
        <copy todir="${exist.deploy}/samples/WEB-INF/entities">
        	<fileset dir="${exist.home}/webapp/WEB-INF/entities">
        		<include name="*.dtd"/>
        		<include name="*.xsd"/>
        	</fileset>
        </copy>
    </target>

    <target description="Patch the main gump.xml in Cocoon" name="xpatch_gump">
        <copy todir="${backup.dir}" file="${cocoon.home}/gump.xml" overwrite="yes"/>
        <xslt in="${backup.dir}/gump.xml" out="${cocoon.home}/gump.xml" style="exist-gump.xsl"/>
    </target>

    <target description="Patch lib/jars.xml in Cocoon" name="xpatch_jars">
        <copy file="${cocoon.home}/lib/jars.xml" todir="${backup.dir}" overwrite="yes"/>
        <xslt in="${backup.dir}/jars.xml" out="${cocoon.home}/lib/jars.xml" style="exist-jars.xsl"/>
    </target>

    <target description="Copy eXist's webapp dir to samples" name="copy-samples">
        <copy todir="${exist.deploy}/samples">
            <fileset dir="${exist.home}/webapp">
                <exclude name="WEB-INF/**"/>
            </fileset><commit_msg>[ignore] added missing jars to cocoon build script<commit_after><!--
    Inject eXist as a Cocoon block into the Cocoon source distribution.
    Execute this script with

    build.sh -f build/scripts/cocoon/build.xml

    BEFORE compiling Cocoon.

    Based on the original exist-as-block distribution created by
    <NAME> (http://heml.mta.ca)
-->
<project name="exist_block" default="all" basedir=".">

    <property file="build.properties"/>

    <property name="exist.home" value="../.."/>

    <property name="cocoon.libs" value="${cocoon.home}/lib"/>
    <property name="cocoon.blocks" value="${cocoon.home}/src/blocks"/>
    <property name="cocoon.tasks" value="${cocoon.home}/tools/anttasks"/>

    <property name="exist.deploy" value="${cocoon.blocks}/exist"/>

    <property name="backup.dir" value="backup"/>

    <available file="${cocoon.home}" property="cocoon.present"/>

    <target name="all" if="cocoon.present" depends="check-cocoon">
        <echo message="-----------------------------------------------"/>
        <echo message="Preparing eXist as Cocoon block"/>
        <echo message="-----------------------------------------------"/>
        <echo message="Cocoon directory: ${cocoon.home}"/>
        <echo message="Installing block into: ${exist.deploy}"/>
 
        <antcall target="prepare"/>

        <echo message="-----------------------------------------------"/>
        <echo message="Cocoon has been prepared. You may now change to"/>
        <echo message="${cocoon.home}"/>
        <echo message="and call build.sh or build.bat to build Cocoon."/>
    </target>

    <target description="Prepare the src/blocks/exist directory, copy jars and patch cocoon files"
            name="prepare" depends="prepare-dirs, xpatch_gump, xpatch_jars">
        <mkdir dir="${backup.dir}"/>
        <mkdir dir="${exist.deploy}"/>
        <mkdir dir="${exist.deploy}/conf"/>
        <mkdir dir="${exist.deploy}/java"/>
        <mkdir dir="${exist.deploy}/samples"/>
        <mkdir dir="${exist.deploy}/WEB-INF"/>
        <mkdir dir="${exist.deploy}/WEB-INF/data"/>
        <mkdir dir="${exist.deploy}/WEB-INF/data/journal"/>
        <mkdir dir="${exist.deploy}/WEB-INF/exist-samples"/>
        <mkdir dir="${exist.deploy}/WEB-INF/entities"/>
    </target>

    <target description="Prepare the src/blocks/exist directory"
            name="prepare-dirs" depends="prepare-conf,copy-jars, prepare-samples"/>

    <target description="Copy configuration files"
            name="prepare-conf">
        <copy todir="${exist.deploy}/conf">
            <fileset dir=".">
                <include name="*.xweb"/>
                <include name="*.xsamples"/>
                <include name="*.xconf"/>
                <include name="*.xmap"/>
            </fileset>
        </copy>
        <xslt in="${exist.home}/conf.xml"  out="${exist.deploy}/WEB-INF/conf.xml"
              style="../dist-war-conf.xsl"/>
    </target>

    <target description="Copy jars" name="copy-jars">
        <!-- Delete conflicting jars from Cocoon lib dir -->
        <delete file="${cocoon.home}/lib/optional/xmldb-api-20030701.jar"/>
        <delete file="${cocoon.home}/lib/optional/xmldb-common-20030701.jar"/>
        <delete file="${cocoon.home}/lib/optional/xmldb-xupdate-20040205.jar"/>
        <delete file="${cocoon.home}/lib/optional/xmlrpc-1.1.jar"/>
        <delete file="${cocoon.home}/lib/core/log4j-1.2.14.jar"/>
        <delete file="${cocoon.home}/lib/optional/antlr-2.7.6.jar"/>
        <delete file="${cocoon.home}/lib/optional/commons-pool-1.2.jar"/>
        <delete file="${cocoon.home}/lib/optional/lucene-1.4.3.jar"/>

        <!-- Copy eXist jars to Cocoon lib dir -->
        <copy todir="${cocoon.libs}/endorsed" overwrite="yes">
            <fileset dir="${exist.home}/lib/core">
                <include name="stax*.jar"/>
            </fileset>
        </copy>
        <copy todir="${cocoon.libs}/optional" overwrite="yes">
            <fileset dir="${exist.home}">
                <include name="exist.jar"/>
                <include name="exist-optional.jar"/>
                <include name="exist-modules.jar"/>
                <include name="start.jar"/>
            </fileset>
            <fileset dir="${exist.home}/lib/endorsed">
                <include name="resolver*.jar"/>
            </fileset>
            <fileset dir="${exist.home}/lib/core">
                <include name="xmlrpc*.jar"/>
                <include name="xmldb.jar"/>
                <include name="jline*.jar"/>
                <include name="jEdit-syntax*.jar"/>
                <include name="jgroups-all*.jar"/>
                <include name="excalibur-cli*.jar"/>
                <include name="commons-pool*.jar"/>
                <include name="antlr*.jar"/>
                <include name="ws-commons-util*.jar"/>
                <include name="sunxacml*.jar"/>
            </fileset>
            <fileset dir="${exist.home}/lib/optional">
                <include name="commons-fileupload*.jar"/>
            </fileset>
            <fileset dir="${exist.home}/lib/extensions">
                <include name="exist-modules.jar"/>
                <include name="exist-lucene-module.jar"/>
                <include name="exist-ngram-module.jar"/>
                <include name="exist-versioning.jar"/>
                <include name="xprocxq.jar"/>
            </fileset>
        </copy>
        <copy todir="${cocoon.libs}/optional" overwrite="yes">
            <fileset dir="${exist.home}/extensions/indexes/lucene/lib">
                <include name="lucene-core-2.4.1.jar"/>
                <include name="lucene-regex-2.4.1.jar"/>
            </fileset>
        </copy>
        <copy todir="${cocoon.libs}/core" overwrite="yes">
            <fileset dir="${exist.home}/lib/core">
                <include name="log4j*.jar"/>
            </fileset>
        </copy>
        <copy todir="${exist.deploy}/samples/WEB-INF/exist-samples">
            <fileset dir="${exist.home}/samples">
            </fileset>
        </copy>
        <copy todir="${exist.deploy}/samples/WEB-INF">
        	<fileset dir="${exist.home}/webapp/WEB-INF">
        		<include name="catalog.xml"/>
        	    <include name="controller-config.xml"/>
        	</fileset>
        </copy>
        <copy todir="${exist.deploy}/samples/WEB-INF/entities">
        	<fileset dir="${exist.home}/webapp/WEB-INF/entities">
        		<include name="*.dtd"/>
        		<include name="*.xsd"/>
        	</fileset>
        </copy>
    </target>

    <target description="Patch the main gump.xml in Cocoon" name="xpatch_gump">
        <copy todir="${backup.dir}" file="${cocoon.home}/gump.xml" overwrite="yes"/>
        <xslt in="${backup.dir}/gump.xml" out="${cocoon.home}/gump.xml" style="exist-gump.xsl"/>
    </target>

    <target description="Patch lib/jars.xml in Cocoon" name="xpatch_jars">
        <copy file="${cocoon.home}/lib/jars.xml" todir="${backup.dir}" overwrite="yes"/>
        <xslt in="${backup.dir}/jars.xml" out="${cocoon.home}/lib/jars.xml" style="exist-jars.xsl"/>
    </target>

    <target description="Copy eXist's webapp dir to samples" name="copy-samples">
        <copy todir="${exist.deploy}/samples">
            <fileset dir="${exist.home}/webapp">
                <exclude name="WEB-INF/**"/>
            </fileset>
{'fraction_non_alphanumeric': 0.20250536369298913, 'fraction_numerical': 0.0063672226451657555, 'mean_word_length': 2.078397954835961, 'pattern_counts': {'":': 0, '<': 274, '<?xml version=': 0, '>': 274, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 37}, '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': '7033506', 'n_tokens_mistral': 4518, 'n_tokens_neox': 4163, 'n_words': 748}