<commit_before><project name="selenium" default="dist" xmlns:maven="urn:maven-artifact-ant">

    <property name="version" value="0.8.1-SNAPSHOT"/>

    <target name="all" depends="clean, install-jar, nightly-image"/>
    <target name="all-with-tests" depends="clean, browser_bot_tests, test-allmodes, install-jar, nightly-image"/>

    <property name="resultshandler.path.prefix" value=""/>
    <property name="svnversion.executable" value="svnversion"/>
    <property name="ruby.executable" value="/usr/bin/ruby"/>

    <property name="build.dir" location="build"/>
    <property name="logs.dir" location="logs"/>
    <property name="dist.dir" location="${build.dir}/dist"/>
    <property name="image.dir" location="${build.dir}/image"/>
    <property name="resultshandler.image.dir" location="${build.dir}/resultshandler"/>
    <property name="docs.generation.dir" location="javascript/doctool"/>

    <!-- override to suit your environment -->

    <property name="release.host" value="release.openqa.org"/>
    <property name="release.user" value="release"/>
    <property name="release.dir" value="release.openqa.org/htdocs/selenium-core"/>
    <property name="release.key.file"
              value="${user.home}/.ssh/openqa/release_openqa"/>
    <property name="release.key.passphrase" value=""/>

    <!-- for jsunit integration -->
    <condition property="browserFileNames" value="c:\program files\Mozilla Firefox\firefox.exe">
        <os family="windows"/>
    </condition>
    <condition property="browserFileNames" value="/usr/bin/firefox">
        <os family="unix"/>
    </condition>
    <property name="testRunnerLocation" location="javascript/jsunit/testRunner.html"/>
    <property name="testSuiteLocation" location="javascript/unittest/browserbot/suite.html"/>
    <property name="browserBotTestUrl"
              value="file://${testRunnerLocation}?testPage=${testSuiteLocation}&amp;autoRun=true&amp;submitresults=true"/>
    <property name="port" value=""/>
    <property name="resourceBase" value=""/>
    <property name="logsDirectory" value="${logs.dir}"/>

    <target name="clean">
        <delete dir="${build.dir}"/>
        <delete dir="${logs.dir}"/>
    </target>

    <target name="get-svn-revision">
        <exec executable="${svnversion.executable}" outputProperty="svn-revision" failOnError="true">
            <arg value="."/>
        </exec>
        <echo message="Got svn revision: ${svn-revision}"/>
    </target>

    <target name="copy-sources">
        <mkdir dir="${image.dir}"/>
        <property name="svn-revision" value="unknown-revision"/>
        <copy todir="${image.dir}">
            <fileset dir="javascript">
                <exclude name="doctool"/>
                <exclude name="doctool/**"/>
                <exclude name="core/scripts/selenium-version.js"/>
                <exclude name="VERSION.txt"/>                
                <exclude name="tests/**"/>
            </fileset>
        </copy>
        <copy todir="${image.dir}">
            <fileset dir="javascript">
                <include name="core/scripts/selenium-version.js"/>
                <include name="VERSION.txt"/>
            </fileset>
            <filterset>
                <filter token="VERSION" value="${version}"/>
                <filter token="REVISION" value="${svn-revision}"/>
            </filterset>
        </copy>
        <copy file="${image.dir}/core/TestRunner.html" tofile="${image.dir}/core/TestRunner.hta"/>
    </target>

    <target name="generate-xml" depends="copy-sources">
        <java jar="${docs.generation.dir}/js.jar" output="${image.dir}/doc.xml" failonerror="true" fork="true">
            <arg file="${docs.generation.dir}/doc.js"/>
            <arg file="javascript/core/scripts/selenium-api.js"/>
        </java>
        <xmlvalidate file="${image.dir}/doc.xml" lenient="true"/>
        <copy file="${image.dir}/doc.xml" tofile="${image.dir}/core/iedoc.xml" overwrite="true"/>
        <copy file="${image.dir}/doc.xml" tofile="${image.dir}/core/iedoc-core.xml" overwrite="true"/>
    </target>

    <target name="generate-doc" depends="generate-xml">
        <xslt in="${image.dir}/doc.xml" out="${image.dir}/reference.html" style="${docs.generation.dir}/doc2html.xml"/>
    </target>

    <target name="image" depends="get-svn-revision, copy-sources, generate-doc"/>

    <target name="browser_bot_tests"
            description="Runs JsUnit tests on the local machine as configured by the url and browserfilenames properties">
        <junit showoutput="true" errorproperty="tests.failed" failureproperty="tests.failed">
            <classpath>
                <fileset dir="java/lib">
                    <include name="*.jar"/>
                </fileset>
            </classpath>
            <sysproperty key="browserFileNames" value="${browserFileNames}"/>
            <sysproperty key="url" value="${browserBotTestUrl}"/>
            <sysproperty key="port" value="${port}"/>
            <sysproperty key="resourceBase" value="${resourceBase}"/>
            <sysproperty key="logsDirectory" value="${logsDirectory}"/>
            <test name="net.jsunit.StandaloneTest"/>
        </junit>
        <junitreport todir="${logs.dir}">
            <fileset dir="${logs.dir}"/>
            <report format="frames" todir="${logs.dir}" />
        </junitreport>
        <fail if="tests.failed" message="JSUnit tests failed, see output for details: ${logs.dir}" />
    </target>

    <target name="test-allmodes">
        <property name="allmodes.target" value="test-allbrowsers" />
        
        <antcall target="${allmodes.target}">
            <param name="slowResources" value="false" />
            <param name="multiWindow" value="true" />
        </antcall>
        <antcall target="${allmodes.target}">
            <param name="slowResources" value="false" />
            <param name="multiWindow" value="false" />
        </antcall>
        <antcall target="${allmodes.target}">
            <param name="slowResources" value="true" />
            <param name="multiWindow" value="true" />
        </antcall>
        <antcall target="${allmodes.target}">
            <param name="slowResources" value="true" />
            <param name="multiWindow" value="false" />
        </antcall>
    </target>
    
    <target name="test-allbrowsers" depends="firefoxTests, iexploreTests, operaTests, chromeTests" />
    
    <target name="iexploreTests" depends="selenese-task, checkWindows" if="thisIsWindows">
        <preset-selenese taskname="iexplore" browser="*iexplore" />
    </target>
    
    <target name="konqTests" depends="selenese-task, checkUnix" if="thisIsUnix">
        <preset-selenese taskname="konqueror" browser="*konqueror" />
    </target>
    
    <target name="firefoxTests" depends="selenese-task, image">
        <preset-selenese taskname="firefox" browser="*firefox" />
    </target>
    
    <target name="chromeTests" depends="selenese-task, image" unless="skipChrome">
        <preset-selenese taskname="chrome" browser="*chrome" />
    </target>
    
    <target name="operaTests" depends="selenese-task, image">
        <preset-selenese taskname="opera" browser="*opera" />
    </target>

    <target name="htaTests" depends="image, checkWindows" if="thisIsWindows">
        <echo message="Starting HTA tests..."/>
        <property name="results.file" location="${build.dir}/results.html"/>
        <delete file="${results.file}"/>
        <delete file="${results.file}"/><commit_msg>Allow overrideable opera location<commit_after><project name="selenium" default="dist" xmlns:maven="urn:maven-artifact-ant">

    <property name="version" value="0.8.1-SNAPSHOT"/>

    <target name="all" depends="clean, install-jar, nightly-image"/>
    <target name="all-with-tests" depends="clean, browser_bot_tests, test-allmodes, install-jar, nightly-image"/>

    <property name="resultshandler.path.prefix" value=""/>
    <property name="svnversion.executable" value="svnversion"/>
    <property name="ruby.executable" value="/usr/bin/ruby"/>

    <property name="build.dir" location="build"/>
    <property name="logs.dir" location="logs"/>
    <property name="dist.dir" location="${build.dir}/dist"/>
    <property name="image.dir" location="${build.dir}/image"/>
    <property name="resultshandler.image.dir" location="${build.dir}/resultshandler"/>
    <property name="docs.generation.dir" location="javascript/doctool"/>

    <!-- override to suit your environment -->

    <property name="release.host" value="release.openqa.org"/>
    <property name="release.user" value="release"/>
    <property name="release.dir" value="release.openqa.org/htdocs/selenium-core"/>
    <property name="release.key.file"
              value="${user.home}/.ssh/openqa/release_openqa"/>
    <property name="release.key.passphrase" value=""/>

    <!-- for jsunit integration -->
    <condition property="browserFileNames" value="c:\program files\Mozilla Firefox\firefox.exe">
        <os family="windows"/>
    </condition>
    <condition property="browserFileNames" value="/usr/bin/firefox">
        <os family="unix"/>
    </condition>
    <property name="testRunnerLocation" location="javascript/jsunit/testRunner.html"/>
    <property name="testSuiteLocation" location="javascript/unittest/browserbot/suite.html"/>
    <property name="browserBotTestUrl"
              value="file://${testRunnerLocation}?testPage=${testSuiteLocation}&amp;autoRun=true&amp;submitresults=true"/>
    <property name="port" value=""/>
    <property name="resourceBase" value=""/>
    <property name="logsDirectory" value="${logs.dir}"/>

    <target name="clean">
        <delete dir="${build.dir}"/>
        <delete dir="${logs.dir}"/>
    </target>

    <target name="get-svn-revision">
        <exec executable="${svnversion.executable}" outputProperty="svn-revision" failOnError="true">
            <arg value="."/>
        </exec>
        <echo message="Got svn revision: ${svn-revision}"/>
    </target>

    <target name="copy-sources">
        <mkdir dir="${image.dir}"/>
        <property name="svn-revision" value="unknown-revision"/>
        <copy todir="${image.dir}">
            <fileset dir="javascript">
                <exclude name="doctool"/>
                <exclude name="doctool/**"/>
                <exclude name="core/scripts/selenium-version.js"/>
                <exclude name="VERSION.txt"/>                
                <exclude name="tests/**"/>
            </fileset>
        </copy>
        <copy todir="${image.dir}">
            <fileset dir="javascript">
                <include name="core/scripts/selenium-version.js"/>
                <include name="VERSION.txt"/>
            </fileset>
            <filterset>
                <filter token="VERSION" value="${version}"/>
                <filter token="REVISION" value="${svn-revision}"/>
            </filterset>
        </copy>
        <copy file="${image.dir}/core/TestRunner.html" tofile="${image.dir}/core/TestRunner.hta"/>
    </target>

    <target name="generate-xml" depends="copy-sources">
        <java jar="${docs.generation.dir}/js.jar" output="${image.dir}/doc.xml" failonerror="true" fork="true">
            <arg file="${docs.generation.dir}/doc.js"/>
            <arg file="javascript/core/scripts/selenium-api.js"/>
        </java>
        <xmlvalidate file="${image.dir}/doc.xml" lenient="true"/>
        <copy file="${image.dir}/doc.xml" tofile="${image.dir}/core/iedoc.xml" overwrite="true"/>
        <copy file="${image.dir}/doc.xml" tofile="${image.dir}/core/iedoc-core.xml" overwrite="true"/>
    </target>

    <target name="generate-doc" depends="generate-xml">
        <xslt in="${image.dir}/doc.xml" out="${image.dir}/reference.html" style="${docs.generation.dir}/doc2html.xml"/>
    </target>

    <target name="image" depends="get-svn-revision, copy-sources, generate-doc"/>

    <target name="browser_bot_tests"
            description="Runs JsUnit tests on the local machine as configured by the url and browserfilenames properties">
        <junit showoutput="true" errorproperty="tests.failed" failureproperty="tests.failed">
            <classpath>
                <fileset dir="java/lib">
                    <include name="*.jar"/>
                </fileset>
            </classpath>
            <sysproperty key="browserFileNames" value="${browserFileNames}"/>
            <sysproperty key="url" value="${browserBotTestUrl}"/>
            <sysproperty key="port" value="${port}"/>
            <sysproperty key="resourceBase" value="${resourceBase}"/>
            <sysproperty key="logsDirectory" value="${logsDirectory}"/>
            <test name="net.jsunit.StandaloneTest"/>
        </junit>
        <junitreport todir="${logs.dir}">
            <fileset dir="${logs.dir}"/>
            <report format="frames" todir="${logs.dir}" />
        </junitreport>
        <fail if="tests.failed" message="JSUnit tests failed, see output for details: ${logs.dir}" />
    </target>

    <target name="test-allmodes">
        <property name="allmodes.target" value="test-allbrowsers" />
        
        <antcall target="${allmodes.target}">
            <param name="slowResources" value="false" />
            <param name="multiWindow" value="true" />
        </antcall>
        <antcall target="${allmodes.target}">
            <param name="slowResources" value="false" />
            <param name="multiWindow" value="false" />
        </antcall>
        <antcall target="${allmodes.target}">
            <param name="slowResources" value="true" />
            <param name="multiWindow" value="true" />
        </antcall>
        <antcall target="${allmodes.target}">
            <param name="slowResources" value="true" />
            <param name="multiWindow" value="false" />
        </antcall>
    </target>
    
    <target name="test-allbrowsers" depends="firefoxTests, iexploreTests, operaTests, chromeTests" />
    
    <target name="iexploreTests" depends="selenese-task, checkWindows" if="thisIsWindows">
        <preset-selenese taskname="iexplore" browser="*iexplore" />
    </target>
    
    <target name="konqTests" depends="selenese-task, checkUnix" if="thisIsUnix">
        <preset-selenese taskname="konqueror" browser="*konqueror" />
    </target>
    
    <target name="firefoxTests" depends="selenese-task, image">
        <preset-selenese taskname="firefox" browser="*firefox" />
    </target>
    
    <target name="chromeTests" depends="selenese-task, image" unless="skipChrome">
        <preset-selenese taskname="chrome" browser="*chrome" />
    </target>
    
    <target name="operaTests" depends="selenese-task, image">
        <property name="opera.browser" value="*opera" />
        <preset-selenese taskname="opera" browser="${opera.browser}" />
    </target>

    <target name="htaTests" depends="image, checkWindows" if="thisIsWindows">
        <echo message="Starting HTA tests..."/>
        <property name="results.file" location="${build.dir}/results.html"/>
        <delete file="${results.file}"/>
        <delete file="${results.file}"/>
{'fraction_non_alphanumeric': 0.1778721709696688, 'fraction_numerical': 0.0005309617043870711, 'mean_word_length': 2.9331767162620728, 'pattern_counts': {'":': 0, '<': 282, '<?xml version=': 0, '>': 282, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 24}, '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': '1248864', 'n_tokens_mistral': 4450, 'n_tokens_neox': 4307, 'n_words': 761}