<project name="grails-build" default="package">

	<property file="build.properties"/>
	
	<property environment="env" />

    <path id="classpath">
        <fileset dir="${grails.lib}">
            <include name="*.jar"/>
            <exclude name="jsp-api-2.1.jar"/>
        </fileset>
        <fileset dir="${env.JAVA_HOME}/lib">
	        <include name="tools.jar"/>
	    </fileset>
        <pathelement location="${grails.src.war}/WEB-INF"/>
        <pathelement path="${grails.build}"/>
    </path>

    <target name="clean" description="Clean the build directory.">
	<echo>JAVA HOME IS ${env.JAVA_HOME}</echo>
        <delete dir="${grails.dist}"/>
        <delete dir="${grails.target}"/>
        <delete dir="${grails.doc}"/>
    </target>

    <import file="ant/build/resolve.xml"   />
    <import file="ant/build/compile.xml"   />
    <import file="ant/build/unit-test.xml" />
    <import file="ant/build/bundle.xml"    />
    <import file="ant/build/javadoc.xml"   />
    <import file="ant/build/osx.xml"   />
    <!--<import file="ant/build/checkstyle.xml"   />-->
    <import file="ant/build/release.xml"   />
    <import file="ant/build/eclipse.xml"   />
    <import file="ant/build/findbugs.xml"  />

    <target name="cruise"
            depends="clean,build, test-with-coverage, jar, javadoc, package"
            description="to be started by the CruiseControl build server">
        <delete dir="dist/coverage/" quiet="true"/>
        <mkdir dir="dist/coverage/"/>
        <move todir="dist/coverage/">
            <fileset dir="${coverage.report}"/>
        </move>
     </target>

</project>
