I just read Peter White's email and he found a bug in the
build-torque.xml I just posted. In b4, properties have the form
torque.xxx instead of just xxx, hence the version I posted used
torque.useClasspath instead of just useClasspath.

I've attached the fixed version.

- Stephen

> -----Original Message-----
> From: Stephen Haberman [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 31, 2002 2:28 PM
> To: 'Turbine Torque Users List'
> Subject: RE: b3 useClasspath fix
> 
> Pathes are not an Ant thing. Revision control systems can create diffs
> that show what changed from one version of a file to the next. You
just
> run "patch -i patch-file.txt" in the torque cvs dir and patch will do
> it's thing. WinCVS ships with a patch utility if you're a Windows
user.
> 
> I'm not entirely sure, but you may have to run the patch against a
copy
> of Torque checked out from CVS so that the dir structure is the same.
> For those who don't have the Torque source, I've attached the
> build-torque.xml that results from running the patches I posted
earlier
> in this thread.
> 
> - Stephen
<project name="Torque" default="main" basedir=".">

  <property name="torque.home" value="."/>
  <property name="build.properties" value="build.properties"/>
  <property file="${build.properties}"/>
  <property name="lib.dir" value="lib"/>
  <property name="idTableXMLFile" value=""/>

  <!-- Build classpath -->
  <path id="torque-classpath">
    <fileset dir="${lib.dir}">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <!--
    Do forward declarations of all of our tasks to 
    centralize them and clean up the targets.
  -->
  <taskdef
    name="torque-data-model"
    classpathref="torque-classpath"
    classname="org.apache.torque.task.TorqueDataModelTask"/>
  <taskdef
    name="torque-data-dump"
    classpathref="torque-classpath"
    classname="org.apache.torque.task.TorqueDataDumpTask"/>
  <taskdef
    name="torque-data-sql"
    classpathref="torque-classpath"
    classname="org.apache.torque.task.TorqueDataSQLTask"/>
  <taskdef
    name="torque-doc"
    classpathref="torque-classpath"
    classname="org.apache.torque.task.TorqueDocumentationTask"/>
  <taskdef
    name="torque-jdbc-transform"
    classpathref="torque-classpath"
    classname="org.apache.torque.task.TorqueJDBCTransformTask"/>
  <taskdef
    name="torque-sql"
    classpathref="torque-classpath"
    classname="org.apache.torque.task.TorqueSQLTask"/>
  <taskdef
    name="torque-sql-exec"
    classpathref="torque-classpath"
    classname="org.apache.torque.task.TorqueSQLExec"/>
  <taskdef
    name="torque-sql-transform"
    classpathref="torque-classpath"
    classname="org.apache.torque.task.TorqueSQLTransformTask"/>

  <!-- ================================================================ -->
  <!-- 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"
    description="==> generates sql + om classes">

    <antcall target="sql"/>
    <antcall target="om"/>
  </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.               -->
  <!-- ================================================================ -->

  <!-- ================================================================ -->
  <!-- C H E C K  U S E C L A S S P A T H                               -->
  <!-- ================================================================ -->
  <!-- Temporary hack around the propertiesUtil bug. Should             -->
  <!-- be fixed soon.                                                   -->
  <!-- ================================================================ -->

  <target name="check-use-classpath">
    <condition property="torque.internal.useClasspath">
      <equals arg1="${useClasspath}" arg2="true"/>
    </condition>
  </target>

  <target
    name="sql"
    depends="check-use-classpath"
    description="==> generates the SQL for your project">

    <echo message="+------------------------------------------+"/>
    <echo message="|                                          |"/>
    <echo message="| Generating SQL for YOUR Turbine project! |"/>
    <echo message="| Woo hoo!                                 |"/>
    <echo message="|                                          |"/>
    <echo message="+------------------------------------------+"/>

    <antcall target="sql-classpath"/>
    <antcall target="sql-template"/>
  </target>

  <target
    name="sql-classpath"
    if="torque.internal.useClasspath">

    <echo message="using classpath"/>

    <torque-sql
      contextProperties="${build.properties}"
      controlTemplate="${SQLControlTemplate}"
      outputDirectory="${torque.home}/${outputDirectory}/sql"
      useClasspath="${useClasspath}"
      basePathToDbProps="sql/base/"
      sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
      outputFile="report.${project}.sql.generation"
      targetDatabase="${database}"
      idTableXMLFile="${idTableXMLFile}">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
      </fileset>
    </torque-sql>
  </target>

  <target
    name="sql-template"
    unless="torque.internal.useClasspath">

    <echo message="using template path ${templatePath}"/>

    <torque-sql
      contextProperties="${build.properties}"
      controlTemplate="${SQLControlTemplate}"
      outputDirectory="${torque.home}/${outputDirectory}/sql"
      templatePath="${templatePath}"
      basePathToDbProps="sql/base/"
      sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
      outputFile="report.${project}.sql.generation"
      targetDatabase="${database}"
      idTableXMLFile="${idTableXMLFile}">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
      </fileset>
    </torque-sql>
  </target>

  <!-- ================================================================ -->
  <!-- G E N E R A T E   D O C S                                        -->
  <!-- ================================================================ -->

  <target
    name="doc"
    description="==> generates documentation for your datamodel">

    <echo message="+------------------------------------------+"/>
    <echo message="|                                          |"/>
    <echo message="| Generating docs for YOUR datamodel!      |"/>
    <echo message="| Woo hoo!                                 |"/>
    <echo message="|                                          |"/>
    <echo message="+------------------------------------------+"/>

    <torque-doc
      contextProperties="${build.properties}"
      controlTemplate="${DocControlTemplate}"
      outputDirectory="${torque.home}/${outputDirectory}/doc"
      useClasspath="${useClasspath}"
      outputFormat="${documentationFormat}"
      templatePath="${templatePath}"
      sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
      outputFile="report.${project}.doc.generation">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
      </fileset>
    </torque-doc>
  </target>

  <!-- ================================================================ -->
  <!-- C R E A T E  T A R G E T  D A T A B A S E                        -->
  <!-- ================================================================ -->
  <!-- Create the target database by executing a generated script       -->
  <!-- that is capable of performing the task.                          -->
  <!-- ================================================================ -->

  <target
    name="create-db"
    unless="database.manual.creation"
    description="==> generates the target database">

    <torque-data-model
      controlTemplate="sql/db-init/Control.vm"
      outputDirectory="${torque.home}/${outputDirectory}/sql"
      useClasspath="${useClasspath}"
      targetDatabase="${database}"
      templatePath="${templatePath}"
      outputFile="create-db.sql">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
      </fileset>
    </torque-data-model>

    <echo>
      Executing the create-db.sql script ...
    </echo>

    <sql
      driver="${databaseDriver}"
      url="${createDatabaseUrl}"
      userid="${databaseUser}"
      password="${databasePassword}"
      src="${torque.home}/${outputDirectory}/sql/create-db.sql"
      autocommit="true"
      onerror="continue">
      <classpath refid="torque-classpath"/>
    </sql>
  </target>

  <!-- ================================================================ -->
  <!-- I N S E R T  S I N G L E  S Q L  F I L E S                       -->
  <!-- ================================================================ -->

  <target
    name="insert-sql">

    <torque-sql-exec
      driver="${databaseDriver}"
      url="${buildDatabaseUrl}"
      userid="${databaseUser}"
      password="${databasePassword}"
      autocommit="true"
      onerror="continue"
      sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
      srcDir="${torque.home}/${outputDirectory}/sql">
      <classpath refid="torque-classpath"/>
    </torque-sql-exec>
  </target>

  <!-- ================================================================ -->
  <!-- J D B C  TO  X M L                                               -->
  <!-- ================================================================ -->

  <target
    name="jdbc"
    description="==> jdbc to xml">

    <echo message="+-----------------------------------------------+"/>
    <echo message="|                                               |"/>
    <echo message="| Generating XML from JDBC connection !         |"/>
    <echo message="| Woo hoo!                                      |"/>
    <echo message="|                                               |"/>
    <echo message="+-----------------------------------------------+"/>
    <echo message=" taking build.properties from: ${build.properties}"/>

    <torque-jdbc-transform
      dbUrl="${databaseUrl}"
      dbDriver="${databaseDriver}"
      dbUser="${databaseUser}"
      dbPassword="${databasePassword}"
      dbSchema="${databaseSchema}"
      outputFile="${torque.home}/${outputDirectory}/schema.xml"
      sameJavaName="${sameJavaName}"
    />
  </target>

  <!-- ================================================================ -->
  <!-- Generate SQL from XML data file                                  -->
  <!-- ================================================================ -->

  <target
    name="datasql"
    description="==> generates sql from data xml">

    <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-data-sql
      contextProperties="${build.properties}"
      controlTemplate="${DataSQLControlTemplate}"
      outputDirectory="${torque.home}/${outputDirectory}"
      useClasspath="${useClasspath}"
      templatePath="${templatePath}"
      outputFile="${project}-data.sql"
      xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
      dataXmlFile="${torque.home}/${schemaDirectory}/${project}-data.xml"
      dataDTD="${torque.home}/${schemaDirectory}/${project}-data.dtd"
      targetDatabase="${database}"
      sqldbmap="${basedir}/${outputDirectory}/sql/sqldb.map"
    />
  </target>

  <!-- ================================================================ -->
  <!-- G E N E R A T E   I D   B R O K E R   I N I T   S Q L            -->
  <!-- ================================================================ -->

  <target
    name="id-table-init-sql">

    <echo message="+------------------------------------------+"/>
    <echo message="|                                          |"/>
    <echo message="| Generating initialization SQL            |"/>
    <echo message="| for ID Broker system!                    |"/>
    <echo message="|                                          |"/>
    <echo message="+------------------------------------------+"/>

    <torque-sql
      contextProperties="${build.properties}"
      controlTemplate="${idTableControlTemplate}"
      suffix="-idtable-init"
      sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
      outputDirectory="${torque.home}/${outputDirectory}/sql"
      useClasspath="${useClasspath}"
      templatePath="${templatePath}"
      outputFile="${database}-id-table-init.sql"
      targetDatabase="${database}">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
        <exclude name="id-table-schema.xml"/>
      </fileset>
    </torque-sql>
  </target>

  <!-- ================================================================ -->
  <!-- Dump data from database into xml file                            -->
  <!-- ================================================================ -->

  <target
    name="datadump"
    description="==> dump data from database into xml file">

    <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-data-dump
      contextProperties="${build.properties}"
      controlTemplate="${DataDumpControlTemplate}"
      outputDirectory="${torque.home}/${outputDirectory}"
      useClasspath="${useClasspath}"
      templatePath="${templatePath}"
      outputFile="report.${project}.datadump.generation"
      xmlFile="${torque.home}/${schemaDirectory}/${project}-schema.xml"
      databaseDriver="${databaseDriver}"
      databaseUrl="${databaseUrl}"
      databaseUser="${databaseUser}"
      databasePassword="${databasePassword}"
      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="datadtd"
    description="==> generates the DATA DTD for your project">

    <echo message="+-----------------------------------------------+"/>
    <echo message="|                                               |"/>
    <echo message="| Generating Data DTD for YOUR Turbine project! |"/>
    <echo message="| Woo hoo!                                      |"/>
    <echo message="|                                               |"/>
    <echo message="+-----------------------------------------------+"/>

    <torque-data-model
      contextProperties="${build.properties}"
      controlTemplate="${DataDTDControlTemplate}"
      outputDirectory="${torque.home}/${outputDirectory}"
      useClasspath="${useClasspath}"
      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  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="om"
    depends="check-use-classpath"
    description="==> generates the Peer-based object model for your project">

    <echo message="+------------------------------------------+"/>
    <echo message="|                                          |"/>
    <echo message="| Generating Peer-based Object Model for   |"/>
    <echo message="| YOUR Turbine project! Woo hoo!           |"/>
    <echo message="|                                          |"/>
    <echo message="+------------------------------------------+"/>

    <antcall target="om-classpath"/>
    <antcall target="om-template"/>
  </target>

  <target
    name="om-classpath"
    if="torque.internal.useClasspath">

    <echo message="using classpath"/>

    <torque-data-model
      contextProperties="${build.properties}"
      controlTemplate="${OMControlTemplate}"
      outputDirectory="${torque.home}/${outputDirectory}/java"
      useClasspath="${useClasspath}"
      outputFile="report.${project}.om.generation"
      targetPackage="${targetPackage}"
      targetDatabase="${database}">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
        <exclude name="id-table-schema.xml"/>
      </fileset>
    </torque-data-model>
  </target>

  <target
    name="om-template"
    unless="torque.internal.useClasspath">

    <echo message="using template path ${templatePath}"/>

    <torque-data-model
      contextProperties="${build.properties}"
      controlTemplate="${OMControlTemplate}"
      outputDirectory="${torque.home}/${outputDirectory}/java"
      templatePath="${templatePath}"
      outputFile="report.${project}.om.generation"
      targetPackage="${targetPackage}"
      targetDatabase="${database}">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
        <exclude name="id-table-schema.xml"/>
      </fileset>
    </torque-data-model>
  </target>

  <!-- =================================================================== -->
  <!-- C O M P I L E  O M                                                  -->
  <!-- =================================================================== -->

  <target
    name="compile"
    description="==> compiles the OM classes">

    <!--
      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="torque-classpath"/>
    </javac>
  </target>

  <!-- =================================================================== -->
  <!-- S Q L  T O  X M L                                                   -->
  <!-- =================================================================== -->
  <!-- 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"
    description="==> creates an xml schema from an sql schema">

    <torque-sql-transform
      inputFile="schema/schema.sql"
      outputFile="schema/schema.xml"
    />
  </target>

  <!-- ================================================================== -->
  <!-- J A V A D O C                                                      -->
  <!-- ================================================================== -->

  <target
    name="javadocs"
    description="==> generates the API documentation">

    <mkdir dir="${torque.home}/${outputDirectory}/javadoc"/>

    <javadoc
      sourcepath="${torque.home}/${outputDirectory}/java"
      packagenames="${targetPackage}.*"
      destdir="${outputDirectory}/javadoc"
      author="true"
      private="true"
      version="true"
      use="true">
      <classpath refid="torque-classpath"/>
    </javadoc>
  </target>

  <!-- =================================================================== -->
  <!-- =================================================================== -->
  <!-- O J B   S T U F F                                                   -->
  <!-- =================================================================== -->
  <!-- =================================================================== -->

  <target
    name="ojb-repository">

    <echo message="+------------------------------------------+"/>
    <echo message="|                                          |"/>
    <echo message="| Generating OJB repository                |"/>
    <echo message="|                                          |"/>
    <echo message="+------------------------------------------+"/>

    <torque-data-model
      contextProperties="${build.properties}"
      controlTemplate="ojb/repository/Control.vm"
      targetPackage="${targetPackage}"
      targetDatabase="${database}"
      outputDirectory="${torque.home}/${outputDirectory}/ojb"
      useClasspath="${useClasspath}"
      templatePath="${templatePath}"
      sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
      outputFile="report.${project}.ojb.generation">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
      </fileset>
    </torque-data-model>
  </target>

  <target
    name="ojb-model">

    <echo message="+------------------------------------------+"/>
    <echo message="|                                          |"/>
    <echo message="| Generating OJB model                     |"/>
    <echo message="|                                          |"/>
    <echo message="+------------------------------------------+"/>

    <torque-data-model
      contextProperties="${build.properties}"
      controlTemplate="ojb/model/Control.vm"
      targetPackage="${targetPackage}"
      targetDatabase="${database}"
      outputDirectory="${torque.home}/${outputDirectory}/ojb"
      useClasspath="${useClasspath}"
      templatePath="${templatePath}"
      sqldbmap="${torque.home}/${outputDirectory}/sql/sqldb.map"
      outputFile="report.${project}.ojb.generation">
      <fileset dir="${torque.home}/${schemaDirectory}">
        <include name="*-schema.xml"/>
      </fileset>
    </torque-data-model>
  </target>

  <!--
    Deprecated targets with the project- prefix.
  -->
  <target name="project-sql">
    <echo message="The 'project-sql' target is deprecated. Please use the 'sql' target instead."/>
    <antcall target="sql"/>
  </target>
  <target name="project-om">
    <echo message="The 'project-om' target is deprecated. Please use the 'om' target instead."/>
    <antcall target="om"/>
  </target>
  <target name="project-doc">
    <echo message="The 'project-doc' target is deprecated. Please use the 'doc' target instead."/>
    <antcall target="doc"/>
  </target>
  <target name="project-create-db">
    <echo message="The 'project-create-db' target is deprecated. Please use the 'create-db' target instead."/>
    <antcall target="create-db"/>
  </target>
  <target name="project-insert-sql">
    <echo message="The 'project-insert-sql' target is deprecated. Please use the 'insert-sql' target instead."/>
    <antcall target="insert-sql"/>
  </target>
  <target name="project-jdbc">
    <echo message="The 'project-jdbc' target is deprecated. Please use the 'jdbc' target instead."/>
    <antcall target="jdbc"/>
  </target>
  <target name="project-datasql">
    <echo message="The 'project-datasql' target is deprecated. Please use the 'datasql' target instead."/>
    <antcall target="datasql"/>
  </target>
  <target name="project-datadump">
    <echo message="The 'project-datadump' target is deprecated. Please use the 'datadump' target instead."/>
    <antcall target="datadump"/>
  </target>
  <target name="project-datadtd">
    <echo message="The 'project-datadtd' target is deprecated. Please use the 'datadtd' target instead."/>
    <antcall target="datadtd"/>
  </target>
  <target name="project-sql2xml">
    <echo message="The 'project-sql2xml' target is deprecated. Please use the 'sql2xml' target instead."/>
    <antcall target="sql2xml"/>
  </target>
  <target name="project-ojb-repository">
    <echo message="The 'project-ojb-repository' target is deprecated. Please use the 'ojb-repository' target instead."/>
    <antcall target="ojb-repository"/>
  </target>
  <target name="project-ojb-model">
    <echo message="The 'project-obj-model' target is deprecated. Please use the 'ojb-model' target instead."/>
    <antcall target="ojb-model"/>
  </target>

</project>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to