<project name="evo-app-build-common" > 
	
	<import file="evo-app-compile-common.xml" />
	
	<target name="app-build" description="Compiles all application classes" depends="app-prepare,app-pre-build">
		<mkdir dir="${app.build.dir}" />
		<depend srcdir="${app.src.dir}" destdir="${app.build.dir}" cache="${app.dependencies.chache.dir}">
			<include name="**/*.java" />
		</depend>
		<javac srcdir="${app.src.dir}" destdir="${app.build.dir}" classpathref="app.build.classpath" debug="on" deprecation="on" fork="true" memoryMaximumSize="512M" />
		<antcall target="app-post-build"/>
	</target>
	
	<target name="run-codegen" description="Runs codegen for this project" depends="load-properties">
		<available file="${codegen.project.ant}" property="codegen.project.exists"/>
		<antcall target="show-codegen-project-error"/>
		<antcall target="run-codegen-if-project-exists"/>
	</target>
	
	<target name="run-codegen-if-project-exists" if="codegen.project.exists">
		<available file="${codegen.properties.file}" property="codegen.properties.exists"/>
		<antcall target="show-codegen-properties-error"/>
		<antcall target="run-codegen-if-exists"/>
	</target>
	
	<target name="show-codegen-project-error" unless="codegen.project.exists">
		<echo message="Codegen's build-file not found at ${codegen.project.ant}"/>
	</target>
	
	<target name="run-codegen-if-exists" if="codegen.properties.exists">
		<ant inheritall="false" antfile="${codegen.project.ant}" target="app-run">
			<property name="app.run.args" value="${basedir}" />
		</ant>
	</target>
	
	<target name="show-codegen-properties-error" unless="codegen.properties.exists">
		<echo message="Project's codegen configuration file not found at ${codegen.properties.file}"/>
	</target>
	
	<target name="run-LEAF" description="Runs LEAF for this project" depends="load-properties">
		<path id="leaf.classpath">
			<fileset dir="${lib.tools.dir}" />
			<path refid="app.build.classpath" />
		</path>
		<java jvmversion="${app.java.version}" classname="${leaf.main}" classpathref="leaf.classpath" fork="true" dir="${app.build.dir}">
			<arg value="${app.src.dir}"/>
		</java>
	</target>
	
</project>