<project name="HelloWorld" default="all" >

    <path id="classpath">
    	<!-- Include project extra libraries. -->
        <fileset dir="../../lib">
            <include name="**/*.jar"/>
        </fileset>    
    </path>
    
    <target name="setProps" unless="setProps">
        <property environment="env"/>
        <property name="dist" value="../../dist"/>
        <property name="next_root" value="${env.NEXT_ROOT}"/>
        <property name="local_fw_root" value="${next_root}/Local/Library/Frameworks"/>
        <property name="fw_root" value="${next_root}/Library/Frameworks"/>
        <property name="app_install_dir" value="${dist}/WebObjects/Applications"/>
        <property name="app_name" value="${ant.project.name}"/>
        <property name="outdir" value="output" />
    </target>


    <target name="init" depends="setProps">
        <tstamp/>
	    <property name="local_outdir" value="${outdir}/webapps" />
	    <property name="build" value="${local_outdir}/classes" />
    </target>

    <target name="clean" depends="init">
        <delete dir="${local_outdir}" />
		<delete dir="${app_install_dir}/${app_name}.woa"/>
    </target>

    <target name="prepare" depends="init">
        <mkdir dir="${build}" />
    </target>

    <target name="compile" depends="prepare"
                          description="compile the Java source.">
        <javac srcdir="src" destdir="${build}">
            <classpath>
                <pathelement location="${fw_root}/JavaFoundation.framework/Resources/Java/javafoundation.jar"/>
                <pathelement location="${fw_root}/JavaEOControl.framework/Resources/Java/javaeocontrol.jar"/>
                <pathelement location="${fw_root}/JavaEOAccess.framework/Resources/Java/javaeoaccess.jar"/>
                <pathelement location="${fw_root}/JavaWebObjects.framework/Resources/Java/javawebobjects.jar"/>
            </classpath>
        </javac>

    </target>


    <target name="package" depends="compile">        
        <taskdef name="woapplication" classname="org.objectstyle.woproject.ant.WOApplication">
        	<classpath refid="classpath"/>
        </taskdef>
        
        <property name="wo.localroot" value="${dist}"/>
        
        <woapplication name="${ant.project.name}" 
                       destDir="${app_install_dir}">
            <classes dir="${build}"/>
			<resources dir="Resources">
				<include name="**/*.wo/**"/>
			</resources>
            <wsresources dir="WebServerResources">
				<include name="**"/>
			</wsresources>
			
			<frameworks root="wo.woroot">
				<include name="Library/Frameworks/Java*.framework"/>
			</frameworks>
			<frameworks root="wo.localroot">
				<include name="**/MailJava.framework"/>
			</frameworks>
        </woapplication>

   </target>

   <target name="all" depends="clean,package"/>
</project>






