<?xml version="1.0" encoding="UTF-8"?>
<project name="priority-queue" default="all">


  <property file="priority-queue.properties"/>
  <!-- Uncomment the following property if no tests compilation is needed -->
  <!--
  <property name="skip.tests" value="true"/>
   -->

  <!-- Compiler options -->

  <property name="compiler.debug" value="on"/>
  <property name="compiler.generate.no.warnings" value="off"/>
  <property name="compiler.args" value=""/>
  <property name="compiler.max.memory" value="128m"/>
  <patternset id="ignored.files">
    <exclude name="**/CVS/**"/>
    <exclude name="**/SCCS/**"/>
    <exclude name="**/RCS/**"/>
    <exclude name="**/rcs/**"/>
    <exclude name="**/.DS_Store/**"/>
    <exclude name="**/.svn/**"/>
    <exclude name="**/.pyc/**"/>
    <exclude name="**/.pyo/**"/>
    <exclude name="**/*.pyc/**"/>
    <exclude name="**/*.pyo/**"/>
    <exclude name="**/.git/**"/>
    <exclude name="**/*.hprof/**"/>
    <exclude name="**/_svn/**"/>
    <exclude name="**/.hg/**"/>
    <exclude name="**/*.lib/**"/>
    <exclude name="**/*~/**"/>
    <exclude name="**/__pycache__/**"/>
    <exclude name="**/.bundle/**"/>
    <exclude name="**/*.rbc/**"/>
    <exclude name="**/*.orig/**"/>
  </patternset>
  <patternset id="library.patterns">
    <include name="*.zip"/>
    <include name="*.apk"/>
    <include name="*.war"/>
    <include name="*.egg"/>
    <include name="*.ear"/>
    <include name="*.swc"/>
    <include name="*.jar"/>
  </patternset>
  <patternset id="compiler.resources">
    <include name="**/?*.properties"/>
    <include name="**/?*.xml"/>
    <include name="**/?*.gif"/>
    <include name="**/?*.png"/>
    <include name="**/?*.jpeg"/>
    <include name="**/?*.jpg"/>
    <include name="**/?*.html"/>
    <include name="**/?*.dtd"/>
    <include name="**/?*.tld"/>
    <include name="**/?*.ftl"/>
    <include name="**/?*.htm"/>
    <include name="**/?*.jsp"/>
    <include name="**/?*.js"/>
    <include name="**/?*.css"/>
  </patternset>

  <!-- JDK definitions -->

  <property name="jdk.bin.1.5" value="${jdk.home.1.5}/bin"/>
  <path id="jdk.classpath.1.5">
    <fileset dir="${jdk.home.1.5}">
      <include name="jre/lib/javaws.jar"/>
      <include name="jre/lib/deploy.jar"/>
      <include name="jre/lib/jsse.jar"/>
      <include name="jre/lib/charsets.jar"/>
      <include name="jre/lib/plugin.jar"/>
      <include name="jre/lib/resources.jar"/>
      <include name="jre/lib/alt-string.jar"/>
      <include name="jre/lib/alt-rt.jar"/>
      <include name="jre/lib/management-agent.jar"/>
      <include name="jre/lib/jce.jar"/>
      <include name="jre/lib/rt.jar"/>
      <include name="jre/lib/ext/dnsns.jar"/>
      <include name="jre/lib/ext/sunpkcs11.jar"/>
      <include name="jre/lib/ext/sunjce_provider.jar"/>
      <include name="jre/lib/ext/localedata.jar"/>
    </fileset>
  </path>

  <property name="project.jdk.home" value="${jdk.home.1.5}"/>
  <property name="project.jdk.bin" value="${jdk.bin.1.5}"/>
  <property name="project.jdk.classpath" value="jdk.classpath.1.5"/>


  <!-- Project Libraries -->

  <path id="library.jdom.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/jdom.jar"/>
  </path>

  <path id="library.jmock.classpath">
    <pathelement location="${basedir}/lib/jmock-2.5.1/bsh-core-2.0b4.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/cglib-2.1_3-src.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/cglib-nodep-2.1_3.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/hamcrest-core-1.3.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/hamcrest-library-1.3.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/jmock-2.5.1.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/jmock-junit3-2.5.1.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/jmock-junit4-2.5.1.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/jmock-legacy-2.5.1.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/jmock-script-2.5.1.jar"/>
    <pathelement location="${basedir}/lib/jmock-2.5.1/objenesis-1.0.jar"/>
  </path>

  <path id="library.log4j.classpath">
    <pathelement location="${basedir}/lib/log4j-1.2-api-2.17.2.jar"/>
    <pathelement location="${basedir}/lib/log4j-api-2.17.2.jar"/>
    <pathelement location="${basedir}/lib/log4j-core-2.17.2.jar"/>
  </path>

  <path id="library.teamcity_closed_api_common.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/common-impl.jar"/>
  </path>

  <path id="library.teamcity_closed_api_server.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/server.jar"/>
  </path>

  <path id="library.teamcity_open_api_common.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/devPackage/serviceMessages.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/devPackage/common-api.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/devPackage/runtime/runtime-util.jar"/>
  </path>

  <path id="library.teamcity_open_api_server.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/devPackage/server-api.jar"/>
  </path>

  <path id="library.teamcity_tests_support.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/devPackage/tests/tests-support.jar"/>
  </path>

  <path id="library.teamcity_third-party.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/annotations.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/openapi.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/spring-security.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/spring-webmvc.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/spring.jar"/>
    <pathelement location="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib/util.jar"/>
  </path>

  <path id="library.testng.classpath">
    <pathelement location="${basedir}/lib/testng-5.11-jdk15.jar"/>
  </path>

  <path id="library.tomcat.classpath">
    <pathelement location="${path.variable.teamcitydistribution}/lib/servlet-api.jar"/>
  </path>

  <path id="library.trove4j.classpath">
    <pathelement location="${basedir}/lib/trove4j.jar"/>
  </path>
  <!-- Register Custom Compiler Taskdefs -->
  <property name="javac2.home" value="${idea.home}/lib"/>
  <path id="javac2.classpath">
    <pathelement location="${javac2.home}/javac2.jar"/>
    <pathelement location="${javac2.home}/jdom.jar"/>
    <pathelement location="${javac2.home}/asm.jar"/>
    <pathelement location="${javac2.home}/asm-commons.jar"/>
    <pathelement location="${javac2.home}/jgoodies-forms.jar"/>
  </path>
  <target name="register.custom.compilers">
    <taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
    <taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions" classpathref="javac2.classpath"/>
  </target>

  <!-- Modules -->


  <!-- Module priority-queue-server -->

  <dirname property="module.priority-queue-server.basedir" file="${ant.file}"/>


  <property name="module.jdk.home.priority-queue-server" value="${project.jdk.home}"/>
  <property name="module.jdk.bin.priority-queue-server" value="${project.jdk.bin}"/>
  <property name="module.jdk.classpath.priority-queue-server" value="${project.jdk.classpath}"/>

  <property name="compiler.args.priority-queue-server" value="${compiler.args}"/>

  <property name="priority-queue-server.output.dir" value="${module.priority-queue-server.basedir}/out/production/priority-queue-server"/>
  <property name="priority-queue-server.testoutput.dir" value="${module.priority-queue-server.basedir}/out/test/priority-queue-server"/>

  <path id="priority-queue-server.module.bootclasspath">
    <!-- Paths to be included in compilation bootclasspath -->
  </path>

  <path id="priority-queue-server.module.production.classpath">
    <path refid="${module.jdk.classpath.priority-queue-server}"/>
    <path refid="library.tomcat.classpath"/>
    <path refid="library.teamcity_open_api_server.classpath"/>
    <path refid="library.teamcity_open_api_common.classpath"/>
    <path refid="library.teamcity_third-party.classpath"/>
    <path refid="library.teamcity_closed_api_common.classpath"/>
    <path refid="library.teamcity_closed_api_server.classpath"/>
    <path refid="library.jmock.classpath"/>
    <path refid="library.testng.classpath"/>
    <path refid="library.trove4j.classpath"/>
    <path refid="library.log4j.classpath"/>
    <path refid="library.jdom.classpath"/>
  </path>

  <path id="priority-queue-server.runtime.production.module.classpath">
    <pathelement location="${priority-queue-server.output.dir}"/>
    <path refid="library.tomcat.classpath"/>
    <path refid="library.teamcity_open_api_server.classpath"/>
    <path refid="library.teamcity_open_api_common.classpath"/>
    <path refid="library.teamcity_third-party.classpath"/>
    <path refid="library.teamcity_closed_api_common.classpath"/>
    <path refid="library.teamcity_closed_api_server.classpath"/>
    <path refid="library.jmock.classpath"/>
    <path refid="library.testng.classpath"/>
    <path refid="library.trove4j.classpath"/>
    <path refid="library.log4j.classpath"/>
    <path refid="library.jdom.classpath"/>
  </path>

  <path id="priority-queue-server.module.classpath">
    <path refid="${module.jdk.classpath.priority-queue-server}"/>
    <pathelement location="${priority-queue-server.output.dir}"/>
    <path refid="library.tomcat.classpath"/>
    <path refid="library.teamcity_open_api_server.classpath"/>
    <path refid="library.teamcity_open_api_common.classpath"/>
    <path refid="library.teamcity_third-party.classpath"/>
    <path refid="library.teamcity_closed_api_common.classpath"/>
    <path refid="library.teamcity_closed_api_server.classpath"/>
    <path refid="library.jmock.classpath"/>
    <path refid="library.testng.classpath"/>
    <path refid="library.trove4j.classpath"/>
    <path refid="library.log4j.classpath"/>
    <path refid="library.jdom.classpath"/>
    <path refid="library.teamcity_tests_support.classpath"/>
  </path>

  <path id="priority-queue-server.runtime.module.classpath">
    <pathelement location="${priority-queue-server.testoutput.dir}"/>
    <pathelement location="${priority-queue-server.output.dir}"/>
    <path refid="library.tomcat.classpath"/>
    <path refid="library.teamcity_open_api_server.classpath"/>
    <path refid="library.teamcity_open_api_common.classpath"/>
    <path refid="library.teamcity_third-party.classpath"/>
    <path refid="library.teamcity_closed_api_common.classpath"/>
    <path refid="library.teamcity_closed_api_server.classpath"/>
    <path refid="library.jmock.classpath"/>
    <path refid="library.testng.classpath"/>
    <path refid="library.trove4j.classpath"/>
    <path refid="library.log4j.classpath"/>
    <path refid="library.jdom.classpath"/>
    <path refid="library.teamcity_tests_support.classpath"/>
  </path>


  <patternset id="excluded.from.module.priority-queue-server">
    <patternset refid="ignored.files"/>
  </patternset>

  <patternset id="excluded.from.compilation.priority-queue-server">
    <patternset refid="excluded.from.module.priority-queue-server"/>
  </patternset>

  <path id="priority-queue-server.module.sourcepath">
    <dirset dir="${module.priority-queue-server.basedir}/server">
      <include name="src"/>
      <include name="resources"/>
    </dirset>
  </path>

  <path id="priority-queue-server.module.test.sourcepath">
    <dirset dir="${module.priority-queue-server.basedir}/server">
      <include name="test"/>
    </dirset>
  </path>


  <target name="compile.module.priority-queue-server" depends="compile.module.priority-queue-server.production,compile.module.priority-queue-server.tests" description="Compile module priority-queue-server"/>

  <target name="compile.module.priority-queue-server.production" depends="register.custom.compilers" description="Compile module priority-queue-server; production classes">
    <mkdir dir="${priority-queue-server.output.dir}"/>
    <javac2 destdir="${priority-queue-server.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.priority-queue-server}/javac" target="1.5">
      <compilerarg line="${compiler.args.priority-queue-server}"/>
      <bootclasspath refid="priority-queue-server.module.bootclasspath"/>
      <classpath refid="priority-queue-server.module.production.classpath"/>
      <src refid="priority-queue-server.module.sourcepath"/>
      <patternset refid="excluded.from.compilation.priority-queue-server"/>
    </javac2>

    <copy todir="${priority-queue-server.output.dir}">
      <fileset dir="${module.priority-queue-server.basedir}/server/src">
        <patternset refid="compiler.resources"/>
        <type type="file"/>
      </fileset>
      <fileset dir="${module.priority-queue-server.basedir}/server/resources">
        <patternset refid="compiler.resources"/>
        <type type="file"/>
      </fileset>
    </copy>
  </target>

  <target name="compile.module.priority-queue-server.tests" depends="register.custom.compilers,compile.module.priority-queue-server.production" description="compile module priority-queue-server; test classes" unless="skip.tests">
    <mkdir dir="${priority-queue-server.testoutput.dir}"/>
    <javac2 destdir="${priority-queue-server.testoutput.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.priority-queue-server}/javac" target="1.5">
      <compilerarg line="${compiler.args.priority-queue-server}"/>
      <bootclasspath refid="priority-queue-server.module.bootclasspath"/>
      <classpath refid="priority-queue-server.module.classpath"/>
      <src refid="priority-queue-server.module.test.sourcepath"/>
      <patternset refid="excluded.from.compilation.priority-queue-server"/>
    </javac2>

    <copy todir="${priority-queue-server.testoutput.dir}">
      <fileset dir="${module.priority-queue-server.basedir}/server/test">
        <patternset refid="compiler.resources"/>
        <type type="file"/>
      </fileset>
    </copy>
  </target>

  <target name="clean.module.priority-queue-server" description="cleanup module">
    <delete dir="${priority-queue-server.output.dir}"/>
    <delete dir="${priority-queue-server.testoutput.dir}"/>
  </target>

  <target name="init" description="Build initialization">
    <!-- Perform any build initialization in this target -->
  </target>

  <target name="clean" depends="clean.module.priority-queue-server" description="cleanup all"/>

  <target name="build.modules" depends="init, clean, compile.module.priority-queue-server" description="build all modules"/>

  <target name="all" depends="build.modules" description="build all"/>
</project>
