<?xml version="1.0"?>
<!--

    Copyright (c) 2008, 2018 Oracle and/or its affiliates. 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

-->

<!--
 $Id$
-->

<project name="Harness" default="build" >

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

    <target name="clean">
        <delete>
            <fileset dir="${class.dir}">
                <include name="${pkg.dir}/harness/**/*.class"/>
                <include name="${pkg.dir}/util/**/*.class"/>
                <include name="${pkg.dir}/porting/**/*.class"/>
                <include name="${pkg.dir}/deliverable/*.class"/>
                <include name="com/sun/javatest/"/>
                <include name="${pkg.dir}/javatest/"/>
            </fileset>
        </delete>
        <delete dir="${src.dir}/${pkg.dir}/porting/app"/>
        <delete dir="${src.dir}/${pkg.dir}/porting/appclient"/>
        <delete dir="${src.dir}/${pkg.dir}/porting/ejb"/>
        <delete dir="${src.dir}/${pkg.dir}/porting/web"/>
        <delete file="${lib.dir}/tsharness.jar"/>
    </target>

    <target name="compile" >
        <ts.javac includes="${pkg.dir}/harness/**/*.java,
                            ${pkg.dir}/util/**/*.java, 
                            ${pkg.dir}/porting/**/*.java, 
                            ${pkg.dir}/deliverable/*.java,
                            ${pkg.dir}/deliverable/*.java, 
                            ${pkg.dir}/javatest/**/*.java"
                  excludes="${pkg.dir}/porting/TSDeploymentInterface2.java, 
                            ${pkg.dir}/porting/TSDeployment2.java, 
                            ${pkg.dir}/porting/TSJMSObjects*.java">
            <classpath>
                <pathelement path="${lib.dir}/javatest.jar" />
            </classpath>
        </ts.javac>
    </target>

    <target name="build" depends="compile">
        <tstamp/>
        <delete file="${lib.dir}/tsharness.jar" quiet="true"/>

        <mkdir dir="${class.dir}/com/sun/javatest"/>
        <copy file="${src.dir}/${pkg.dir}/javatest/i18n.properties" todir="${class.dir}/${pkg.dir}/javatest"/>

        <ts.lib.jar jarfile="${lib.dir}/tsharness.jar">
            <include name="${pkg.dir}/harness/**/*.class"/>
            <include name="${pkg.dir}/util/**/*.class"/>
            <include name="${pkg.dir}/porting/**/*.class"/>
            <include name="${pkg.dir}/porting/**/jaxb.properties"/>
            <include name="${pkg.dir}/porting/**/bgm.ser"/>
            <include name="${pkg.dir}/porting/**/Messages.properties"/>
            <include name="${pkg.dir}/deliverable/*.class"/>
            <include name="${pkg.dir}/javatest/**/*.class"/>
            <include name="${pkg.dir}/javatest/i18n.properties"/>
            <exclude name="${pkg.dir}/porting/TSDeploymentInterface2*.class"/>
            <exclude name="${pkg.dir}/porting/TSDeployment2*.class"/>
            <exclude name="${pkg.dir}/porting/TSJMSObjects*.class"/>
            <exclude name="${pkg.dir}/harness/ServiceEETest.class"/>
            <exclude name="${pkg.dir}/harness/JCKServiceEETest.class"/>
            <exclude name="${pkg.dir}/harness/EETest*"/>

            <!--<zipfileset dir="." includes="javatest/i18n.properties" prefix="${pkg.dir}"/>-->
            <zipfileset src="${lib.dir}/javatest.jar" includes="com/sun/javatest/Status.class"/>

            <manifest>
               <attribute name="Extension-Name"           value="tsharness"/>
               <attribute name="Specification-Title"      value="tsharness"/>
             </manifest>
        </ts.lib.jar>

        <!--
        <exec dir="${class.dir}" executable="${env.JAVA_HOME}/bin/jar"
              failonerror="true" vmlauncher="true" timeout="600000">
          <arg line="xvf ../lib/javatest.jar com/sun/javatest/lib/TestCases.class com/sun/javatest/lib/TestCases$$Fault.class com/sun/javatest/Test.class com/sun/javatest/lib/MultiTest.class com/sun/javatest/lib/MultiTest$$SetupException.class com/sun/javatest/lib/MultiStatus.class"/>
        </exec>
        -->
        
        <echo message="Core harness library jar, 'tsharness.jar', has been built."/>
    </target>

    <target name="build.all.jars" >
        <ant antfile="build.xml" dir="${bin.dir}" target="build.all.jars" />
    </target>

</project>

