<!--

    Copyright (c) 2018, 2020 Oracle and/or its affiliates and others.
    All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<project name="Servlet 5.0 TCK" default="usage">

    <!-- IMPORTS -->
    <import file="xml/ts.top.import.xml" optional="true"/>
    <import file="../../../bin/xml/ts.top.import.xml" optional="true"/>

    <property name="all.test.dir" value="
              com/sun/ts/tests/servlet/api,
              com/sun/ts/tests/servlet/compat,
              com/sun/ts/tests/servlet/pluggability,
              com/sun/ts/tests/servlet/spec,
              com/sun/ts/tests/signaturetest/servlet"/>

    <target name="build.all.tests" >
        <echo message="Test Dirs:${all.test.dir}"/>
        <dosubdirs srcdir="${ts.home}/src" includes="${all.test.dir}" todo="build"
                excludes="com/sun/ts/tests/servlet/ee/**/*"/>
    </target>

    <target name="translatepath">
        <translatepath propname="web.home"/>
    </target>


    <!-- 
         this is used to setup the webserver to support running of security
         tests which are contained in com/sun/ts/tests/servlet/spec/security
      -->
    <target name="config.security" >
        <ant antfile="s1as.xml" dir="${ts.home}/bin/xml/impl/${impl.vi}" 
             target="add.cts.users"/>            
        <ant antfile="s1as.xml" dir="${ts.home}/bin/xml/impl/${impl.vi}" 
             target="add.cert"/>
    </target>


    <target name="deploy.all" description="Deploy all archives.">
        <echo message="javaee.level: ${javaee.level}" />
        <property name="pkg.dir" value="com/sun/ts/tests/servlet"/>
        <ant antfile="build.xml" dir="${ts.home}/src/com/sun/ts/tests/servlet" target="deploy"/>
    </target>

    <target name="tslib.clean" depends="translatepath">
        <delete failonerror="false">
            <fileset dir="${class.dir}">
                <include name="${lib.pkg.dir}/deliverable/servlet/**"/>
                <include name="${lib.pkg.dir}/deliverable/tck/**"/>
                <include name="${provider.dir}/"/>
            </fileset>
        </delete>
        <delete failonerror="false" file="${lib.dir}/${tslib.name}.jar"/>
    </target>

    <target name="tslib.compile" depends="tslib.clean, bind.dtds">
        <ts.javac 
                includes="${lib.pkg.dir}/deliverable/servlet/**,
                  ${lib.pkg.dir}/deliverable/tck/**,
                  ${lib.pkg.dir}/porting/**/*.java,
                  ${lib.pkg.dir}/implementation/sun/common/**,
                  ${lib.pkg.dir}/implementation/sun/javaee/SunRIHttpsURLConnection.java,
                  ${provider.dir}/**,
                  com/sun/ts/tests/common/vehicle/VehicleClient.java,
                  com/sun/ts/tests/common/vehicle/VehicleRunnerFactory.java,
                  com/sun/ts/tests/common/vehicle/EmptyVehicleRunner.java,
                  com/sun/ts/tests/common/vehicle/VehicleRunnable.java"
                excludes="${lib.pkg.dir}/implementation/sun/javaee/SunRIDeploy**,
                  ${lib.pkg.dir}/porting/TSJMS*.java,
        ${lib.pkg.dir}/porting/TSDeployment*.java">
            <classpath>
                <pathelement path="${ts.lib.classpath}" />
            </classpath>
        </ts.javac>
    </target>


    <target name="tslib" depends="tslib.compile">
        <tstamp/>
        <delete failonerror="true" file="${lib.dir}/${tslib.name}.jar"/>
        <ts.lib.jar>
            <include name="${lib.pkg.dir}/deliverable/servlet/**"/>
            <include name="${lib.pkg.dir}/deliverable/tck/**"/>
            <include name="${lib.pkg.dir}/implementation/sun/common/**"/>
            <include name="${lib.pkg.dir}/implementation/sun/javaee/**"/>
            <include name="com/sun/ts/tests/common/vehicle/VehicleClient.class"/>
            <include name="com/sun/ts/tests/common/vehicle/VehicleRunnerFactory.class"/>
            <include name="com/sun/ts/tests/common/vehicle/EmptyVehicleRunner.class"/>
            <include name="com/sun/ts/tests/common/vehicle/VehicleRunnable.class"/>
        </ts.lib.jar>
    </target>

</project>

