OSDN Git Service

Access対応中
[ea2ddl/ea2ddl.git] / ea2ddl-gen / dbflute / build-torque.xml
1 <project name="ea2ddl-gen" default="jdbc" basedir=".">
2   <!--
3     Note - You should not have to edit this file.
4
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).
10   -->
11
12   <!--
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
18     old.properties.
19    -->
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"/>
27
28   <!--
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.
34   -->
35   <path id="torque-classpath">
36     <dirset dir=".">
37       <include name="log"/>
38     </dirset>
39     <fileset dir="${torque.lib.dir}">
40       <include name="**/*.jar"/>
41     </fileset>
42         <fileset dir="${ant.lib.dir}">
43       <include name="**/*.jar"/>
44         </fileset>
45     <dirset dir=".">
46       <include name="${class.root}"/>
47     </dirset>
48   </path>
49
50   <!--
51     The default.properties file will map old properties to the new ones along
52     with setting the correct defaults.
53   -->
54   <property resource="org/apache/torque/default.properties">
55     <classpath>
56       <path refid="torque-classpath"/>
57     </classpath>
58   </property>
59
60   <!--
61     Do forward declarations of all of our tasks to
62     centralize them and clean up the targets.
63   -->
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"/>
74
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"/>
82
83   <!--
84     for Ant-Contrib
85   -->
86   <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
87
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   <!-- ================================================================ -->
94
95   <target name="check-use-classpath">
96     <condition property="torque.internal.useClasspath">
97       <equals arg1="${torque.useClasspath}" arg2="true"/>
98     </condition>
99   </target>
100
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   <!-- ================================================================ -->
107
108   <target name="check-run-only-on-schema-change">
109     <condition property="torque.internal.runOnlyOnSchemaChange">
110       <equals arg1="${torque.runOnlyOnSchemaChange}" arg2="true"/>
111     </condition>
112   </target>
113
114   <!-- ******************************************************************************* -->
115   <!--                                                                            JDBC -->
116   <!--                                                                            **** -->
117   <!-- ================================================================ -->
118   <!-- J D B C  TO  X M L                                               -->
119   <!-- ================================================================ -->
120
121   <target name="jdbc" description="==> jdbc to xml">
122
123     <echo message="+-----------------------------------------------+"/>
124     <echo message="|                                               |"/>
125     <echo message="| Generating XML from JDBC connection !         |"/>
126     <echo message="|                                               |"/>
127     <echo message="+-----------------------------------------------+"/>
128
129     <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="+-----------------+"/>
134
135     <torque-jdbc-transform
136       contextProperties="${torque.contextProperties}"
137       outputFile="${torque.schema.dir}/project-schema-${torque.project}.xml"
138       environmentType="${dfenv}"
139     >
140     </torque-jdbc-transform>
141   </target>
142
143   <!-- ******************************************************************************* -->
144   <!--                                                                              OM -->
145   <!--                                                                              ** -->
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   <!-- ================================================================ -->
152
153   <target name="om-check" depends="check-run-only-on-schema-change" if="torque.internal.runOnlyOnSchemaChange">
154     <uptodate
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" />
158     </uptodate>
159   </target>
160
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">
163
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="+------------------------------------------+"/>
170
171     <antcall target="om-classpath"/>
172     <antcall target="om-template"/>
173     <!-- antcall target="zip-base-om"/ -->
174   </target>
175
176   <target name="om-classpath" if="torque.internal.useClasspath">
177     <torque-data-model
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}"
189       />
190     </torque-data-model>
191   </target>
192
193   <target name="om-template" unless="torque.internal.useClasspath">
194     <torque-data-model
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}"
206       />
207     </torque-data-model>
208   </target>
209
210   <!-- ******************************************************************************* -->
211   <!--                                                                             Doc -->
212   <!--                                                                             *** -->
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   <!-- ================================================================ -->
219
220   <target name="doc" description="==> generates documentation for your datamodel">
221
222     <echo message="+------------------------------------------+"/>
223     <echo message="|                                          |"/>
224     <echo message="| Generating docs for YOUR datamodel!      |"/>
225     <echo message="|                                          |"/>
226     <echo message="+------------------------------------------+"/>
227
228     <torque-doc
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}"
241       />
242     </torque-doc>
243   </target>
244
245   <!-- ================================================================== -->
246   <!-- J A V A D O C                                                      -->
247   <!-- ================================================================== -->
248
249   <target
250     name="javadocs"
251     description="==> generates the API documentation">
252
253     <mkdir dir="${torque.javadoc.dir}"/>
254
255     <javadoc
256       author="true"
257       destdir="${torque.javadoc.dir}"
258       packagenames="${torque.targetPackage}.*"
259       private="true"
260       sourcepath="${torque.java.dir}"
261       use="true"
262       version="true">
263       <classpath refid="torque-classpath"/>
264     </javadoc>
265   </target>
266
267   <!-- ******************************************************************************* -->
268   <!--                                                                         PlaySQL -->
269   <!--                                                                         ******* -->
270   <target name="replace-schema" description="==> replace-schema">
271
272     <echo message="+-----------------------------------------------+"/>
273     <echo message="|                                               |"/>
274     <echo message="| Replace-Schema !                              |"/>
275     <echo message="|                                               |"/>
276     <echo message="+-----------------------------------------------+"/>
277
278     <tstamp>
279       <format property="now.date" pattern="yyyy-MM-dd HH:mm:ss.SSS" />
280     </tstamp>
281
282     <torque-create-schema
283         contextProperties="${torque.contextProperties}"
284             validTaskEndInformation="false"
285         environmentType="${dfenv}">
286     </torque-create-schema>
287     <torque-load-data
288         contextProperties="${torque.contextProperties}"
289         validTaskEndInformation="false"
290         environmentType="${dfenv}">
291     </torque-load-data>
292     <torque-take-finally
293         contextProperties="${torque.contextProperties}"
294         beforeTimestamp="${now.date}"
295         environmentType="${dfenv}">
296     </torque-take-finally>
297   </target>
298
299   <target name="outside-sql-test" description="==> outside-sql-test">
300
301     <echo message="+-----------------------------------------------+"/>
302     <echo message="|                                               |"/>
303     <echo message="| Outside-Sql Test !                            |"/>
304     <echo message="|                                               |"/>
305     <echo message="+-----------------------------------------------+"/>
306         
307     <torque-outside-sql-test contextProperties="${torque.contextProperties}" environmentType="${dfenv}">
308     </torque-outside-sql-test>
309   </target>
310
311   <target name="sql2entity" description="==> sql2entity">
312
313     <echo message="+-----------------------------------------------+"/>
314     <echo message="|                                               |"/>
315     <echo message="| Sql 2 Entity !                                |"/>
316     <echo message="|                                               |"/>
317     <echo message="+-----------------------------------------------+"/>
318
319     <torque-sql2entity
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}"
327     >
328     </torque-sql2entity>
329   </target>
330
331 </project>