<project name="org.wso2.carbon.registry.migration" default="jar" basedir=".">
    <property name="registry.home" value="/Path_To_AM_Pack_Location"/>
    <property name="username" value="xxxx"/>
    <property name="password" value="xxxx"/>
    <property name="host" value="localhost"/>
    <property name="port" value="9443"/>
    <property name="version" value="1.7.0"/>
    <property name="class.dir" value="target/classes"/>
    

    <target name="help">
        <echo/>
    </target>  
    
  
    <target name="run" depends="jar">
        <java classname="org.wso2.carbon.registry.migration.Main" classpathref="javac.classpath"
              fork="true">
	    <sysproperty key="carbon.home"  value="${registry.home}"/>
            <arg value="-ch" />
            <arg value="${registry.home}"/>
            <arg value="-h"/>
            <arg value="${host}"/>
            <arg value="-p" />
            <arg value="${port}"/>
	       <arg value="-u" />
            <arg value="${username}"/>
            <arg value="-pw" />
            <arg value="${password}"/>
	</java>
    </target>

    <path id="jar.classpath" >
            <pathelement path="${class.dir}"/>               
            <fileset dir="${registry.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>
