<?xml version="1.0" ?>
<project name="Spring.Core" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<!--
    Required properties:
      * current.bin.dir           - (path) root level to build to
      * current.build.debug       - (true|false) debug build?
      * current.build.defines.csc - framework-specific build defines for C# compiler
 -->
    <target name="build" depends="compileGrammar">
        <echo message="Compiling with args ${compiler.args}" />
        <csc target="library"
             define="${current.build.defines.csc}"
             warnaserror="true"
             debug="${current.build.debug}"
             output="${current.bin.dir}/${project::get-name()}.dll"
             doc="${current.bin.dir}/${project::get-name()}.xml"
            >
            <arg line="${compiler.args}"/>
            <nowarn>
                <warning number="219" />
                <warning number="162" />
                <warning number="618" /> <!-- disable deprecation warnings (due to deprecated code generated by antlr ) -->
                <!-- warning number="1591" / -->
            </nowarn>
            <sources failonempty="true">
                <include name="**/*.cs" />
                <include name="../GenCommonAssemblyInfo.cs" />
<!-- not needed, but produces a lot of 1591 warnings: exclude it -->
                <exclude name="Expressions/Parser/ExpressionParserTokenTypes.cs" />
            </sources>
            <resources basedir="." prefix="Spring.Objects.Factory.Xml">
                <include name="Objects\Factory\Xml\spring-objects-1.1.xsd" />
            </resources>
            <resources basedir="." prefix="Spring.Objects.Factory.Xml">
                <include name="Objects\Factory\Xml\spring-tool-1.1.xsd" />
            </resources>
            <resources basedir="." prefix="Spring.Validation.Config">
                <include name="Validation\Config\spring-validation-1.1.xsd" />
            </resources>
            <references basedir="${current.bin.dir}">
                <include name="Common.Logging.dll"/>
                <include name="antlr.runtime.dll" />
                <include name="System.Drawing.dll"/>
                <include name="Microsoft.VisualBasic.dll"/>
            </references>
        </csc>
    </target>

    <!-- if on linux using mono consider using java call -->
    <target name="compileGrammar" description="calls ANTLR to generate Lexers/Parsers">
        <if test="${not framework::exists('mono-1.0')}">
          <exec program="antlr-2.7.6.exe"
                basedir="${spring.basedir}\build-support\tools\antlr-2.7.6\"
                commandline="-o Expressions\Parser Expressions\Expression.g"
                failonerror="true"/>
        </if>
        <if test="${framework::exists('mono-1.0')}">
                <exec program="java.exe" commandline="-cp ${spring.basedir}\build-support\tools\antlr-2.7.6\antlr.jar antlr.Tool -o Expressions\Parser Expressions\Expression.g" failonerror="true"/>
        </if>
<!--
        ANTLR 2.7.6 win executable has missing dependency, so we have to use JAR file
        <exec program="java.exe" commandline="-cp ${spring.basedir}\build-support\tools\antlr-2.7.6\antlr.jar antlr.Tool -o Expressions\Parser Expressions\Expression.g" failonerror="true"/>
-->
    </target>

</project>
