<?xml version="1.0" encoding="UTF-8"?>
<project name="jalangijava" default="all">
  
  
  <property file="jalangijava.properties"/>
  <!-- Uncomment the following property if no tests compilation is needed -->
  <!-- 
  <property name="skip.tests" value="true"/>
   -->
  
  <!-- Compiler options -->
  
  <property name="compiler.debug" value="on"/>
  <property name="compiler.generate.no.warnings" value="off"/>
  <property name="compiler.args" value=""/>
  <property name="compiler.max.memory" value="128m"/>
  <patternset id="ignored.files">
    <exclude name="**/CVS/**"/>
    <exclude name="**/SCCS/**"/>
    <exclude name="**/RCS/**"/>
    <exclude name="**/rcs/**"/>
    <exclude name="**/.DS_Store/**"/>
    <exclude name="**/.svn/**"/>
    <exclude name="**/.pyc/**"/>
    <exclude name="**/.pyo/**"/>
    <exclude name="**/*.pyc/**"/>
    <exclude name="**/*.pyo/**"/>
    <exclude name="**/.git/**"/>
    <exclude name="**/*.hprof/**"/>
    <exclude name="**/_svn/**"/>
    <exclude name="**/.hg/**"/>
    <exclude name="**/*.lib/**"/>
    <exclude name="**/*~/**"/>
    <exclude name="**/__pycache__/**"/>
    <exclude name="**/.bundle/**"/>
    <exclude name="**/*.rbc/**"/>
  </patternset>
  <patternset id="library.patterns">
    <include name="*.zip"/>
    <include name="*.apk"/>
    <include name="*.war"/>
    <include name="*.egg"/>
    <include name="*.ear"/>
    <include name="*.ane"/>
    <include name="*.swc"/>
    <include name="*.jar"/>
  </patternset>
  <patternset id="compiler.resources">
    <include name="**/?*.properties"/>
    <include name="**/?*.xml"/>
    <include name="**/?*.gif"/>
    <include name="**/?*.png"/>
    <include name="**/?*.jpeg"/>
    <include name="**/?*.jpg"/>
    <include name="**/?*.html"/>
    <include name="**/?*.dtd"/>
    <include name="**/?*.tld"/>
    <include name="**/?*.ftl"/>
  </patternset>
  
  <!-- Modules -->
  
  
  <!-- Module jalangijava -->
  
  <dirname property="module.jalangijava.basedir" file="${ant.file}"/>
  
  
  
  <property name="compiler.args.jalangijava" value="${compiler.args}"/>
  
  <property name="jalangijava.output.dir" value="${module.jalangijava.basedir}/jout/production/jalangijava"/>
  <property name="jalangijava.testoutput.dir" value="${module.jalangijava.basedir}/jout/test/jalangijava"/>
  
  <path id="jalangijava.module.bootclasspath">
    <!-- Paths to be included in compilation bootclasspath -->
  </path>
  
  <path id="jalangijava.module.production.classpath">
    <pathelement location="${basedir}/thirdparty/javalib/automaton.jar"/>
  </path>
  
  <path id="jalangijava.runtime.production.module.classpath">
    <pathelement location="${jalangijava.output.dir}"/>
    <pathelement location="${basedir}/thirdpart/javalib/automaton.jar"/>
  </path>
  
  <path id="jalangijava.module.classpath">
    <pathelement location="${jalangijava.output.dir}"/>
    <pathelement location="${basedir}/thirdpart/javalib/automaton.jar"/>
  </path>
  
  <path id="jalangijava.runtime.module.classpath">
    <pathelement location="${jalangijava.testoutput.dir}"/>
    <pathelement location="${jalangijava.output.dir}"/>
    <pathelement location="${basedir}/thirdparty/javalib/automaton.jar"/>
  </path>
  
  
  <patternset id="excluded.from.module.jalangijava">
    <patternset refid="ignored.files"/>
  </patternset>
  
  <patternset id="excluded.from.compilation.jalangijava">
    <patternset refid="excluded.from.module.jalangijava"/>
  </patternset>
  
  <path id="jalangijava.module.sourcepath">
    <dirset dir="${module.jalangijava.basedir}">
      <include name="src/java"/>
    </dirset>
  </path>
  
  
  <target name="compile.module.jalangijava" depends="compile.module.jalangijava.production,compile.module.jalangijava.tests" description="Compile module jalangijava"/>
  
  <target name="compile.module.jalangijava.production" description="Compile module jalangijava; production classes">
    <mkdir dir="${jalangijava.output.dir}"/>
    <javac destdir="${jalangijava.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
      <compilerarg line="${compiler.args.jalangijava}"/>
      <bootclasspath refid="jalangijava.module.bootclasspath"/>
      <classpath refid="jalangijava.module.production.classpath"/>
      <src refid="jalangijava.module.sourcepath"/>
      <patternset refid="excluded.from.compilation.jalangijava"/>
    </javac>
    
    <copy todir="${jalangijava.output.dir}">
      <fileset dir="${module.jalangijava.basedir}/src/java">
        <patternset refid="compiler.resources"/>
        <type type="file"/>
      </fileset>
    </copy>
  </target>
  
  <target name="compile.module.jalangijava.tests" depends="compile.module.jalangijava.production" description="compile module jalangijava; test classes" unless="skip.tests"/>
  
  <target name="clean.module.jalangijava" description="cleanup module">
    <delete dir="${jalangijava.output.dir}"/>
    <delete dir="${jalangijava.testoutput.dir}"/>
  </target>
  
  <target name="init" description="Build initialization">
    <!-- Perform any build initialization in this target -->
  </target>
  
  <target name="clean" depends="clean.module.jalangijava" description="cleanup all"/>
  
  <target name="build.modules" depends="init, clean, compile.module.jalangijava" description="build all modules"/>
  
  <target name="all" depends="build.modules" description="build all"/>
</project>
