<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->


<!--
Build file for Rhino using Ant (see http://jakarta.apache.org/ant/index.html)
Requires Ant version 1.2
-->
<project name="src" default="compile" basedir="..">

  <property file="build.properties"/>

  <available property="jdk15"
             classname="java.lang.reflect.ParameterizedType" />

  <target name="compile" depends="compile-most,compile-jdk15">
  </target>

  <target name="shell" depends="compile">
    <java classname="org.mozilla.javascript.tools.shell.Main"
          classpath="${classes}"
          fork="true">
      <arg line="-version 170"/>
    </java>
  </target>

  <target name="compile-most">
    <javac srcdir="src"
           destdir="${classes}"
           includes="org/**/*.java"
           excludes="org/**/jdk15/*.java"
           deprecation="on"
           debug="${debug}"
           includeAntRuntime="false"
           encoding="UTF-8"
           target="${target-jvm}"
           source="${source-level}" />
    <copy todir="${classes}">
      <fileset dir="src" includes="org/**/*.properties" />
      <filterset>
      <filter token="IMPLEMENTATION.VERSION"
              value="${implementation.version}"/>
      </filterset>
    </copy>
  </target>

  <target name="compile-jdk15" if="jdk15">
    <javac srcdir="src"
           destdir="${classes}"
           includes="org/**/jdk15/*.java"
           deprecation="on"
           debug="${debug}"
           includeAntRuntime="false"
           encoding="UTF-8"
           target="${target-jvm}"
           source="${source-level}" />
  </target>

  <target name="copy-source">
    <mkdir dir="${dist.dir}/src"/>
    <copy todir="${dist.dir}/src">
      <fileset dir="src"
               includes="**/*.java,**/*.properties,**/*.xml,manifest"/>
    </copy>
  </target>

  <target name="clean">
    <delete includeEmptyDirs="true">
      <fileset dir="${classes}"
               excludes="org/mozilla/javascript/tools/**"/>
    </delete>
  </target>

</project>
