<!-- Copyright (C) 2008-2011 Federal University of Pernambuco and 
     University of Central Florida
 
 * This file is part of AJML
 *
 * AJML is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * AJML is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AJML; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: build.xml,v 1.0 2011/8/9 14:25:11 henriquerebelo Exp $ 
-->

<!--/** An Ant task to run the AJML compiler and checker.
      * @version $Revision: 3.0 $
      * @author Henrique Rebêlo
      */
-->
<project name="Ajml tools release 3.1" default="run-all">

	<!-- THE AJML TOOL VERSION BEING USED  -->

	<property name="AJML"                 value="31" />


	<!-- SYSTEM DEPENDENT VARIABLES   -   CHANGE FOR YOUR NEEDS  -->
	<property name="ajml.release.jar"     value="lib-ajmlc3.1/ajmlc3.1.jar" />
	<property name="src.dir"              value="src" />
	<property name="dest.dir"             value="classes" />
	<property name="main.class"           value="my.package.name.ClassnameOfMain" />
	<property name="app.lib"              value="lib" />
	<property name="ajml.lib"             value="lib-ajmlc3.1" />
	<!-- NOTE: 'ajml.lib' MUST INCLUDE ASPECTJ WEAVERS, AJC AND ABC -->

	<!-- CLASSPATH OF AJML TOOL FOR COMPILATION AND CHECKING TASKS -->
	<taskdef classpath="${ajml.release.jar}" resource="org/jmlspecs/ant/taskdefs/ajmlTaskdefs.properties" />

	<!-- CLASSPATH FOR COMPILATION AND TASKS -->
	<path id="classpath">
		<!-- IF YOU HAVE APPLICATION SPECIFIC LIB, UNCOMMENT THE FOLLOWING -->
		<!--<fileset dir="${app.lib}">
			<include name="*.jar" />
		</fileset>-->
		<fileset dir="${ajml.lib}">
			<include name="*.jar" />
		</fileset>
	</path>

	<!-- CREATE NEEDED DIRECTORIES -->
	<target name="prepare">
		<mkdir dir="${dest.dir}" />
	</target>

	<!-- CLEANUP -->
	<target name="clean">
		<delete dir="${dest.dir}" />
	</target>

	<!-- COMPILATIONS -->
	<target name="ajmlc" depends="clean,prepare" description="Ant task responsible for compiling Java files annotated with JML using Ajmlc compiler version ${AJML}">
		<ajmlc destdir="${dest.dir}" srcdir="${src.dir}" classpathref="classpath" source="false" ajweaver="ajc" nocallsiteinstrumenation="false" onlycallsiteinstrumenation="false" verbose="true" fork="false">
		</ajmlc>
	</target>

	<!-- TYPE CHECKING -->
	<target name="ajml" description="Ant task responsible for type checking Java files annotated with JML using Ajml type checker version ${AJML}">
		<ajml destdir="${dest.dir}" srcdir="${src.dir}" classpathref="classpath" verbose="true">
		</ajml>
	</target>

	<!-- RUNNING APPLICATION -->
	<target name="ajmlrac" description="Ant task responsible for running the Java program (by means of a main class) which has embbeded JML runtime checks (with aspects); ajmlrac version ${AJML}">
		<ajmlrac classname="${main.class}" classpathref="classpath" verbose="true">
			<classpath location="${dest.dir}" />
		</ajmlrac>
	</target>

	<!-- SYSTEMS -->
	<target name="run-all" depends="clean,prepare,ajml,ajmlc,ajmlrac" />
</project>

