<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="getreport" basedir="../"
         xmlns:jsl="antlib:com.googlecode.jslint4java"> <!-- 配置信息 10.48.31.90:8089-->
    <property name="serverip" value="10.48.31.90:8089"/>
    <property name="report.path" value="_test/tools/br/report_"/>
    <property name="coverage.path" value="_test/coverage"/>
    <property name="report.file" value="_test/tools/br/report.html"/>
    <property name="svn.project" value="ueditor_svn"/>
    <property name="git.project" value="ueditor"/>

    <property name="git.user" value=""/>
    <path id="ext.classpath">
        <fileset dir="_test/tools/lib">
            <include name="**/*.jar"/>
        </fileset>
    </path>
    <taskdef uri="antlib:com.googlecode.jslint4java" classpathref="ext.classpath"
             resource="com/googlecode/jslint4java/antlib.xml"/>

    <target name="init">
        <delete dir="${report.path}"/>
        <delete file="${report.file}"/>
    </target>

    <target name="coverage">
        <delete dir="${coverage.path}"/>
        <exec executable="/home/ueditor/jscoverage/bin/jscoverage">
            <arg value="--encoding=UTF-8"/>
            <arg value="_src"/>
            <arg value="${coverage.path}"/>
        </exec>
    </target>

    <!--<target name="jslint" description="Run the JSLint tool on JS files">-->
    <!--<fileset dir="_src" id="jsfiles.raw">-->
    <!--<include name="*.js"/>-->
    <!--&lt;!&ndash;<exclude name="**/*.min.js" />&ndash;&gt;-->
    <!--</fileset>-->
    <!--<pathconvert pathsep=" " property="jsfiles.clean" refid="jsfiles.raw" />-->
    <!--<exec executable="java" output="build/logs/jslint.xml">-->
    <!--<arg line="-jar jslint4java.jar -report xml ${jsfiles.clean}" />-->
    <!--</exec>-->
    <!--</target>-->
    <target name="jslint">
        <!-- jslint 任务的配置如下 ,options 是用户自定义规则-->
        <jsl:jslint options="undef=true, white=true, eqeq=true,nomen=true,sloppy=true" haltOnFailure="false">
            <!--formatter plain, 没有 destfile 则表示输出到控制台 -->
            <formatter type="plain"/>
            <!-- formatter report 表示输出成 html 格式的 report-->
            <formatter type="junit" destfile="_test/tools/br/jslint"/>
            <formatter type="report" destfile="_test/tools/br/jslint.html"/>
            <!-- 通过指定 fileset 设置要进行检测的 JavaScript 文件集 -->
            <fileset dir="_src" includes="**/*.js"/>
        </jsl:jslint>
    </target>
    <!--<target name="jslint">-->
    <!--<formatter type="plain" destfile="_test/tools/br/jslint.out"/>-->
    <!--<fileset dir="_src" id="jsfiles.raw">-->
    <!--<include name="*.js"/>-->
    <!--</fileset>-->
    <!--</target>-->

    <target name="executeAll" depends="init,coverage">
        <get src="http://${serverip}/${git.project}/_test/tools/br/runall.php?ci=true&amp;cov=true"
             dest="/tmp/${git.user}_${git.project}.php"/>
    </target>
    <target name="getreportAll" depends="init,coverage,executeAll">
        <waitfor maxwait="3000" maxwaitunit="second">
            <available file="${report.file}"/>
        </waitfor>
        <waitfor maxwait="10" maxwaitunit="second">
            <istrue value="false"/>
        </waitfor>
    </target>

    <target name="executeIE" depends="init,coverage">
        <get src="http://${serverip}/${git.project}IE/_test/tools/br/runall.php?ci=true&amp;cov=true&amp;browserSet=ie6_ie7_ie8_ie9"
             dest="/tmp/${git.user}_${git.project}IE.php"/>
    </target>
    <target name="getreportIE" depends="init,coverage,executeIE">
        <waitfor maxwait="3000" maxwaitunit="second">
            <available file="${report.file}"/>
        </waitfor>
        <waitfor maxwait="10" maxwaitunit="second">
            <istrue value="false"/>
        </waitfor>
    </target>

<!--    <target name="executeExceptIE6" depends="init,coverage">
        <get src="http://${serverip}/${svn.project}ExceptIE6/_test/tools/br/runall.php?ci=true&amp;cov=true&amp;browserSet=chrome_firefox_opera_360ie7_360ie8_safari"
             dest="/tmp/${git.user}_${svn.project}ExceptIE6.php"/>
    </target>
    <target name="getreportExceptIE6" depends="init,coverage,executeExceptIE6">
        <waitfor maxwait="3000" maxwaitunit="second">
            <available file="${report.file}"/>
        </waitfor>
        <waitfor maxwait="10" maxwaitunit="second">
            <istrue value="false"/>
        </waitfor>
    </target>-->
</project>