Skip to content
Snippets Groups Projects
build.xml 4.13 KiB
Newer Older
<!-- 
 * Copyright (C) 2007,2008,2009  Anders Nilsson <anders.nilsson@cs.lth.se>
 *
 * This file is part of XMLSchemaCompiler.
 *
 * XMLSchemaCompiler is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * XMLSchemaCompiler is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with XMLSchemaCompiler.  If not, see <http://www.gnu.org/licenses/>.
-->


Anders Nilsson's avatar
Anders Nilsson committed
    Targets for working from terminal window:
    build (default) - generates java files and compiles them
    clean           - removes all generated files and class files
    Targets for working from Eclipse:
    gen             - generates java files
    genClean        - removes all generated files and their class files
  -->
<project name="XML Schema compiler" default="build" basedir=".">
Anders Nilsson's avatar
Anders Nilsson committed

  <!-- "package" is the directory where generated files will be stored -->
  <property name="package" value="AST"/>

  <!-- "tools" is the directory where generators and libraries are located. -->
  <property name="tools" value="tools"/>

  <property name="javacc.home" value="tools/javacc-4.0"/>
  
  <property name="parser.name" value="SchemaParser"/>
  
  <!-- "jflex" is an ant task class for the scanner generator in JFlex.jar -->
<!--   <taskdef name="jflex" classname="JFlex.anttask.JFlexTask" classpath="tools/JFlex.jar"/> -->
  <!-- "beaver" is an ant task class for the parser generator in beaver.jar -->
<!--   <taskdef name="beaver" classname="beaver.comp.run.AntTask" classpath="tools/beaver.jar"/> -->
  <!-- "jastadd" is an ant task class in jastadd2.jar -->
Administrator's avatar
Administrator committed
  <taskdef name="jastadd" classname="org.jastadd.JastAddTask" classpath="tools/jastadd2.jar"/>
Anders Nilsson's avatar
Anders Nilsson committed

  <!-- compile sources -->
  <target name="build" depends="gen">
Anders Nilsson's avatar
Anders Nilsson committed
    <javac  debug="true" nowarn="true" srcdir="." includes="**/*.java" excludes="tools/** examples/**" classpath=".:${tools}/beaver-rt.jar:${tools}/junit.jar"/>
Anders Nilsson's avatar
Anders Nilsson committed
  </target>
  
  <!-- generate compiler source files -->
  <target name="gen" description="Generate compiler source files">
    <!-- create AST node types and weave aspect modules -->
    <echo message = "Running JastAdd"/>
	<!--  <jastadd package="${package}" rewrite="true" beaver="true" novisitcheck="true"> -->
    <jastadd package="${package}" grammar="${parser.name}" rewrite="true" jjtree="true">
      <fileset dir=".">
	  	<include name="*.ast"/>
		<include name="*.jrag"/>
		<include name="*.jadd"/>
      </fileset>
    </jastadd>
    <jjtree 
       target="xmlschema.jjt" 
       outputdirectory="${package}" 
       javacchome="${javacc.home}"
       buildnodefiles="true"
       static="false"
       multi="true"
       visitor="true"
       nodedefaultvoid="true"
       nodeprefix='""'
       nodepackage="${package}"
       />
    <javacc
       target="${package}/xmlschema.jj"
       outputdirectory="${package}"
       javacchome="${javacc.home}"
       buildparser="true"
       buildtokenmanager="true"
       static="false"
       />
  </target>

<!--   <target name="test" depends="build"> -->
<!--     <java classname="GenCompiler" classpath="."> -->
<!--       <arg value="GripperOntology_experimental3.owl" /> -->
<!--     </java> -->
<!--   </target> -->

  <!-- remove generated source files and .class files -->
  <target name="clean" depends="cleanGen">
    <!-- delete all .class files recursively -->
    <delete>
      <fileset dir="." includes="**/*.class" excludes="beaver/*.class"/>
    </delete>
  </target>

  <target name="jar" depends="build">
Administrator's avatar
Administrator committed
    <jar destfile="SchemaCompiler.jar" basedir="." includes="**/*.class" excludes="x3d/**">
      <manifest>
	<attribute name="Main-Class" value="GenCompiler"/>
      </manifest>
    </jar>
  </target>
Anders Nilsson's avatar
Anders Nilsson committed

  <!-- remove generated source files and their .class files -->
  <target name="cleanGen">
    <delete dir="${package}"/>
  </target>
</project>