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

Revision 535, 21.5 kB (checked in by heltem, 2 years ago)

Set svn:keywords property uniformly to .php, .xml and .properties files

  • Property svn:keywords set to Id Rev Date Author HeadURL Revision
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 name="propel.home" value="."/>
16  
17   <available file="${propel.home}/build.properties" property="globalBuildPopertiesExists"/>
18  
19   <if>
20         <and>
21                 <isset property="globalBuildPopertiesExists"/>
22         </and>
23         <then>
24             <property file="${propel.home}/build.properties"/>
25         </then>
26   </if> 
27
28   <!--
29     The default.properties file will map old properties to the new ones along
30     with setting the corret defaults.
31   -->
32   <property file="${propel.home}/default.properties"/>
33
34   <!--
35     Do forward declarations of all of our tasks to
36     centralize them and clean up the targets.
37   -->
38
39   <path id="propelclasses">
40     <pathelement dir="${propel.home}/classes/"/>
41   </path>
42
43   <taskdef
44     name="propel-data-model"
45     classname="propel.phing.PropelDataModelTask" classpathRef="propelclasses"/>
46   <taskdef
47     name="propel-old-om"
48     classname="propel.phing.PropelOldOMTask" classpathRef="propelclasses"/>
49   <taskdef
50     name="propel-om"
51     classname="propel.phing.PropelOMTask" classpathRef="propelclasses"/>
52   <taskdef
53     name="propel-data-dtd"
54     classname="propel.phing.PropelDataDTDTask" classpathRef="propelclasses"/>
55   <taskdef
56     name="propel-data-dump"
57     classname="propel.phing.PropelDataDumpTask" classpathRef="propelclasses"/>
58   <taskdef
59     name="propel-data-sql"
60     classname="propel.phing.PropelDataSQLTask" classpathRef="propelclasses"/>
61    <taskdef
62     name="propel-creole-transform"
63     classname="propel.phing.PropelCreoleTransformTask" classpathRef="propelclasses"/>
64   <taskdef
65     name="propel-sql"
66     classname="propel.phing.PropelSQLTask" classpathRef="propelclasses"/>
67   <taskdef
68     name="propel-old-sql"
69     classname="propel.phing.PropelOldSQLTask" classpathRef="propelclasses"/>
70   <taskdef
71     name="propel-sql-exec"
72     classname="propel.phing.PropelSQLExec" classpathRef="propelclasses"/>
73   <taskdef
74     name="propel-graphviz"
75     classname="propel.phing.PropelGraphvizTask" classpathRef="propelclasses"/>
76
77
78   <!-- ================================================================ -->
79   <!-- M A I N  T A R G E T                                             -->
80   <!-- ================================================================ -->
81   <!-- This default target will run all the targets that generate       -->
82   <!-- source. You will probably only run this target once then         -->
83   <!-- call individual targets as necessary to update your sources      -->
84   <!-- when you change your XML schema.                                 -->
85   <!-- ================================================================ -->
86
87   <target
88     name="main"
89     description="==> generates sql + om classes">
90
91     <phingcall target="sql"/>
92     <phingcall target="om"/>
93     <phingcall target="convert-props"/>
94   </target>
95
96   <target
97     name="old-build"
98     description="==> generates sql + [new] om classes">
99
100     <phingcall target="sql"/>
101     <phingcall target="old-om"/>
102     <phingcall target="convert-props"/>
103   </target>
104
105   <!-- ================================================================ -->
106   <!-- 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         -->
107   <!-- ================================================================ -->
108   <!-- Maps the propel.runOnlyOnSchemaChange to                         -->
109   <!-- propel.internal.runOnlyOnSchemaChange                            -->
110   <!-- ================================================================ -->
111
112   <target name="check-run-only-on-schema-change">
113     <condition property="propel.internal.runOnlyOnSchemaChange">
114       <equals arg1="${propel.runOnlyOnSchemaChange}" arg2="true"/>
115     </condition>
116   </target>
117
118   <!-- ================================================================ -->
119   <!-- G E N E R A T E  P R O J E C T  S Q L                            -->
120   <!-- ================================================================ -->
121   <!-- Generate the SQL for your project, These are in addition         -->
122   <!-- to the base Turbine tables! The tables you require for your      -->
123   <!-- project should be specified in project-schema.xml.               -->
124   <!-- ================================================================ -->
125
126   <target
127     name="sql-check"
128     depends="check-run-only-on-schema-change"
129     if="propel.internal.runOnlyOnSchemaChange">
130     <uptodate
131       property="propel.internal.sql.uptodate"
132       targetfile="${propel.sql.dir}/${propel.schema.default.basename}.sql">
133       <srcfiles dir="${propel.schema.dir}" includes="**/${propel.schema.default.basename}.xml" />
134     </uptodate>
135   </target>
136
137   <!--  temporary target to check whether postgres is being used with identifier quoting ON.
138                 If so, a warning is issued, since identifier quoting is only paritally implemented & this point.  -->
139   <target name="pgsql-quoting-check">
140         <if>
141                 <and>
142                         <equals arg1="${propel.database}" arg2="pgsql"/>
143                         <equals arg1="${propel.disableIdentifierQuoting}" arg2=""/>
144                 </and>
145                 <then>
146                         <warn>ATTENTION: It appears you are using PostgreSQL and you have identifier-quoting turned on.</warn>
147                         <warn>It is suggested that you disable identifier quoting when using PostgreSQL -- especially if you</warn>
148                         <warn>have case-sensitive columns in your database.</warn>
149                         <warn></warn>
150                         <warn>To disable identifier quoting, add the following property to your build.properties (or specify</warn>
151                         <warn>it using -D on commandline):</warn>
152                         <warn></warn>
153                         <warn>propel.disableIdentifierQuoting=true</warn>
154                         <warn></warn>
155                         <warn>You can ignore this warning if you understand the issues related to case-sensitivity and Propel's</warn>
156                         <warn>DDL-only implementation of identifier quoting.</warn>
157                 </then>
158         </if>
159   </target>
160
161   <target
162     name="sql"
163     depends="sql-check,pgsql-quoting-check"
164     unless="propel.internal.sql.uptodate"
165     description="==> generates the SQL for your project">
166
167     <echo message="+------------------------------------------+"/>
168     <echo message="|                                          |"/>
169     <echo message="| Generating SQL for YOUR Propel project!  |"/>
170     <echo message="|                                          |"/>
171     <echo message="+------------------------------------------+"/>
172
173     <phingcall target="sql-template"/>
174
175   </target>
176
177   <target name="sql-template">
178     <propel-sql
179           validate="${propel.schema.validate}"
180           xsd="${propel.schema.xsd.file}"
181           xsl="${propel.schema.xsl.file}"
182       outputDirectory="${propel.sql.dir}"
183       sqldbmap="${propel.sql.dir}/sqldb.map"
184       targetDatabase="${propel.database}"
185       templatePath="${propel.templatePath}"
186       packageObjectModel="${propel.packageObjectModel}"
187       >
188       <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
189       <schemafileset dir="${propel.schema.dir}"
190         includes="${propel.schema.sql.includes}"
191         excludes="${propel.schema.sql.excludes}"
192       />
193     </propel-sql>
194   </target>
195
196
197   <target
198     name="old-sql"
199     depends="sql-check"
200     unless="propel.internal.sql.uptodate"
201     description="==> generates the SQL for your project">
202
203     <echo message="+------------------------------------------+"/>
204     <echo message="|                                          |"/>
205     <echo message="| Generating SQL for YOUR Propel project!  |"/>
206     <echo message="| (using deprecated legacy SQL template)   |"/>
207         <echo message="|                                          |"/>
208     <echo message="+------------------------------------------+"/>
209
210     <phingcall target="old-sql-template"/>
211
212   </target>
213
214   <target name="old-sql-template">
215     <propel-old-sql
216           validate="${propel.schema.validate}"
217           xsd="${propel.schema.xsd.file}"
218           xsl="${propel.schema.xsl.file}"
219       outputDirectory="${propel.sql.dir}"
220       sqldbmap="${propel.sql.dir}/sqldb.map"
221       targetDatabase="${propel.database}"
222       templatePath="${propel.templatePath}"
223       packageObjectModel="${propel.packageObjectModel}"
224       >
225       <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
226       <schemafileset dir="${propel.schema.dir}"
227         includes="${propel.schema.sql.includes}"
228         excludes="${propel.schema.sql.excludes}"
229       />
230     </propel-old-sql>
231   </target>
232
233   <!-- ================================================================ -->
234   <!-- C R E A T E  T A R G E T  D A T A B A S E                        -->
235   <!-- ================================================================ -->
236   <!-- Create the target database by executing a generated script       -->
237   <!-- that is capable of performing the task.                          -->
238   <!-- ================================================================ -->
239
240   <target name="create-db-check">
241     <condition property="propel.internal.manualCreation">
242       <equals arg1="${propel.database.manualCreation}" arg2="true"/>
243     </condition>
244   </target>
245
246   <target
247     name="create-db"
248     unless="propel.internal.manualCreation"
249     depends="create-db-check"
250     description="==> generates the target database">
251
252     <propel-data-model
253           validate="${propel.schema.validate}"
254           xsd="${propel.schema.xsd.file}"
255           xsl="${propel.schema.xsl.file}"
256       controlTemplate="${propel.template.sqlDbInit}"
257       outputDirectory="${propel.sql.dir}"
258       outputFile="create-db.sql"
259       targetDatabase="${propel.database}"
260       dbEncoding="${propel.database.encoding}"
261       templatePath="${propel.templatePath}"
262       packageObjectModel="${propel.packageObjectModel}"
263       >
264       <schemafileset dir="${propel.schema.dir}"
265         includes="${propel.schema.create-db.includes}"
266         excludes="${propel.schema.create-db.excludes}"
267       />
268     </propel-data-model>
269
270     <echo message="Executing the create-db.sql script ..."/>
271
272     <sql
273       autocommit="true"
274       driver="${propel.database.driver}"
275       onerror="continue"
276       src="${propel.sql.dir}/create-db.sql"
277       url="${propel.database.createUrl}"
278     />
279   </target>
280
281   <!-- ================================================================ -->
282   <!-- I N S E R T  S I N G L E  S Q L  F I L E S                       -->
283   <!-- ================================================================ -->
284
285   <target
286     name="insert-sql"
287     description="==> inserts the generated sql ">
288
289     <propel-sql-exec
290       autocommit="true"
291       driver="${propel.database.driver}"
292       onerror="continue"
293       sqldbmap="${propel.sql.dir}/sqldb.map"
294       srcDir="${propel.sql.dir}"
295       url="${propel.database.buildUrl}"
296     />
297   </target>
298
299   <!-- ================================================================ -->
300   <!-- C R E O L E  TO  X M L                                               -->
301   <!-- ================================================================ -->
302
303   <target
304     name="creole"
305     description="==> generate xml schema from Creole metadata">
306
307     <echo message="+-----------------------------------------------+"/>
308     <echo message="|                                               |"/>
309     <echo message="| Generating XML from Creole connection !       |"/>
310     <echo message="|                                               |"/>
311     <echo message="+-----------------------------------------------+"/>
312
313     <propel-creole-transform
314       dbDriver="${propel.database.driver}"
315       dbSchema="${propel.database.schema}"
316       dbEncoding="${propel.database.encoding}"
317       dbUrl="${propel.database.url}"
318       outputFile="${propel.schema.dir}/${propel.default.schema.basename}.xml"
319       samePhpName="${propel.samePhpName}"
320       addVendorInfo="${propel.addVendorInfo}"
321       addValidators="${propel.addValidators}"
322     />
323   </target>
324
325   <!-- ================================================================ -->
326   <!-- Generate SQL from XML data file                                  -->
327   <!-- ================================================================ -->
328
329   <target
330     name="datasql"
331     description="==> generates sql from data xml">
332
333     <echo message="+-----------------------------------------------+"/>
334     <echo message="|                                               |"/>
335     <echo message="| Generating SQL from data XML !                |"/>
336     <echo message="|                                               |"/>
337     <echo message="+-----------------------------------------------+"/>
338
339     <propel-data-sql
340           validate="${propel.schema.validate}"
341           xsd="${propel.schema.xsd.file}"
342           xsl="${propel.schema.xsl.file}"
343       outputDirectory="${propel.sql.dir}"
344       sqldbmap="${propel.sql.dir}/sqldb.map"
345       dbEncoding="${propel.database.encoding}"
346       targetDatabase="${propel.database}"
347       templatePath="${propel.templatePath}"
348       datadbmap="${propel.schema.dir}/datadb.map"
349       srcDir="${propel.schema.dir}"
350       >
351       <mapper type="glob" from="${propel.datasql.mapper.from}" to="${propel.datasql.mapper.to}"/>
352       <schemafileset dir="${propel.schema.dir}"
353         includes="${propel.schema.datadtd.includes}"
354         excludes="${propel.schema.datadtd.excludes}"
355       />
356     </propel-data-sql>
357   </target>
358
359   <!-- ================================================================ -->
360   <!-- Dump data from database into xml file                            -->
361   <!-- ================================================================ -->
362
363   <target
364     name="datadump"
365     description="==> dump data from database into xml file">
366
367     <echo message="+-----------------------------------------------+"/>
368     <echo message="|                                               |"/>
369     <echo message="| Dumping the data from database into XML       |"/>
370     <echo message="|                                               |"/>
371     <echo message="+-----------------------------------------------+"/>
372
373     <propel-data-dump
374           validate="${propel.schema.validate}"
375           xsd="${propel.schema.xsd.file}"
376           xsl="${propel.schema.xsl.file}"
377       targetDatabase="${propel.database}"
378       datadbmap="${propel.schema.dir}/datadb.map"
379       databaseDriver="${propel.database.driver}"
380       dbEncoding="${propel.database.encoding}"
381       databaseUrl="${propel.database.url}"
382       outputDirectory="${propel.schema.dir}"
383       templatePath="${propel.templatePath}">
384       <mapper type="glob" from="${propel.datadump.mapper.from}" to="${propel.datadump.mapper.to}"/>
385       <schemafileset dir="${propel.schema.dir}"
386         includes="${propel.schema.datadtd.includes}"
387         excludes="${propel.schema.datadtd.excludes}"
388       />
389      </propel-data-dump>
390   </target>
391
392   <!-- ================================================================ -->
393   <!-- G E N E R A T E  P R O J E C T  D A T A  D T D                   -->
394   <!-- ================================================================ -->
395   <!-- Generate the DATA DTD for your project                           -->
396   <!-- ================================================================ -->
397
398   <target
399     name="datadtd"
400     description="==> generates the DATA DTD for your project">
401
402     <echo message="+-----------------------------------------------+"/>
403     <echo message="|                                               |"/>
404     <echo message="| Generating Data DTD for YOUR Propel project!  |"/>
405     <echo message="|                                               |"/>
406     <echo message="+-----------------------------------------------+"/>
407
408     <propel-data-dtd
409           validate="${propel.schema.validate}"
410           xsd="${propel.schema.xsd.file}"
411           xsl="${propel.schema.xsl.file}"
412       targetDatabase="${propel.database}"
413       outputDirectory="${propel.output.dir}"
414       templatePath="${propel.templatePath}">
415       <!-- TODO: add properties for the mapper type, from, and to -->
416       <mapper type="glob" from="${propel.datadtd.mapper.from}" to="${propel.datadtd.mapper.to}"/>
417       <schemafileset dir="${propel.schema.dir}"
418         includes="${propel.schema.datadtd.includes}"
419         excludes="${propel.schema.datadtd.excludes}"
420       />
421     </propel-data-dtd>
422   </target>
423
424   <!-- ================================================================ -->
425   <!-- 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          -->
426   <!-- ================================================================ -->
427   <!-- Generate the Peer-based object model for your project.           -->
428   <!-- These are in addition to the base Propel OM!                     -->
429   <!-- ================================================================ -->
430
431   <target
432     name="om-check"
433     depends="check-run-only-on-schema-change"
434     if="propel.internal.runOnlyOnSchemaChange">
435     <uptodate
436       property="propel.internal.om.uptodate"
437       targetfile="${propel.php.dir}/report.${propel.project}.om.generation">
438       <srcfiles dir="${propel.schema.dir}" includes="**/${propel.schema.om.includes}.xml" />
439     </uptodate>
440   </target>
441
442   <target
443     name="om"
444     depends="om-check"
445     unless="propel.internal.om.uptodate"
446     description="==> generates the Peer-based object model for your project">
447
448     <echo message="+------------------------------------------+"/>
449     <echo message="|                                          |"/>
450     <echo message="| Generating Peer-based Object Model for   |"/>
451     <echo message="| YOUR Propel project! (NEW OM BUILDERS)!  |"/>
452     <echo message="|                                          |"/>
453     <echo message="+------------------------------------------+"/>
454
455     <phingcall target="om-template"/>
456     <!--<phingcall target="om-tar"/>-->
457   </target>
458
459   <target name="om-template">
460     <propel-om
461           validate="${propel.schema.validate}"
462           xsd="${propel.schema.xsd.file}"
463           xsl="${propel.schema.xsl.file}"
464       outputDirectory="${propel.php.dir}"
465       targetDatabase="${propel.database}"
466       targetPackage="${propel.targetPackage}"
467       templatePath="${propel.templatePath}"
468       targetPlatform="${propel.targetPlatform}"
469       packageObjectModel="${propel.packageObjectModel}"
470       >
471       <schemafileset dir="${propel.schema.dir}"
472         includes="${propel.schema.om.includes}"
473         excludes="${propel.schema.om.excludes}"
474       />
475     </propel-om>
476   </target>
477
478   <!-- the new OM tasks -->
479
480   <target
481     name="old-om"
482     depends="om-check"
483     unless="propel.internal.om.uptodate"
484     description="==> generates the OLD Peer-based object model for your project">
485
486     <echo message="+------------------------------------------+"/>
487     <echo message="|                                          |"/>
488     <echo message="| Generating Peer-based Object Model for   |"/>
489     <echo message="| YOUR Propel project (OLD OM TEMPLATES).  |"/>
490     <echo message="|                                          |"/>
491     <echo message="+------------------------------------------+"/>
492
493     <phingcall target="old-om-template"/>
494     <!--<phingcall target="om-tar"/>-->
495   </target>
496
497   <target name="old-om-template">
498     <propel-old-om
499           validate="${propel.schema.validate}"
500           xsd="${propel.schema.xsd.file}"
501           xsl="${propel.schema.xsl.file}"
502       outputDirectory="${propel.php.dir}"
503       targetDatabase="${propel.database}"
504       targetPackage="${propel.targetPackage}"
505       templatePath="${propel.templatePath}"
506       targetPlatform="${propel.targetPlatform}">
507       <schemafileset dir="${propel.schema.dir}"
508         includes="${propel.schema.om.includes}"
509         excludes="${propel.schema.om.excludes}"
510       />
511     </propel-old-om>
512   </target>
513
514
515   <!-- ================================================================== -->
516   <!-- P R O P S   T O   P H P   A R R A Y                                -->
517   <!-- ================================================================== -->
518
519   <target
520     name="convert-props"
521     description="==> converts properties file to PHP array">
522
523     <echo message="+------------------------------------------+"/>
524     <echo message="|                                          |"/>
525     <echo message="| Converting project properties file to an |"/>
526     <echo message="| array dump for run-time performance.     |"/>
527     <echo message="|                                          |"/>
528     <echo message="+------------------------------------------+"/>
529
530     <capsule
531       templatePath="${propel.templatePath}"
532       controlTemplate="${propel.template.conf}"
533       outputDirectory="${propel.phpconf.dir}"
534       outputFile="${propel.runtime.phpconf.file}">
535       <assign name="propertiesFile" value="${propel.conf.dir}/${propel.runtime.conf.file}"/>
536      </capsule>
537
538   </target>
539
540   <target
541     name="graphviz"
542     depends="sql-check"
543     description="==> generates Graphviz file for your project">
544
545     <echo message="+------------------------------------------+"/>
546     <echo message="|                                          |"/>
547     <echo message="| Generating Graphiz for YOUR Propel       |"/>
548     <echo message="| project!                                 |"/>
549     <echo message="|                                          |"/>
550     <echo message="+------------------------------------------+"/>
551
552     <propel-graphviz
553       outputDirectory="${propel.graph.dir}"
554       targetDatabase="${propel.database}"
555       sqldbmap="${propel.sql.dir}/sqldb.map"
556       packageObjectModel="${propel.packageObjectModel}">
557       <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
558       <schemafileset dir="${propel.schema.dir}"
559         includes="${propel.schema.sql.includes}"
560         excludes="${propel.schema.sql.excludes}"
561       />
562     </propel-graphviz>
563   </target>
564
565
566 </project>
Note: See TracBrowser for help on using the browser.