blob: 4228f4079ae05ac9c924fdc0fe95874373b14d83 [file] [log] [blame]
<project name="Torque" default="main" basedir=".">
<property name="torque.home" value="@TORQUE_HOME@"/>
<!-- Build classpath -->
<path id="classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!--
Load the build.properties file. All the targets use the
information stored in the properties file.
-->
<property name="build.properties" value="build.properties"/>
<property file="${build.properties}"/>
<!-- ================================================================ -->
<!-- M A I N T A R G E T -->
<!-- ================================================================ -->
<!-- This default target will run all the targets that generate -->
<!-- source. You will probably only run this target once then -->
<!-- call individual targets as necessary to update your sources -->
<!-- when you change your XML schema. -->
<!-- ================================================================ -->
<target name="main">
<antcall target="project-sql"/>
<antcall target="project-om"/>
</target>
<!-- ================================================================ -->
<!-- I N I T T A S K T A R G E T -->
<!-- ================================================================ -->
<!-- Taskdefs are defined inside this target as Ant seems to have -->
<!-- problems defining them at the top level. -->
<!-- ================================================================ -->
<target name="init-tasks">
<taskdef name="torque-datasql"
classname="org.apache.turbine.torque.TorqueDataSQLTask">
<classpath refid="classpath"/>
</taskdef>
<taskdef name="torque-datadump"
classname="org.apache.turbine.torque.TorqueDataDumpTask">
<classpath refid="classpath"/>
</taskdef>
<taskdef name="torque-datadtd"
classname="org.apache.turbine.torque.TorqueDataDTDTask">
<classpath refid="classpath"/>
</taskdef>
<taskdef name="torque-sql"
classname="org.apache.turbine.torque.TorqueSQLTask">
<classpath refid="classpath"/>
</taskdef>
<taskdef name="torque-om"
classname="org.apache.turbine.torque.TorqueObjectModelTask">
<classpath refid="classpath"/>
</taskdef>
<!--taskdef name="torque-intake"
classname="org.apache.turbine.torque.TorqueIntakeTask">
<classpath refid="classpath"/>
</taskdef-->
<taskdef name="sql-xml"
classname="org.apache.turbine.torque.TorqueSQLTransformTask">
<classpath refid="classpath"/>
</taskdef>
<taskdef name="texen"
classname="org.apache.velocity.texen.ant.TexenTask">
<classpath refid="classpath"/>
</taskdef>
<taskdef name="torque-jdbc"
classname="org.apache.turbine.torque.TorqueJDBCTransformTask">
<classpath refid="classpath"/>
</taskdef>
</target>
<!-- ================================================================ -->
<!-- J D B C -> X M L -->
<!-- ================================================================ -->
<target name="project-jdbc" depends="init-tasks">
<echo message="JDBC transform"/>
<torque-jdbc
dbUrl="${databaseUrl}"
dbDriver="${databaseDriver}"
dbUser="${databaseUser}"
dbPassword="${databasePassword}"
outputFile="schema/schema.xml"
sameJavaName="${sameJavaName}"
/>
</target>
<!-- ================================================================ -->
<!-- Generate SQL from XML data file -->
<!-- ================================================================ -->
<target name="project-datasql" depends="init-tasks">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL from data XML ! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${build.properties}"/>
<torque-datasql
contextProperties="${build.properties}"
controlTemplate="${DataSQLControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}"
templatePath="${templatePath}"
outputFile="report.${project}.datasql.generation"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
dataXmlFile="${torque.home}/${schemaDirectory}/${project}-data.xml"
dataDTD="${torque.home}/${schemaDirectory}/${project}-data.dtd"
databaseName="${databaseName}"
targetDatabase="${database}"
/>
</target>
<!-- ================================================================ -->
<!-- Dump data from databse into xml file -->
<!-- ================================================================ -->
<target name="project-datadump" depends="init-tasks">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Dumping the data from database into XML |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<echo message=" taking build.properties from: ${build.properties}"/>
<torque-datadump
contextProperties="${build.properties}"
controlTemplate="${DataDumpControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}"
templatePath="${templatePath}"
outputFile="report.${project}.datadump.generation"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
databaseName="${databaseName}"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T D A T A D T D -->
<!-- ================================================================ -->
<!-- Generate the DATA DTD for your project -->
<!-- ================================================================ -->
<target name="project-datadtd" depends="init-tasks">
<echo message="+-----------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Data DTD for YOUR Turbine project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+-----------------------------------------------+"/>
<torque-datadtd
contextProperties="${build.properties}"
controlTemplate="${DataDTDControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}"
templatePath="${templatePath}"
outputFile="report.${project}.datadtd.generation"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T S Q L -->
<!-- ================================================================ -->
<!-- Generate the SQL for your project, these are in addition -->
<!-- to the base Turbine tables! The tables you require for your -->
<!-- project should be specified in project-schema.xml. -->
<!-- ================================================================ -->
<target name="project-sql" depends="init-tasks">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating SQL for YOUR Turbine project! |"/>
<echo message="| Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-sql
contextProperties="${build.properties}"
controlTemplate="${SQLControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/sql"
templatePath="${templatePath}"
outputFile="report.${project}.sql.generation"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
targetDatabase="${database}"
/>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E P R O J E C T P E E R B A S E D O M -->
<!-- ================================================================ -->
<!-- Generate the Peer-based object model for your project. -->
<!-- These are in addition to the base Turbine OM! -->
<!-- ================================================================ -->
<target name="project-om" depends="init-tasks">
<echo message="+------------------------------------------+"/>
<echo message="| |"/>
<echo message="| Generating Peer-based Object Model for |"/>
<echo message="| YOUR Turbine project! Woo hoo! |"/>
<echo message="| |"/>
<echo message="+------------------------------------------+"/>
<torque-om
contextProperties="${build.properties}"
controlTemplate="${OMControlTemplate}"
outputDirectory="${torque.home}/${outputDirectory}/java"
templatePath="${templatePath}"
outputFile="report.${project}.om.generation"
targetPackage="${targetPackage}.om"
xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
/>
</target>
<!-- =================================================================== -->
<!-- C O M P I L E O M -->
<!-- =================================================================== -->
<target name="compile">
<!--
This should be moved to the top of the file, and
the values should come from the build.properties file.
-->
<property name="src.dir" value="${outputDirectory}/java"/>
<property name="build.dest" value="bin/classes"/>
<property name="debug" value="on"/>
<property name="deprecation" value="off"/>
<property name="optimize" value="off"/>
<mkdir dir="${build.dest}"/>
<javac srcdir="${src.dir}"
destdir="${build.dest}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}">
<classpath refid="classpath"/>
</javac>
</target>
<!-- ================================================================ -->
<!-- G E N E R A T E T U R B I N E S E R V I C E -->
<!-- ================================================================ -->
<!-- Generate turbine service code. -->
<!-- ================================================================ -->
<target name="turbine-service" depends="init-tasks">
<texen
contextProperties="service.props"
controlTemplate="${ServiceControlTemplate}"
outputDirectory="${outputDirectory}"
templatePath="${templatePath}"
outputFile="report.${project}.service.generation"
/>
</target>
<!-- =================================================================== -->
<!-- Create an xml schema from an sql schema. -->
<!-- -->
<!-- inputFile: The input sql file. This must be valid sql file but -->
<!-- it not not be in any specific format. -->
<!-- outputFile: The file where the xml schema will be written -->
<!-- =================================================================== -->
<target name="sql2xml" depends="init-tasks">
<sql-xml
inputFile="schema/schema.sql"
outputFile="schema/schema.xml"
/>
</target>
<!-- ================================================================== -->
<!-- Creates the API documentation -->
<!-- ================================================================== -->
<target name="javadocs"
description="--> generates the API documentation">
<mkdir dir="${torque.home}/${outputDirectory}/javadoc"/>
<javadoc sourcepath="${torque.home}/${outputDirectory}"
packagenames="${targetPackage}.*"
destdir="${outputDirectory}/javadoc"
author="true"
private="true"
version="true"
use="true"
>
<classpath refid="classpath"/>
</javadoc>
</target>
</project>