1 <project name="ea2ddl-gen" default="jdbc" basedir=".">
3 Note - You should not have to edit this file.
5 Instead, if calling build-torque.xml directly, edit the build.properties
6 that is in the same directory. If calling build-torque.xml via another
7 build file, you can also use the build.properties in the same directory,
8 or set the property torque.contextProperties to the file
9 to use in place of build.properties (e.g. project.properties).
13 For us to load the default.properties from the classpath, we need to bootstrap.
14 To know the right lib.dir for the torque-classpath, we need to manually
15 figure out torque.lib.dir, but to do that, we need to manually figure
16 out torque.contextProperties and load that so that any old configurations
17 still work propertly. Then we can go on and do the rest of the mappings via
20 <property name="build.properties" value="build.properties"/>
21 <property name="torque.contextProperties" value="${build.properties}"/>
22 <property file="${torque.contextProperties}"/>
23 <property name="lib.dir" value="lib/forExecute"/>
24 <property name="torque.lib.dir" value="${lib.dir}"/>
25 <property name="class.root" value="target/classes"/>
26 <property name="ant.lib.dir" value="ant/lib"/>
29 Build the classpath. Specifically point to each file we're including to avoid
30 version conflicts in the case of the torque.lib.dir being something like lib.repo.
31 However, we still need to pull in the user's database driver and since we don't
32 know which jar that will be, after we've got all of our specific, version-safe jars,
33 do a general inclusion of the torque.lib.dir to catch any drivers.
35 <path id="torque-classpath">
39 <fileset dir="${torque.lib.dir}">
40 <include name="**/*.jar"/>
42 <fileset dir="${ant.lib.dir}">
43 <include name="**/*.jar"/>
46 <include name="${class.root}"/>
51 The default.properties file will map old properties to the new ones along
52 with setting the correct defaults.
54 <property resource="org/apache/torque/default.properties">
56 <path refid="torque-classpath"/>
61 Do forward declarations of all of our tasks to
62 centralize them and clean up the targets.
64 <taskdef name="torque-jdbc-transform" classpathref="torque-classpath"
65 classname="org.apache.torque.task.TorqueJDBCTransformTask"/>
66 <taskdef name="torque-doc" classpathref="torque-classpath"
67 classname="org.apache.torque.task.TorqueDocumentationTask"/>
68 <taskdef name="torque-data-model" classpathref="torque-classpath"
69 classname="org.apache.torque.task.TorqueDataModelTask"/>
70 <taskdef name="torque-sql2entity" classpathref="torque-classpath"
71 classname="org.seasar.dbflute.task.DfSql2EntityTask"/>
72 <taskdef name="torque-outside-sql-test" classpathref="torque-classpath"
73 classname="org.seasar.dbflute.task.DfOutsideSqlTestTask"/>
75 <!-- ReplaceSchema -->
76 <taskdef name="torque-create-schema" classpathref="torque-classpath"
77 classname="org.seasar.dbflute.task.replaceschema.DfCreateSchemaTask"/>
78 <taskdef name="torque-load-data" classpathref="torque-classpath"
79 classname="org.seasar.dbflute.task.replaceschema.DfLoadDataTask"/>
80 <taskdef name="torque-take-finally" classpathref="torque-classpath"
81 classname="org.seasar.dbflute.task.replaceschema.DfTakeFinallyTask"/>
86 <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
88 <!-- ================================================================ -->
89 <!-- C H E C K U S E C L A S S P A T H -->
90 <!-- ================================================================ -->
91 <!-- Temporary hack around the propertiesUtil bug. Should -->
92 <!-- be fixed soon. -->
93 <!-- ================================================================ -->
95 <target name="check-use-classpath">
96 <condition property="torque.internal.useClasspath">
97 <equals arg1="${torque.useClasspath}" arg2="true"/>
101 <!-- ================================================================ -->
102 <!-- C H E C K R U N O N L Y O N S C H E M A C H A N G E -->
103 <!-- ================================================================ -->
104 <!-- Maps the torque.runOnlyOnSchemaChange to -->
105 <!-- torque.internal.runOnlyOnSchemaChange -->
106 <!-- ================================================================ -->
108 <target name="check-run-only-on-schema-change">
109 <condition property="torque.internal.runOnlyOnSchemaChange">
110 <equals arg1="${torque.runOnlyOnSchemaChange}" arg2="true"/>
114 <!-- ******************************************************************************* -->
117 <!-- ================================================================ -->
118 <!-- J D B C TO X M L -->
119 <!-- ================================================================ -->
121 <target name="jdbc" description="==> jdbc to xml">
123 <echo message="+-----------------------------------------------+"/>
124 <echo message="| |"/>
125 <echo message="| Generating XML from JDBC connection ! |"/>
126 <echo message="| |"/>
127 <echo message="+-----------------------------------------------+"/>
130 <echo message="+-------------------------------------------------------------------------------+"/>
131 <echo message="contextProperties = ${torque.contextProperties}"/>
132 <echo message="outputFile = ${torque.schema.dir}/project-schema-${torque.project}.xml"/>
133 <echo message="+-----------------+"/>
135 <torque-jdbc-transform
136 contextProperties="${torque.contextProperties}"
137 outputFile="${torque.schema.dir}/project-schema-${torque.project}.xml"
138 environmentType="${dfenv}"
140 </torque-jdbc-transform>
143 <!-- ******************************************************************************* -->
146 <!-- ================================================================ -->
147 <!-- 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 -->
148 <!-- ================================================================ -->
149 <!-- Generate the Peer-based object model for your project. -->
150 <!-- These are in addition to the base Torque OM! -->
151 <!-- ================================================================ -->
153 <target name="om-check" depends="check-run-only-on-schema-change" if="torque.internal.runOnlyOnSchemaChange">
155 property="torque.internal.om.uptodate"
156 targetfile="${torque.java.dir}/report.${torque.project}.om.generation">
157 <srcfiles dir="${torque.schema.dir}" includes="**/*-schema.xml" />
161 <target name="om" depends="check-use-classpath, om-check" unless="torque.internal.om.uptodate"
162 description="==> generates the Peer-based object model for your project">
164 <echo message="+------------------------------------------+"/>
165 <echo message="| |"/>
166 <echo message="| Generating Peer-based Object Model for |"/>
167 <echo message="| YOUR Torque project! |"/>
168 <echo message="| |"/>
169 <echo message="+------------------------------------------+"/>
171 <antcall target="om-classpath"/>
172 <antcall target="om-template"/>
173 <!-- antcall target="zip-base-om"/ -->
176 <target name="om-classpath" if="torque.internal.useClasspath">
178 contextProperties="${torque.contextProperties}"
179 controlTemplate="${torque.template.om}"
180 outputDirectory="${torque.java.dir}"
181 outputFile="report.${torque.project}.om.generation"
182 targetDatabase="${torque.database}"
183 targetPackage="${torque.targetPackage}"
184 useClasspath="${torque.useClasspath}"
185 environmentType="${dfenv}">
186 <fileset dir="${torque.schema.dir}"
187 includes="${torque.schema.om.includes}"
188 excludes="${torque.schema.om.excludes}"
193 <target name="om-template" unless="torque.internal.useClasspath">
195 contextProperties="${torque.contextProperties}"
196 controlTemplate="${torque.template.om}"
197 outputDirectory="${torque.java.dir}"
198 outputFile="report.${torque.project}.om.generation"
199 targetDatabase="${torque.database}"
200 targetPackage="${torque.targetPackage}"
201 templatePath="${torque.templatePath}"
202 environmentType="${dfenv}">
203 <fileset dir="${torque.schema.dir}"
204 includes="${torque.schema.om.includes}"
205 excludes="${torque.schema.om.excludes}"
210 <!-- ******************************************************************************* -->
213 <!-- ================================================================ -->
214 <!-- G E N E R A T E D O C S -->
215 <!-- ================================================================ -->
216 <!-- Generates documentation to -->
217 <!-- ${torque.doc.dir}/project-schema.html -->
218 <!-- ================================================================ -->
220 <target name="doc" description="==> generates documentation for your datamodel">
222 <echo message="+------------------------------------------+"/>
223 <echo message="| |"/>
224 <echo message="| Generating docs for YOUR datamodel! |"/>
225 <echo message="| |"/>
226 <echo message="+------------------------------------------+"/>
229 contextProperties="${torque.contextProperties}"
230 controlTemplate="${torque.template.doc}"
231 outputDirectory="${torque.doc.dir}"
232 outputFile="report.${torque.project}.doc.generation"
233 outputFormat="${torque.doc.format}"
234 sqldbmap="${torque.sql.dir}/sqldb.map"
235 templatePath="${torque.templatePath}"
236 useClasspath="${torque.useClasspath}"
237 environmentType="${dfenv}">
238 <fileset dir="${torque.schema.dir}"
239 includes="${torque.schema.doc.includes}"
240 excludes="${torque.schema.doc.excludes}"
245 <!-- ================================================================== -->
246 <!-- J A V A D O C -->
247 <!-- ================================================================== -->
251 description="==> generates the API documentation">
253 <mkdir dir="${torque.javadoc.dir}"/>
257 destdir="${torque.javadoc.dir}"
258 packagenames="${torque.targetPackage}.*"
260 sourcepath="${torque.java.dir}"
263 <classpath refid="torque-classpath"/>
267 <!-- ******************************************************************************* -->
270 <target name="replace-schema" description="==> replace-schema">
272 <echo message="+-----------------------------------------------+"/>
273 <echo message="| |"/>
274 <echo message="| Replace-Schema ! |"/>
275 <echo message="| |"/>
276 <echo message="+-----------------------------------------------+"/>
279 <format property="now.date" pattern="yyyy-MM-dd HH:mm:ss.SSS" />
282 <torque-create-schema
283 contextProperties="${torque.contextProperties}"
284 validTaskEndInformation="false"
285 environmentType="${dfenv}">
286 </torque-create-schema>
288 contextProperties="${torque.contextProperties}"
289 validTaskEndInformation="false"
290 environmentType="${dfenv}">
293 contextProperties="${torque.contextProperties}"
294 beforeTimestamp="${now.date}"
295 environmentType="${dfenv}">
296 </torque-take-finally>
299 <target name="outside-sql-test" description="==> outside-sql-test">
301 <echo message="+-----------------------------------------------+"/>
302 <echo message="| |"/>
303 <echo message="| Outside-Sql Test ! |"/>
304 <echo message="| |"/>
305 <echo message="+-----------------------------------------------+"/>
307 <torque-outside-sql-test contextProperties="${torque.contextProperties}" environmentType="${dfenv}">
308 </torque-outside-sql-test>
311 <target name="sql2entity" description="==> sql2entity">
313 <echo message="+-----------------------------------------------+"/>
314 <echo message="| |"/>
315 <echo message="| Sql 2 Entity ! |"/>
316 <echo message="| |"/>
317 <echo message="+-----------------------------------------------+"/>
320 contextProperties="${torque.contextProperties}"
321 controlTemplate="${torque.template.sql2entity}"
322 outputDirectory="${torque.java.dir}"
323 outputFile="report.${torque.project}.sql2entity.generation"
324 targetDatabase="${torque.database}"
325 templatePath="${torque.templatePath}"
326 environmentType="${dfenv}"