<?xml version='1.0' encoding='ISO-8859-1' ?>
<!--
    $Id$

  Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

  This code is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License version 2 only, as
  published by the Free Software Foundation.  Oracle designates this
  particular file as subject to the "Classpath" exception as provided
  by Oracle in the LICENSE file that accompanied this code.

  This code is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  version 2 for more details (a copy is included in the LICENSE file that
  accompanied this code).

  You should have received a copy of the GNU General Public License version
  2 along with this work; if not, write to the Free Software Foundation,
  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  or visit www.oracle.com if you need additional information or have any
  questions.
    -->
<project name="i18ncheck">

    <patternset id="i18ntest.packages">
	<include name="com/sun/jct/utils/i18ncheck/**"/>
	<exclude name="com/sun/jct/utils/i18ncheck/I18NVisitor15.java"/>
	<exclude name="com/sun/jct/utils/i18ncheck/I18NVisitor16.java"/>
    </patternset>

    <target name="test-i18n" depends="test-i18n-static" description="Runs i18n checking on all JT Harness src"/>
    <target name="test-i18n-static" depends="test-i18n-dynamic">
        <java classname="${test.i18n.static.class}" fork="true" failonerror="true">
            <classpath>
                <path path="${run.classpath}"/>
                <path path="${java.home}/../lib/tools.jar"/>
            </classpath>
            <arg value="-rules"/>
            <arg value="${test.dir}/com/sun/jct/utils/i18ncheck/Rules.xml"/>
            <arg value="-srcDir"/>
            <arg value="${src.dir}/com/sun/javatest/"/>
            <arg value="-merge"/>
            <arg value="-tmp"/>
            <arg value="${build.tmp}/i18ncheck/com/sun/javatest/"/>
            <arg value="-exclude"/>
            <arg value="com/sun/javatest/interview"/>
        </java>
        <java classname="${test.i18n.static.class}" fork="true" failonerror="true">
            <classpath>
                <path path="${run.classpath}"/>
                <path path="${java.home}/../lib/tools.jar"/>
            </classpath>
            <arg value="-rules"/>
            <arg value="${test.dir}/com/sun/jct/utils/i18ncheck/Rules.xml"/>
            <arg value="-srcDir"/>
            <arg value="${src.dir}/com/sun/interview/"/>
            <arg value="-merge"/>
            <arg value="-tmp"/>
            <arg value="${build.tmp}/i18ncheck/com/sun/interview/"/>
        </java>
    </target>
    <target name="test-i18n-dynamic" depends="compile.test.i18n, build-examples">
        <copy file="${exam.dir}/tutorial/simpleTags/demots/lib/demots.jti"
                                                todir="${build.tmp}"/>
        <java classname="${test.i18n.dynamic.class}" fork="true">
            <classpath>
                <path path="${run.classpath}"/>
            </classpath>
            <arg value="${build.tmp}/i18ncheck"/>
            <arg value="${BUILD_DIR}/classes/"/>
            <arg value="${BUILD_DIR}/binaries/examples/tutorial/demots"/>
            <arg value="${build.tmp}/demots_wd"/>
            <arg value="${build.tmp}/demots.jti"/>
	    <arg value="${BUILD_DIR}/binaries/examples/services_ts"/>
	    <arg value="${build.tmp}/services_wd"/>
        </java>
    </target>


    <condition property="jdk6.available">
	<contains string="${java.version}" substring="1.6"/>
    </condition>
    <target name="compile.test.i18n" depends="visitor15.compile, visitor16.compile, dist">
	<mkdir dir="${build.classes}"/>

	<javac encoding="iso-8859-1" debug="true" source="${javac.source.level}" target="${javac.target.level}"
           fork="true" executable="${jdk.builder.home}/bin/javac"
            srcdir="${test.dir}"
            destdir="${build.classes}"
            classpath="${jdk14.classpath}">
            <patternset refid="i18ntest.packages"/>
        </javac>
    </target>
    <target name="visitor15.compile" unless="jdk6.available">
	<mkdir dir="${build.classes}"/>
	<javac encoding="iso-8859-1" debug="true" source="${javac.source.level}" target="${javac.target.level}"
           fork="true" executable="${jdk.builder.home}/bin/javac"
            srcdir="${test.dir}"
            destdir="${build.classes}"
            classpath="${jdk14.classpath}">
	    <include name="com/sun/jct/utils/i18ncheck/I18NVisitor15.java"/>
        </javac>
    </target>
    <target name="visitor16.compile" if="jdk6.available">
	<mkdir dir="${build.classes}"/>
	<javac encoding="iso-8859-1" debug="true" source="${javac.source.level}" target="${javac.target.level}"
           fork="true" executable="${jdk.builder.home}/bin/javac"
            srcdir="${test.dir}"
            destdir="${build.classes}"
            classpath="${jdk14.classpath}">
	    <include name="com/sun/jct/utils/i18ncheck/I18NVisitor16.java"/>
        </javac>
    </target>
</project>
