root/branches/1.1/generator/build-propel.xml

Revision 3, 16.2 kB (checked in by hans, 4 years ago)

Added exported CVS repository.

Line 
1 <project name="propel" default="main" basedir=".">
2
3   <!--
4     Note - You should not have to edit this file.
5
6     Instead, if calling build-propel.xml directly, edit the build.properties
7     that is in the same directory. If calling build-propel.xml via another
8     build file, you can also use the build.properties in the same directory,
9     or set the property propel.contextProperties to the file
10     to use in place of build.properties (e.g. project.properties).
11   -->
12
13   <property name="build.properties" value="build.properties"/>
14   <property name="propel.contextProperties" value="./${build.properties}"/>
15   <property file="./build.properties"/>
16
17   <!--
18     The default.properties file will map old properties to the new ones along
19     with setting the corret defaults.
20   -->
21   <property file="default.properties"/>
22
23   <!--
24     Do forward declarations of all of our tasks to
25     centralize them and clean up the targets.
26   -->
27
28   <path id="propelclasses">
29     <pathelement dir="classes/"/>
30   </path>
31
32   <taskdef
33     name="propel-data-model"
34     classname="propel.phing.PropelDataModelTask" classpathRef="propelclasses"/>
35   <taskdef
36     name="propel-om"
37     classname="propel.phing.PropelOMTask" classpathRef="propelclasses"/>
38   <taskdef
39     name="propel-data-dtd"
40     classname="propel.phing.PropelDataDTDTask" classpathRef="propelclasses"/>
41   <taskdef
42     name="propel-data-dump"
43     classname="propel.phing.PropelDataDumpTask" classpathRef="propelclasses"/>
44   <taskdef
45     name="propel-data-sql"
46     classname="propel.phing.PropelDataSQLTask" classpathRef="propelclasses"/>
47    <taskdef
48     name="propel-creole-transform"
49     classname="propel.phing.PropelCreoleTransformTask" classpathRef="propelclasses"/>
50   <taskdef
51     name="propel-sql"
52     classname="propel.phing.PropelSQLTask" classpathRef="propelclasses"/>
53   <taskdef
54     name="propel-sql-exec"
55     classname="propel.phing.PropelSQLExec" classpathRef="propelclasses"/>
56   <taskdef
57     name="propel-graphviz"
58     classname="propel.phing.PropelGraphvizTask" classpathRef="propelclasses"/>
59
60
61   <!-- ================================================================ -->
62   <!-- M A I N  T A R G E T                                             -->
63   <!-- ================================================================ -->
64   <!-- This default target will run all the targets that generate       -->
65   <!-- source. You will probably only run this target once then         -->
66   <!-- call individual targets as necessary to update your sources      -->
67   <!-- when you change your XML schema.                                 -->
68   <!-- ================================================================ -->
69
70   <target
71     name="main"
72     description="==> generates sql + om classes">
73
74     <phingcall target="sql"/>
75     <phingcall target="om"/>
76     <phingcall target="convert-props"/>
77   </target>
78
79   <!-- ================================================================ -->
80   <!-- 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         -->
81   <!-- ================================================================ -->
82   <!-- Maps the propel.runOnlyOnSchemaChange to                         -->
83   <!-- propel.internal.runOnlyOnSchemaChange                            -->
84   <!-- ================================================================ -->
85
86   <target name="check-run-only-on-schema-change">
87     <condition property="propel.internal.runOnlyOnSchemaChange">
88       <equals arg1="${propel.runOnlyOnSchemaChange}" arg2="true"/>
89     </condition>
90   </target>
91
92   <!-- ================================================================ -->
93   <!-- G E N E R A T E  P R O J E C T  S Q L                            -->
94   <!-- ================================================================ -->
95   <!-- Generate the SQL for your project, These are in addition         -->
96   <!-- to the base Turbine tables! The tables you require for your      -->
97   <!-- project should be specified in project-schema.xml.               -->
98   <!-- ================================================================ -->
99
100   <target
101     name="sql-check"
102     depends="check-run-only-on-schema-change"
103     if="propel.internal.runOnlyOnSchemaChange">
104     <uptodate
105       property="propel.internal.sql.uptodate"
106       targetfile="${propel.sql.dir}/${propel.schema.default.basename}.sql">
107       <srcfiles dir="${propel.schema.dir}" includes="**/${propel.schema.default.basename}.xml" />
108     </uptodate>
109   </target>
110
111   <target
112     name="sql"
113     depends="sql-check"
114     unless="propel.internal.sql.uptodate"
115     description="==> generates the SQL for your project">
116
117     <echo message="+------------------------------------------+"/>
118     <echo message="|                                          |"/>
119     <echo message="| Generating SQL for YOUR Propel project!  |"/>
120     <echo message="|                                          |"/>
121     <echo message="+------------------------------------------+"/>
122
123     <phingcall target="sql-template"/>
124
125   </target>
126
127   <target name="sql-template">
128     <propel-sql
129       outputDirectory="${propel.sql.dir}"
130       sqldbmap="${propel.sql.dir}/sqldb.map"
131       targetDatabase="${propel.database}"
132       templatePath="${propel.templatePath}">
133       <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
134       <schemafileset dir="${propel.schema.dir}"
135         includes="${propel.schema.sql.includes}"
136         excludes="${propel.schema.sql.excludes}"
137       />
138     </propel-sql>
139   </target>
140
141   <!-- ================================================================ -->
142   <!-- C R E A T E  T A R G E T  D A T A B A S E                        -->
143   <!-- ================================================================ -->
144   <!-- Create the target database by executing a generated script       -->
145   <!-- that is capable of performing the task.                          -->
146   <!-- ================================================================ -->
147
148   <target name="create-db-check">
149     <condition property="propel.internal.manualCreation">
150       <equals arg1="${propel.database.manualCreation}" arg2="true"/>
151     </condition>
152   </target>
153
154   <target
155     name="create-db"
156     unless="propel.internal.manualCreation"
157     depends="create-db-check"
158     description="==> generates the target database">
159
160     <propel-data-model
161       controlTemplate="${propel.template.sqlDbInit}"
162       outputDirectory="${propel.sql.dir}"
163       outputFile="create-db.sql"
164       targetDatabase="${propel.database}"
165       dbEncoding="${propel.database.encoding}"
166       templatePath="${propel.templatePath}">
167       <schemafileset dir="${propel.schema.dir}"
168         includes="${propel.schema.create-db.includes}"
169         excludes="${propel.schema.create-db.excludes}"
170       />
171     </propel-data-model>
172
173     <echo message="Executing the create-db.sql script ..."/>
174
175     <sql
176       autocommit="true"
177       driver="${propel.database.driver}"
178       onerror="continue"
179       src="${propel.sql.dir}/create-db.sql"
180       url="${propel.database.createUrl}"
181     />
182   </target>
183
184   <!-- ================================================================ -->
185   <!-- I N S E R T  S I N G L E  S Q L  F I L E S                       -->
186   <!-- ================================================================ -->
187
188   <target
189     name="insert-sql"
190     description="==> inserts the generated sql ">
191
192     <propel-sql-exec
193       autocommit="true"
194       driver="${propel.database.driver}"
195       onerror="continue"
196       sqldbmap="${propel.sql.dir}/sqldb.map"
197       srcDir="${propel.sql.dir}"
198       url="${propel.database.buildUrl}"
199     />
200   </target>
201
202   <!-- ================================================================ -->
203   <!-- C R E O L E  TO  X M L                                               -->
204   <!-- ================================================================ -->
205
206   <target
207     name="creole"
208     description="==> generate xml schema from Creole metadata">
209
210     <echo message="+-----------------------------------------------+"/>
211     <echo message="|                                               |"/>
212     <echo message="| Generating XML from Creole connection !       |"/>
213     <echo message="|                                               |"/>
214     <echo message="+-----------------------------------------------+"/>
215
216     <propel-creole-transform
217       dbDriver="${propel.database.driver}"
218       dbSchema="${propel.database.schema}"
219       dbEncoding="${propel.database.encoding}"
220       dbUrl="${propel.database.url}"
221       outputFile="${propel.schema.dir}/${propel.default.schema.basename}.xml"
222       samePhpName="${propel.samePhpName}"
223     />
224   </target>
225
226   <!-- ================================================================ -->
227   <!-- Generate SQL from XML data file                                  -->
228   <!-- ================================================================ -->
229
230   <target
231     name="datasql"
232     description="==> generates sql from data xml">
233
234     <echo message="+-----------------------------------------------+"/>
235     <echo message="|                                               |"/>
236     <echo message="| Generating SQL from data XML !                |"/>
237     <echo message="|                                               |"/>
238     <echo message="+-----------------------------------------------+"/>
239
240     <propel-data-sql
241       outputDirectory="${propel.sql.dir}"
242       sqldbmap="${propel.sql.dir}/sqldb.map"
243       dbEncoding="${propel.database.encoding}"
244       targetDatabase="${propel.database}"
245       templatePath="${propel.templatePath}"
246       datadbmap="${propel.schema.dir}/datadb.map"
247       srcDir="${propel.schema.dir}">
248       <mapper type="glob" from="${propel.datasql.mapper.from}" to="${propel.datasql.mapper.to}"/>
249       <schemafileset dir="${propel.schema.dir}"
250         includes="${propel.schema.datadtd.includes}"
251         excludes="${propel.schema.datadtd.excludes}"
252       />
253     </propel-data-sql>
254   </target>
255
256   <!-- ================================================================ -->
257   <!-- Dump data from database into xml file                            -->
258   <!-- ================================================================ -->
259
260   <target
261     name="datadump"
262     description="==> dump data from database into xml file">
263
264     <echo message="+-----------------------------------------------+"/>
265     <echo message="|                                               |"/>
266     <echo message="| Dumping the data from database into XML       |"/>
267     <echo message="|                                               |"/>
268     <echo message="+-----------------------------------------------+"/>
269
270     <propel-data-dump
271       targetDatabase="${propel.database}"
272       datadbmap="${propel.schema.dir}/datadb.map"
273       databaseDriver="${propel.database.driver}"
274       dbEncoding="${propel.database.encoding}"
275       databaseUrl="${propel.database.url}"
276       outputDirectory="${propel.schema.dir}"
277       templatePath="${propel.templatePath}">
278       <mapper type="glob" from="${propel.datadump.mapper.from}" to="${propel.datadump.mapper.to}"/>
279       <schemafileset dir="${propel.schema.dir}"
280         includes="${propel.schema.datadtd.includes}"
281         excludes="${propel.schema.datadtd.excludes}"
282       />
283      </propel-data-dump>
284   </target>
285
286   <!-- ================================================================ -->
287   <!-- G E N E R A T E  P R O J E C T  D A T A  D T D                   -->
288   <!-- ================================================================ -->
289   <!-- Generate the DATA DTD for your project                           -->
290   <!-- ================================================================ -->
291
292   <target
293     name="datadtd"
294     description="==> generates the DATA DTD for your project">
295
296     <echo message="+-----------------------------------------------+"/>
297     <echo message="|                                               |"/>
298     <echo message="| Generating Data DTD for YOUR Propel project!  |"/>
299     <echo message="|                                               |"/>
300     <echo message="+-----------------------------------------------+"/>
301
302     <propel-data-dtd
303       targetDatabase="${propel.database}"
304       outputDirectory="${propel.output.dir}"
305       templatePath="${propel.templatePath}">
306       <!-- TODO: add properties for the mapper type, from, and to -->
307       <mapper type="glob" from="${propel.datadtd.mapper.from}" to="${propel.datadtd.mapper.to}"/>
308       <schemafileset dir="${propel.schema.dir}"
309         includes="${propel.schema.datadtd.includes}"
310         excludes="${propel.schema.datadtd.excludes}"
311       />
312     </propel-data-dtd>
313   </target>
314
315   <!-- ================================================================ -->
316   <!-- 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          -->
317   <!-- ================================================================ -->
318   <!-- Generate the Peer-based object model for your project.           -->
319   <!-- These are in addition to the base Propel OM!                     -->
320   <!-- ================================================================ -->
321
322   <target
323     name="om-check"
324     depends="check-run-only-on-schema-change"
325     if="propel.internal.runOnlyOnSchemaChange">
326     <uptodate
327       property="propel.internal.om.uptodate"
328       targetfile="${propel.php.dir}/report.${propel.project}.om.generation">
329       <srcfiles dir="${propel.schema.dir}" includes="**/${propel.schema.om.includes}.xml" />
330     </uptodate>
331   </target>
332
333   <target
334     name="om"
335     depends="om-check"
336     unless="propel.internal.om.uptodate"
337     description="==> generates the Peer-based object model for your project">
338
339     <echo message="+------------------------------------------+"/>
340     <echo message="|                                          |"/>
341     <echo message="| Generating Peer-based Object Model for   |"/>
342     <echo message="| YOUR Propel project!                     |"/>
343     <echo message="|                                          |"/>
344     <echo message="+------------------------------------------+"/>
345
346     <phingcall target="om-template"/>
347     <!--<phingcall target="om-tar"/>-->
348   </target>
349
350   <target name="om-template">
351     <propel-om
352       outputDirectory="${propel.php.dir}"
353       targetDatabase="${propel.database}"
354       targetPackage="${propel.targetPackage}"
355       templatePath="${propel.templatePath}"
356       targetPlatform="${propel.targetPlatform}">
357       <schemafileset dir="${propel.schema.dir}"
358         includes="${propel.schema.om.includes}"
359         excludes="${propel.schema.om.excludes}"
360       />
361     </propel-om>
362   </target>
363
364   <!-- ================================================================== -->
365   <!-- P R O P S   T O   P H P   A R R A Y                                -->
366   <!-- ================================================================== -->
367
368   <target
369     name="convert-props"
370     description="==> converts properties file to PHP array">
371
372     <echo message="+------------------------------------------+"/>
373     <echo message="|                                          |"/>
374     <echo message="| Converting project properties file to an |"/>
375     <echo message="| array dump for run-time performance.     |"/>
376     <echo message="|                                          |"/>
377     <echo message="+------------------------------------------+"/>
378
379     <capsule
380       templatePath="${propel.templatePath}"
381       controlTemplate="${propel.template.conf}"
382       outputDirectory="${propel.phpconf.dir}"
383       outputFile="${propel.runtime.phpconf.file}">
384       <assign name="propertiesFile" value="${propel.conf.dir}/${propel.runtime.conf.file}"/>
385      </capsule>
386
387   </target>
388
389   <target
390     name="graphviz"
391     depends="sql-check"
392     description="==> generates Graphviz file for your project">
393
394     <echo message="+------------------------------------------+"/>
395     <echo message="|                                          |"/>
396     <echo message="| Generating Graphiz for YOUR Propel       |"/>
397     <echo message="| project!                                 |"/>
398     <echo message="|                                          |"/>
399     <echo message="+------------------------------------------+"/>
400
401     <propel-graphviz
402       outputDirectory="${propel.graph.dir}"
403       targetDatabase="${propel.database}"
404       sqldbmap="${propel.sql.dir}/sqldb.map">
405       <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
406       <schemafileset dir="${propel.schema.dir}"
407         includes="${propel.schema.sql.includes}"
408         excludes="${propel.schema.sql.excludes}"
409       />
410     </propel-graphviz>
411   </target>
412
413
414 </project>
Note: See TracBrowser for help on using the browser.