<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
  ~ Copyright 2000-2013 JetBrains s.r.o.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<project basedir="." default="deploy" name="clearcase-agent">

    <property file="clearcase-common.properties" />

    <property environment="env" />
    <property name="debuglevel" value="source,lines,vars" />
    <property name="target" value="1.5" />
    <property name="source" value="1.5" />

    <path id="THIRDPARTY_LIBS.userclasspath">
        <fileset dir="lib">
            <include name="**/*.jar" />
        </fileset>
    </path>

    <path id="TC_AGENT_LIBS.userclasspath">
        <fileset dir="${path.variable.teamcitydistribution}/buildAgent">
            <include name="**/*.jar" />
        </fileset>
    </path>
    
    <path id="TC_DISTR.userclasspath">
        <fileset dir="${path.variable.teamcitydistribution}/webapps/ROOT/WEB-INF/lib">
            <include name="**/*.jar" />
        </fileset>
    </path>
    
    <path id="SERVERSIDE.userclasspath">
        <dirset dir="${clearcase-standalone.output.dir}" />
    </path>
    
    <path id="clearcase-common.classpath">
        <pathelement location="classes" />
        <path refid="TC_DISTR.userclasspath" />
        <path refid="SERVERSIDE.userclasspath" />
    </path>
    
    <target name="init" depends="clean">
        <mkdir dir="classes" />
        <copy includeemptydirs="false" todir="classes">
            <fileset dir="src">
                <exclude name="**/*.launch" />
                <exclude name="**/*.java" />
            </fileset>
        </copy>
    </target>
    
    <target name="clean">
        <delete dir="bin" quiet="true"/>
        <delete dir="${tmp.path}" quiet="true" />
    </target>
    
    <target depends="clean" name="cleanall" />

    <target name="deploy" depends="build">
        <jar destfile="${dist}/${product.name}.jar">
            <fileset dir="classes" />
        </jar>
    </target>

    <target depends="init" name="build">
        <echo message="${ant.project.name}: ${ant.file}" />
        <javac debug="true" debuglevel="${debuglevel}" destdir="classes" source="${source}" target="${target}">
            <src path="src" />
            <classpath refid="clearcase-common.classpath" />
        </javac>
    </target>

</project>
