<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="com.ibm.wala.dalvik.test" default="getJars" basedir=".">

	<property name="basews" value="${ws}"/>
	<property name="baseos" value="${os}"/>
	<property name="basearch" value="${arch}"/>
	<property name="basenl" value="${nl}"/>

	<!-- Compiler settings. -->
	<property name="javacFailOnError" value="true"/>
	<property name="javacDebugInfo" value="on"/>
	<property name="javacVerbose" value="false"/>
	<property name="logExtension" value=".log"/>
	<property name="compilerArg" value=""/>
	<property name="javacSource" value="1.8"/>
	<property name="javacTarget" value="1.8"/>
	<!-- This property has been updated to correspond to the paths used by the latest Java update
	on Mac OS X 10.6 (Java version 1.6.0_22).  If you are not using this version of Mac OS X or Java,
	try changing the value of the property to "${java.home}/../../../Classes" -->
    <condition property="dir_bootclasspath" value="${java.home}/../Classes">
      <and>
            <os family="mac"/>
            <equals arg1="${ant.java.version}" arg2="1.6" />
      </and>
    </condition>
	<property name="dir_bootclasspath" value="${java.home}/lib"/>
    <path id="path_bootclasspath">
            <fileset dir="${dir_bootclasspath}">

                    <include name="*.jar"/>
            </fileset>
    </path>	
	<property name="bootclasspath" refid="path_bootclasspath"/>
	<property name="bundleJavacSource" value="${javacSource}"/>
	<property name="bundleJavacTarget" value="${javacTarget}"/>
	<property name="bundleBootClasspath" value="${bootclasspath}"/>

	<property environment="env" /> 
	<condition property="androiddir" value="${env.ANDROID_HOME}"> 
          <isset property="env.ANDROID_HOME" /> 
	</condition> 

     <target name="sampleLexPresent" depends="init">
        <available file="${plugin.destination}/data/sample.lex" property="sample.lex.present"/>
     </target>

   <target name="fetchSampleLex" depends="sampleLexPresent" unless="sample.lex.present">
     <get src="https://www.cs.princeton.edu/~appel/modern/java/JLex/current/sample.lex" dest="${plugin.destination}/data/sample.lex" />
   </target>
	
   <target name="fetchSampleCup" depends="sampleCupPresent" unless="sample.cup.present">
     <get src="http://www.cc.gatech.edu/gvu/people/faculty/hudson/java_cup/classes.v0.9e/java_cup/parser.cup" dest="${plugin.destination}/data/sample.cup" />
   </target>

   <target name="sampleCupPresent" depends="init">
     <available file="${plugin.destination}/data/sample.cup" property="sample.cup.present"/>
   </target>

      <target name="fetchAndroidJar" depends="androidJarPresent" unless="android.jar.present">
     <get src="http://central.maven.org/maven2/com/google/android/android/4.1.1.4/android-4.1.1.4.jar" dest="${plugin.destination}/data/android.jar" />
   </target>

   <target name="androidJarPresent" depends="init">
     <available file="${plugin.destination}/data/android.jar" property="android.jar.present"/>
   </target>

	<target name="fetchDxJar">
		<mkdir dir="${basedir}/lib/"/>
		<copy
		    file="${androiddir}/build-tools/26.0.2/lib/dx.jar"
		    tofile="${basedir}/lib/dx.jar" force="true"/>
	</target>

	<target name="getJars" depends="fetchSampleLex,fetchSampleCup,fetchAndroidJar,fetchDxJar" />

	<target name="init" depends="properties">
		<condition property="pluginTemp" value="${buildTempFolder}/plugins">
			<isset property="buildTempFolder"/>
		</condition>
		<property name="pluginTemp" value="${basedir}"/>
		<condition property="build.result.folder" value="${pluginTemp}/com.ibm.wala.core.testdata">
			<isset property="buildTempFolder"/>
		</condition>
		<property name="build.result.folder" value="${basedir}"/>
		<property name="temp.folder" value="${basedir}/temp.folder"/>
		<property name="plugin.destination" value="${basedir}"/>
	</target>

	<target name="properties" if="eclipse.running">
		<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>

	</target>

</project>
