<!-- Copyright (c) 2011, the Dart project authors.  Please see the AUTHORS file
     for details. All rights reserved. Use of this source code is governed by a
     BSD-style license that can be found in the LICENSE file. -->

<project name="dartserver" default="build">
  <!--
    Configuration properties.
  -->
  <property name="third_party.dir" value="../../../third_party"/>
  <property name="dartserver.dir" value="${build.dir}/dartserver"/>

  <path id="dartserver.classpath">
  </path>

  <target name="build_utils" description="builds libutil.jar">
    <mkdir dir="${dartserver.dir}/classes" />
    <javac srcdir="java" destdir="${dartserver.dir}/classes" source="1.6"
        includes="com/google/appstack/tools/*.java">
      <classpath>
        <fileset dir="${third_party.dir}/appengine-java-sdk/1.5.1/lib/user">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${third_party.dir}/jetty/7.4.4.v20110707/lib">
          <include name="*.jar" />
        </fileset>
      </classpath>
    </javac>
    <jar destfile="${dartserver.dir}/libutil.jar">
      <fileset dir="${dartserver.dir}/classes">
        <include name="com/google/appstack/tools/*.class" />
      </fileset>
    </jar>
  </target>

  <target name="build" depends="build_utils">
    <mkdir dir="${dartserver.dir}/classes" />
    <javac srcdir="java" destdir="${dartserver.dir}/classes" source="1.6"
        includes="com/google/appstack/tools/dartserver/*.java" debug="true">
      <classpath>
        <fileset dir="${third_party.dir}/appengine-java-sdk/1.5.1/lib/user">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${third_party.dir}/jetty/7.4.4.v20110707/lib">
          <include name="*.jar" />
        </fileset>
        <fileset dir="${build.dir}/compiler/lib">
          <include name="**/*.jar" />
        </fileset>
        <fileset file="${dartserver.dir}/libutil.jar" />
      </classpath>
    </javac>
    <jar destfile="${dartserver.dir}/dartserver.jar" manifest="dartserver.mf">
      <fileset dir="${dartserver.dir}/classes">
        <include name="com/google/appstack/tools/dartserver/*.class" />
      </fileset>
    </jar>
  </target>

  <target name="clean">
    <delete dir="${dartserver.dir}" />
  </target>
</project>
