<commit_before><!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<project name="mcf-connector-build">

    <import file="../common-build.xml"/>
    
    <target name="clean">
        <delete dir="build"/>
        <delete dir="dist"/>
        <delete dir="test-derby-output"/>
        <delete dir="test-postgresql-output"/>
        <delete dir="test-mysql-output"/>
        <delete dir="test-HSQLDB-output"/>
        <delete dir="test-HSQLDBext-output"/>
    </target>

    <path id="mcf-connector-build.connector-classpath">
        <fileset dir="../../build/jar">
            <include name="json.jar"/>
        </fileset>
        <fileset dir="../../lib">
            <include name="commons-codec*.jar"/>
            <include name="commons-collections*.jar"/>
            <include name="commons-el*.jar"/>
            <include name="commons-fileupload*.jar"/>
            <include name="commons-httpclient-mcf.jar"/>
            <include name="commons-io*.jar"/>
            <include name="commons-lang*.jar"/>
            <include name="commons-logging*.jar"/>
            <include name="eclipse*.jar"/>
            <include name="jasper*.jar"/>
            <include name="jetty*.jar"/>
            <include name="jdbcpool-0.99.jar"/>
            <include name="jsp-2.1*.jar"/>
            <include name="jsp-api*.jar"/>
            <include name="junit*.jar"/>
            <include name="log4j*.jar"/>
            <include name="serializer*.jar"/>
            <include name="servlet-api*.jar"/>
            <include name="tomcat-juli*.jar"/>
            <include name="xalan*.jar"/>
            <include name="xercesImpl-mcf.jar"/>
            <include name="xml-apis*.jar"/>
            <include name="velocity*.jar"/>
        </fileset>
        <fileset dir="../../lib">
            <include name="axis*.jar"/>
            <include name="saaj*.jar"/>
            <include name="wsdl*.jar"/>
            <include name="commons-discovery*.jar"/>
            <include name="activation*.jar"/>
        </fileset>
        <fileset dir="../../lib">
            <include name="castor*.jar"/>
            <include name="geronimo-activation_1.1_spec*.jar"/>
            <include name="geronimo-javamail_1.4_spec*.jar"/>
            <include name="commons-discovery*.jar"/>
        </fileset>
        <fileset dir="../../framework/build/jar"/>
        <pathelement location="build/wsdlclasses"/>
        <pathelement location="build/xsdclasses"/>
        <pathelement location="build/interface/classes"/>
        <pathelement location="build/rmistub/classes"/>
    </path>
    
    <path id="connector-classpath">
        <path refid="mcf-connector-build.connector-classpath"/>
    </path>

    <path id="mcf-connector-build.connector-test-classpath">
        <path refid="connector-classpath"/>
        <pathelement location="build/connector/classes"/>
        <fileset dir="../../framework/build/test-jar"/>
        <fileset dir="../../lib">
            <include name="postgresql*.jar"/>
            <include name="derby*.jar"/>
            <include name="hsqldb*.jar"/>
        </fileset>
        <fileset dir="../../lib-proprietary">
            <include name="mysql*.jar"/>
        </fileset>
    </path>

    <path id="connector-test-classpath">
        <path refid="mcf-connector-build.connector-test-classpath"/>
    </path>

    <path id="mcf-connector-build.implementation-classpath">
        <pathelement location="build/interface/classes"/>
    </path>

    <path id="implementation-classpath">
        <path refid="mcf-connector-build.implementation-classpath"/>
    </path>

    <path id="mcf-connector-build.interface-classpath">
    </path>

    <path id="interface-classpath">
        <path refid="mcf-connector-build.interface-classpath"/>
    </path>

    <target name="calculate-condition">
        <available file="build.xml" property="canBuild"/>
    </target>

    <target name="calculate-testcode-condition" depends="calculate-condition" if="canBuild">
        <available file="connector/src/test/java" property="canTest"/>
    </target>

    <target name="precompile-check" depends="calculate-condition" unless="canBuild"/>

    <target name="pretest-check" depends="calculate-testcode-condition" unless="canTest"/>

    <target name="has-tests-check" depends="precompile-check" if="canBuild">
        <available file="connector/src/test/java" property="hasTests"/>
    </target>

    <target name="has-test-resources-check" depends="has-tests-check" if="hasTests">
        <available file="connector/src/test/resources" property="hasTestResources"/>
    </target>

    <target name="has-native2ascii-check" depends="precompile-check" if="canBuild">
        <available file="connector/src/main/native2ascii" property="hasNative2Ascii"/>
    </target>

    <target name="has-resources-check" depends="precompile-check" if="canBuild">
        <available file="connector/src/main/resources" property="hasResources"/>
    </target>

    <target name="has-RMI-check" depends="precompile-check" if="canBuild">
        <available file="implementation" property="hasImplementation"/>
        <available file="interface" property="hasInterface"/>
        <available file="server" property="hasServer"/>
        <available file="registry" property="hasRegistry"/>
        <condition property="hasRMI">
            <and>
                <isset property="hasImplementation"/>
                <isset property="hasInterface"/>
                <isset property="hasServer"/>
                <isset property="hasRegistry"/>
            </and>
        </condition>
    </target>
    
    <target name="classcreate-wsdl">
        <mkdir dir="build/wsdljava"/>
        <java classname="org.apache.axis.wsdl.WSDL2Java" fork="true">
            <classpath>
                <fileset dir="../../lib">
                    <include name="axis*.jar"/>
                    <include name="saaj*.jar"/>
                    <include name="wsdl*.jar"/>
                    <include name="activation*.jar"/>
                    <include name="commons-discovery*.jar"/>
                    <include name="commons-logging*.jar"/>
                </fileset>
            </classpath>
            <arg value="--timeout"/>
            <arg value="0"/>
            <arg value="--noImports"/>
            <arg value="-o"/>
            <arg value="build/wsdljava"/>
            <arg value="${wsdlname}"/>
        </java>
    </target>

    <target name="classcreate-xsd">
        <mkdir dir="build/xsdjava"/>
        <java classname="org.exolab.castor.builder.SourceGeneratorMain" fork="true">
            <classpath>
                <fileset dir="../../lib">
                    <include name="castor*.jar"/>
                    <include name="geronimo-activation_1.1_spec*.jar"/>
                    <include name="geronimo-javamail_1.4_spec*.jar"/>
                    <include name="xerces*.jar"/>
                    <include name="commons-logging*.jar"/>
                </fileset>
            </classpath>
            <arg value="-i"/>
            <arg value="${xsdname}"/>
            <arg value="=f"/>
            <arg value="-dest"/>
            <arg value="build/xsdjava"/>
            <arg value="-package"/>
            <arg value="org.apache.manifoldcf.crawler.connectors.${packagename}"/>
        </java>
    </target>

    <target name="classcreate-wsdls"/>

    <target name="has-wsdls-check" depends="classcreate-wsdls,precompile-check" if="canBuild">
        <available file="build/wsdljava" property="hasWSDLs"/>
    </target>

    <target name="compile-wsdls" depends="has-wsdls-check" if="hasWSDLs">
        <mkdir dir="build/wsdlclasses"/>
        <javac srcdir="build/wsdljava" destdir="build/wsdlclasses" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
            <classpath>
                <fileset dir="../../lib">
                    <include name="axis*.jar"/>
                    <include name="saaj*.jar"/><commit_msg>Modify invocation of axis to specify file encoding, since Japanese encoding seems to cause it to fail.<commit_after><!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<project name="mcf-connector-build">

    <import file="../common-build.xml"/>
    
    <target name="clean">
        <delete dir="build"/>
        <delete dir="dist"/>
        <delete dir="test-derby-output"/>
        <delete dir="test-postgresql-output"/>
        <delete dir="test-mysql-output"/>
        <delete dir="test-HSQLDB-output"/>
        <delete dir="test-HSQLDBext-output"/>
    </target>

    <path id="mcf-connector-build.connector-classpath">
        <fileset dir="../../build/jar">
            <include name="json.jar"/>
        </fileset>
        <fileset dir="../../lib">
            <include name="commons-codec*.jar"/>
            <include name="commons-collections*.jar"/>
            <include name="commons-el*.jar"/>
            <include name="commons-fileupload*.jar"/>
            <include name="commons-httpclient-mcf.jar"/>
            <include name="commons-io*.jar"/>
            <include name="commons-lang*.jar"/>
            <include name="commons-logging*.jar"/>
            <include name="eclipse*.jar"/>
            <include name="jasper*.jar"/>
            <include name="jetty*.jar"/>
            <include name="jdbcpool-0.99.jar"/>
            <include name="jsp-2.1*.jar"/>
            <include name="jsp-api*.jar"/>
            <include name="junit*.jar"/>
            <include name="log4j*.jar"/>
            <include name="serializer*.jar"/>
            <include name="servlet-api*.jar"/>
            <include name="tomcat-juli*.jar"/>
            <include name="xalan*.jar"/>
            <include name="xercesImpl-mcf.jar"/>
            <include name="xml-apis*.jar"/>
            <include name="velocity*.jar"/>
        </fileset>
        <fileset dir="../../lib">
            <include name="axis*.jar"/>
            <include name="saaj*.jar"/>
            <include name="wsdl*.jar"/>
            <include name="commons-discovery*.jar"/>
            <include name="activation*.jar"/>
        </fileset>
        <fileset dir="../../lib">
            <include name="castor*.jar"/>
            <include name="geronimo-activation_1.1_spec*.jar"/>
            <include name="geronimo-javamail_1.4_spec*.jar"/>
            <include name="commons-discovery*.jar"/>
        </fileset>
        <fileset dir="../../framework/build/jar"/>
        <pathelement location="build/wsdlclasses"/>
        <pathelement location="build/xsdclasses"/>
        <pathelement location="build/interface/classes"/>
        <pathelement location="build/rmistub/classes"/>
    </path>
    
    <path id="connector-classpath">
        <path refid="mcf-connector-build.connector-classpath"/>
    </path>

    <path id="mcf-connector-build.connector-test-classpath">
        <path refid="connector-classpath"/>
        <pathelement location="build/connector/classes"/>
        <fileset dir="../../framework/build/test-jar"/>
        <fileset dir="../../lib">
            <include name="postgresql*.jar"/>
            <include name="derby*.jar"/>
            <include name="hsqldb*.jar"/>
        </fileset>
        <fileset dir="../../lib-proprietary">
            <include name="mysql*.jar"/>
        </fileset>
    </path>

    <path id="connector-test-classpath">
        <path refid="mcf-connector-build.connector-test-classpath"/>
    </path>

    <path id="mcf-connector-build.implementation-classpath">
        <pathelement location="build/interface/classes"/>
    </path>

    <path id="implementation-classpath">
        <path refid="mcf-connector-build.implementation-classpath"/>
    </path>

    <path id="mcf-connector-build.interface-classpath">
    </path>

    <path id="interface-classpath">
        <path refid="mcf-connector-build.interface-classpath"/>
    </path>

    <target name="calculate-condition">
        <available file="build.xml" property="canBuild"/>
    </target>

    <target name="calculate-testcode-condition" depends="calculate-condition" if="canBuild">
        <available file="connector/src/test/java" property="canTest"/>
    </target>

    <target name="precompile-check" depends="calculate-condition" unless="canBuild"/>

    <target name="pretest-check" depends="calculate-testcode-condition" unless="canTest"/>

    <target name="has-tests-check" depends="precompile-check" if="canBuild">
        <available file="connector/src/test/java" property="hasTests"/>
    </target>

    <target name="has-test-resources-check" depends="has-tests-check" if="hasTests">
        <available file="connector/src/test/resources" property="hasTestResources"/>
    </target>

    <target name="has-native2ascii-check" depends="precompile-check" if="canBuild">
        <available file="connector/src/main/native2ascii" property="hasNative2Ascii"/>
    </target>

    <target name="has-resources-check" depends="precompile-check" if="canBuild">
        <available file="connector/src/main/resources" property="hasResources"/>
    </target>

    <target name="has-RMI-check" depends="precompile-check" if="canBuild">
        <available file="implementation" property="hasImplementation"/>
        <available file="interface" property="hasInterface"/>
        <available file="server" property="hasServer"/>
        <available file="registry" property="hasRegistry"/>
        <condition property="hasRMI">
            <and>
                <isset property="hasImplementation"/>
                <isset property="hasInterface"/>
                <isset property="hasServer"/>
                <isset property="hasRegistry"/>
            </and>
        </condition>
    </target>
    
    <target name="classcreate-wsdl">
        <mkdir dir="build/wsdljava"/>
        <java classname="org.apache.axis.wsdl.WSDL2Java" fork="true">
            <classpath>
                <fileset dir="../../lib">
                    <include name="axis*.jar"/>
                    <include name="saaj*.jar"/>
                    <include name="wsdl*.jar"/>
                    <include name="activation*.jar"/>
                    <include name="commons-discovery*.jar"/>
                    <include name="commons-logging*.jar"/>
                </fileset>
            </classpath>
            <jvmarg value="-Dfile.encoding=ASCII"/>
            <arg value="--timeout"/>
            <arg value="0"/>
            <arg value="--noImports"/>
            <arg value="-o"/>
            <arg value="build/wsdljava"/>
            <arg value="${wsdlname}"/>
        </java>
    </target>

    <target name="classcreate-xsd">
        <mkdir dir="build/xsdjava"/>
        <java classname="org.exolab.castor.builder.SourceGeneratorMain" fork="true">
            <classpath>
                <fileset dir="../../lib">
                    <include name="castor*.jar"/>
                    <include name="geronimo-activation_1.1_spec*.jar"/>
                    <include name="geronimo-javamail_1.4_spec*.jar"/>
                    <include name="xerces*.jar"/>
                    <include name="commons-logging*.jar"/>
                </fileset>
            </classpath>
            <jvmarg value="-Dfile.encoding=ASCII"/>
            <arg value="-i"/>
            <arg value="${xsdname}"/>
            <arg value="=f"/>
            <arg value="-dest"/>
            <arg value="build/xsdjava"/>
            <arg value="-package"/>
            <arg value="org.apache.manifoldcf.crawler.connectors.${packagename}"/>
        </java>
    </target>

    <target name="classcreate-wsdls"/>

    <target name="has-wsdls-check" depends="classcreate-wsdls,precompile-check" if="canBuild">
        <available file="build/wsdljava" property="hasWSDLs"/>
    </target>

    <target name="compile-wsdls" depends="has-wsdls-check" if="hasWSDLs">
        <mkdir dir="build/wsdlclasses"/>
        <javac srcdir="build/wsdljava" destdir="build/wsdlclasses" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
            <classpath>
                <fileset dir="../../lib">
                    <include name="axis*.jar"/>
                    <include name="saaj*.jar"/>
{'fraction_non_alphanumeric': 0.16318158509486638, 'fraction_numerical': 0.00307674776366019, 'mean_word_length': 2.258819160787226, 'pattern_counts': {'":': 0, '<': 359, '<?xml version=': 0, '>': 359, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, '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': '6694043', 'n_tokens_mistral': 4918, 'n_tokens_neox': 4742, 'n_words': 951}