<!--
  #%L
  EUGene :: Ant task
  
  $Id: build.xml 1079 2011-06-28 09:15:23Z tchemit $
  $HeadURL: http://svn.nuiton.org/svn/eugene/tags/eugene-2.4.2/ant-eugene-task/src/site/resources/build.xml $
  %%
  Copyright (C) 2006 - 2010 CodeLutin
  %%
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as 
  published by the Free Software Foundation, either version 3 of the 
  License, or (at your option) any later version.
  
  This program 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 Lesser Public License for more details.
  
  You should have received a copy of the GNU General Lesser Public 
  License along with this program.  If not, see
  <http://www.gnu.org/licenses/lgpl-3.0.html>.
  #L%
  -->
<project name="EugeneHelloWorld" default="compile" basedir=".">
	<description>
        Simple example build file
    </description>
	
	<!-- set global properties for this build -->
	<property name="src" location="src/main/java" />
	<property name="resources" location="src/main/resources" />
	<property name="modelDir" location="src/main/xmi" />
	<property name="lib" location="lib" />
	<property name="builddir" location="build" />
	<property name="buildgen" location="${builddir}/gen/java" />
	<property name="buildclasses" location="${builddir}/classes" />

	<path id="project.classpath">
		<fileset dir="${lib}">
			<include name="*.jar" />
		</fileset>
	</path>

	<pathconvert pathsep=":" property="compile.classpath" refid="project.classpath">
		<map from="${basedir}" to="." />
	</pathconvert>

	<taskdef name="eugene" classname="org.nuiton.eugene.GeneratorTask"
				classpath="${compile.classpath}:${buildclasses}:${resources}" />

	<target name="warning">
		<echo>********************************************************</echo>
		<echo> WARNING : There is a classpath problem in this example </echo>
		<echo> To work, please run "ant compile" twice</echo>
		<echo>********************************************************</echo>
	</target>
	
	<target name="init" depends="warning">
		<!-- Create the build directory structure used by compile -->
		<mkdir dir="${builddir}" />
		<mkdir dir="${buildgen}" />
		<mkdir dir="${buildclasses}" />
	</target>

	<target name="pre-compile" depends="init">
		<echo>Using classpath ${compile.classpath}</echo>
		<javac srcdir="${src}" destdir="${buildclasses}" classpath="${compile.classpath}" />
	</target>

	<target name="generate" depends="pre-compile" description="generate">
		<eugene srcdir="${modelDir}" destdir="${buildgen}"
			resolver="org.nuiton.util.ResourceResolver"
			templates="org.nuiton.helloworld.ClassInfoGenerator,org.nuiton.helloworld.JavaBeanGenerator"
			properties="defaultPackage=org.nuiton,fullPackagePath=org,extraPackages=org" />
	</target>

	<target name="compile" depends="generate" description="compile the source ">
		<!-- Compile the java code from ${src} into ${build} -->
		<javac srcdir="${buildgen}" destdir="${buildclasses}" />
	</target>

	<target name="clean" description="clean up">
		<!-- Delete the ${build} and ${dist} directory trees -->
		<delete dir="${builddir}" />
	</target>
</project>

