<project name="org.wso2.carbon.api.migration" default="jar" basedir=".">
    <property name="apim.home" value="/Path_To_AM_Pack_Location"/>
    <property name="class.dir" value="target/classes"/>    

    <target name="help">
        <echo/>
    </target>  
    
  
    <target name="run" depends="jar">
        <java classname="org.wso2.carbon.api.migration.Main" classpathref="javac.classpath"
              fork="true">	              
            <arg value="${apim.home}"/>          
	</java>
    </target>

    <path id="jar.classpath" >
            <pathelement path="${class.dir}"/>               
            <fileset dir="${apim.home}/repository/components/plugins">
                <include name="*.jar"/>
            </fileset>           
    </path>
       
    <target name="init">
        <mkdir dir="${class.dir}"/>
        <manifestclasspath property="tem.classpath" jarfile="pathing.jar">
            <classpath refid="jar.classpath"/>
        </manifestclasspath>
        <jar destfile="pathing.jar" basedir="target\classes">
            <manifest>             
                <attribute name="Class-Path" value="${tem.classpath}"/>
            </manifest>
        </jar>
        <path id="javac.classpath">
            <pathelement path="${class.dir}"/>
            <pathelement path="pathing.jar"/>           
        </path>     
    </target>
 
    <target name="compile" depends="init" description="Compile all Java">
        <javac srcdir="src" destdir="${class.dir}" debug="true">
            <classpath refid="javac.classpath"/>         
          
        </javac>
    </target>

    <target name="clean">
        <delete dir="target" quiet="true"/>
        <delete dir="${class.dir}" quiet="true"/>
    </target>

    <target name="jar" depends="clean, compile">
        <jar jarfile="target/${ant.project.name}-${version}.jar">
            <fileset dir="target/classes">
                <include name="**/*.class"/>
            </fileset>
        </jar>
        <copy file="target/${ant.project.name}-${version}.jar" todir="dist" overwrite="true" />
    </target>
</project>
