root/branches/criteria2-experiment/generator/build-propel.xml

Revision 513, 18.3 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.PropelDataModelTemplateTask" classpathRef="propelclasses"/>
46   <taskdef
47     name="propel-om"
48     classname="propel.phing.PropelOMTask" classpathRef="propelclasses"/>
49   <taskdef
50     name="propel-data-dtd"
51     classname="propel.phing.PropelDataDTDTask" classpathRef="propelclasses"/>
52   <taskdef
53     name="propel-data-dump"
54     classname="propel.phing.PropelDataDumpTask" classpathRef="propelclasses"/>
55   <taskdef
56     name="propel-data-sql"
57     classname="propel.phing.PropelDataSQLTask" classpathRef="propelclasses"/>
58    <taskdef
59     name="propel-creole-transform"
60     classname="propel.phing.PropelCreoleTransformTask" classpathRef="propelclasses"/>
61   <taskdef
62     name="propel-sql"
63     classname="propel.phing.PropelSQLTask" classpathRef="propelclasses"/>
64   <taskdef
65     name="propel-sql-exec"
66     classname="propel.phing.PropelSQLExec" classpathRef="propelclasses"/>
67   <taskdef
68     name="propel-graphviz"
69     classname="propel.phing.PropelGraphvizTask" classpathRef="propelclasses"/>
70
71
72   <!-- ================================================================ -->
73   <!-- M A I N  T A R G E T                                             -->
74   <!-- ================================================================ -->
75   <!-- This default target will run all the targets that generate       -->
76   <!-- source. You will probably only run this target once then         -->
77   <!-- call individual targets as necessary to update your sources      -->
78   <!-- when you change your XML schema.                                 -->
79   <!-- ================================================================ -->
80
81   <target
82     name="main"
83     description="==> generates sql + om classes">
84
85     <phingcall target="sql"/>
86     <phingcall target="om"/>
87     <phingcall target="copy-runtime-conf"/>
88   </target>
89
90   <!-- ================================================================ -->
91   <!-- 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         -->
92   <!-- ================================================================ -->
93   <!-- Maps the propel.runOnlyOnSchemaChange to                         -->
94   <!-- propel.internal.runOnlyOnSchemaChange                            -->
95   <!-- ================================================================ -->
96
97   <target name="check-run-only-on-schema-change">
98     <condition property="propel.internal.runOnlyOnSchemaChange">
99       <equals arg1="${propel.runOnlyOnSchemaChange}" arg2="true"/>
100     </condition>
101   </target>
102
103   <!-- ================================================================ -->
104   <!-- G E N E R A T E  P R O J E C T  S Q L                            -->
105   <!-- ================================================================ -->
106   <!-- Generate the SQL for your project, These are in addition         -->
107   <!-- to the base Turbine tables! The tables you require for your      -->
108   <!-- project should be specified in project-schema.xml.               -->
109   <!-- ================================================================ -->
110
111   <target
112     name="sql-check"
113     depends="check-run-only-on-schema-change"
114     if="propel.internal.runOnlyOnSchemaChange">
115     <uptodate
116       property="propel.internal.sql.uptodate"
117       targetfile="${propel.sql.dir}/${propel.schema.default.basename}.sql">
118       <srcfiles dir="${propel.schema.dir}" includes="**/${propel.schema.default.basename}.xml" />
119     </uptodate>
120   </target>
121
122   <!--  temporary target to check whether postgres is being used with identifier quoting ON.
123                 If so, a warning is issued, since identifier quoting is only paritally implemented & this point.  -->
124   <target name="pgsql-quoting-check">
125         <if>
126                 <and>
127                         <equals arg1="${propel.database}" arg2="pgsql"/>
128                         <equals arg1="${propel.disableIdentifierQuoting}" arg2=""/>
129                 </and>
130                 <then>
131                         <warn>ATTENTION: It appears you are using PostgreSQL and you have identifier-quoting turned on.</warn>
132                         <warn>It is suggested that you disable identifier quoting when using PostgreSQL -- especially if you</warn>
133                         <warn>have case-sensitive columns in your database.</warn>
134                         <warn></warn>
135                         <warn>To disable identifier quoting, add the following property to your build.properties (or specify</warn>
136                         <warn>it using -D on commandline):</warn>
137                         <warn></warn>
138                         <warn>propel.disableIdentifierQuoting=true</warn>
139                         <warn></warn>
140                         <warn>You can ignore this warning if you understand the issues related to case-sensitivity and Propel's</warn>
141                         <warn>DDL-only implementation of identifier quoting.</warn>
142                 </then>
143         </if>
144   </target>
145
146   <target
147     name="sql"
148     depends="sql-check,pgsql-quoting-check"
149     unless="propel.internal.sql.uptodate"
150     description="==> generates the SQL for your project">
151
152     <echo message="+------------------------------------------+"/>
153     <echo message="|                                          |"/>
154     <echo message="| Generating SQL for YOUR Propel project!  |"/>
155     <echo message="|                                          |"/>
156     <echo message="+------------------------------------------+"/>
157
158     <phingcall target="sql-template"/>
159
160   </target>
161
162   <target name="sql-template">
163     <propel-sql
164           validate="${propel.schema.validate}"
165           xsd="${propel.schema.xsd.file}"
166           xsl="${propel.schema.xsl.file}"
167       outputDirectory="${propel.sql.dir}"
168       sqldbmap="${propel.sql.dir}/sqldb.map"
169       targetDatabase="${propel.database}"
170       packageObjectModel="${propel.packageObjectModel}"
171       >
172       <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
173       <schemafileset dir="${propel.schema.dir}"
174         includes="${propel.schema.sql.includes}"
175         excludes="${propel.schema.sql.excludes}"
176       />
177     </propel-sql>
178   </target>
179
180   <!-- ================================================================ -->
181   <!-- C R E A T E  T A R G E T  D A T A B A S E                        -->
182   <!-- ================================================================ -->
183   <!-- Create the target database by executing a generated script       -->
184   <!-- that is capable of performing the task.                          -->
185   <!-- ================================================================ -->
186
187   <target name="create-db-check">
188     <condition property="propel.internal.manualCreation">
189       <equals arg1="${propel.database.manualCreation}" arg2="true"/>
190     </condition>
191   </target>
192
193   <target
194     name="create-db"
195     unless="propel.internal.manualCreation"
196     depends="create-db-check"
197     description="==> generates the target database">
198
199     <propel-data-model
200           validate="${propel.schema.validate}"
201           xsd="${propel.schema.xsd.file}"
202           xsl="${propel.schema.xsl.file}"
203       controlTemplate="${propel.template.sqlDbInit}"
204       outputDirectory="${propel.sql.dir}"
205       outputFile="create-db.sql"
206       targetDatabase="${propel.database}"
207       dbEncoding="${propel.database.encoding}"
208       templatePath="${propel.templatePath}"
209       packageObjectModel="${propel.packageObjectModel}"
210       >
211       <schemafileset dir="${propel.schema.dir}"
212         includes="${propel.schema.create-db.includes}"
213         excludes="${propel.schema.create-db.excludes}"
214       />
215     </propel-data-model>
216
217     <echo message="Executing the create-db.sql script ..."/>
218
219     <sql
220       autocommit="true"
221       driver="${propel.database.driver}"
222       onerror="continue"
223       src="${propel.sql.dir}/create-db.sql"
224       url="${propel.database.createUrl}"
225     />
226   </target>
227
228   <!-- ================================================================ -->
229   <!-- I N S E R T  S I N G L E  S Q L  F I L E S                       -->
230   <!-- ================================================================ -->
231
232   <target
233     name="insert-sql"
234     description="==> inserts the generated sql ">
235
236     <propel-sql-exec
237       autocommit="true"
238       driver="${propel.database.driver}"
239       onerror="continue"
240       sqldbmap="${propel.sql.dir}/sqldb.map"
241       srcDir="${propel.sql.dir}"
242       url="${propel.database.buildUrl}"
243     />
244   </target>
245
246   <!-- ================================================================ -->
247   <!-- C R E O L E  TO  X M L                                               -->
248   <!-- ================================================================ -->
249
250   <target
251     name="creole"
252     description="==> generate xml schema from Creole metadata">
253
254     <echo message="+-----------------------------------------------+"/>
255     <echo message="|                                               |"/>
256     <echo message="| Generating XML from Creole connection !       |"/>
257     <echo message="|                                               |"/>
258     <echo message="+-----------------------------------------------+"/>
259
260     <propel-creole-transform
261       dbDriver="${propel.database.driver}"
262       dbSchema="${propel.database.schema}"
263       dbEncoding="${propel.database.encoding}"
264       dbUrl="${propel.database.url}"
265       outputFile="${propel.schema.dir}/${propel.default.schema.basename}.xml"
266       samePhpName="${propel.samePhpName}"
267       addVendorInfo="${propel.addVendorInfo}"
268       addValidators="${propel.addValidators}"
269     />
270   </target>
271
272   <!-- ================================================================ -->
273   <!-- Generate SQL from XML data file                                  -->
274   <!-- ================================================================ -->
275
276   <target
277     name="datasql"
278     description="==> generates sql from data xml">
279
280     <echo message="+-----------------------------------------------+"/>
281     <echo message="|                                               |"/>
282     <echo message="| Generating SQL from data XML !                |"/>
283     <echo message="|                                               |"/>
284     <echo message="+-----------------------------------------------+"/>
285
286     <propel-data-sql
287           validate="${propel.schema.validate}"
288           xsd="${propel.schema.xsd.file}"
289           xsl="${propel.schema.xsl.file}"
290       outputDirectory="${propel.sql.dir}"
291       sqldbmap="${propel.sql.dir}/sqldb.map"
292       dbEncoding="${propel.database.encoding}"
293       targetDatabase="${propel.database}"
294       datadbmap="${propel.schema.dir}/datadb.map"
295       srcDir="${propel.schema.dir}"
296       >
297       <mapper type="glob" from="${propel.datasql.mapper.from}" to="${propel.datasql.mapper.to}"/>
298       <schemafileset dir="${propel.schema.dir}"
299         includes="${propel.schema.datadtd.includes}"
300         excludes="${propel.schema.datadtd.excludes}"
301       />
302     </propel-data-sql>
303   </target>
304
305   <!-- ================================================================ -->
306   <!-- Dump data from database into xml file                            -->
307   <!-- ================================================================ -->
308
309   <target
310     name="datadump"
311     description="==> dump data from database into xml file">
312
313     <echo message="+-----------------------------------------------+"/>
314     <echo message="|                                               |"/>
315     <echo message="| Dumping the data from database into XML       |"/>
316     <echo message="|                                               |"/>
317     <echo message="+-----------------------------------------------+"/>
318
319     <propel-data-dump
320           validate="${propel.schema.validate}"
321           xsd="${propel.schema.xsd.file}"
322           xsl="${propel.schema.xsl.file}"
323       targetDatabase="${propel.database}"
324       datadbmap="${propel.schema.dir}/datadb.map"
325       databaseDriver="${propel.database.driver}"
326       dbEncoding="${propel.database.encoding}"
327       databaseUrl="${propel.database.url}"
328       outputDirectory="${propel.schema.dir}">
329       <mapper type="glob" from="${propel.datadump.mapper.from}" to="${propel.datadump.mapper.to}"/>
330       <schemafileset dir="${propel.schema.dir}"
331         includes="${propel.schema.datadtd.includes}"
332         excludes="${propel.schema.datadtd.excludes}"
333       />
334      </propel-data-dump>
335   </target>
336
337   <!-- ================================================================ -->
338   <!-- G E N E R A T E  P R O J E C T  D A T A  D T D                   -->
339   <!-- ================================================================ -->
340   <!-- Generate the DATA DTD for your project                           -->
341   <!-- ================================================================ -->
342
343   <target
344     name="datadtd"
345     description="==> generates the DATA DTD for your project">
346
347     <echo message="+-----------------------------------------------+"/>
348     <echo message="|                                               |"/>
349     <echo message="| Generating Data DTD for YOUR Propel project!  |"/>
350     <echo message="|                                               |"/>
351     <echo message="+-----------------------------------------------+"/>
352
353     <propel-data-dtd
354           validate="${propel.schema.validate}"
355           xsd="${propel.schema.xsd.file}"
356           xsl="${propel.schema.xsl.file}"
357       targetDatabase="${propel.database}"
358       outputDirectory="${propel.output.dir}"
359       templatePath="${propel.templatePath}">
360       <!-- TODO: add properties for the mapper type, from, and to -->
361       <mapper type="glob" from="${propel.datadtd.mapper.from}" to="${propel.datadtd.mapper.to}"/>
362       <schemafileset dir="${propel.schema.dir}"
363         includes="${propel.schema.datadtd.includes}"
364         excludes="${propel.schema.datadtd.excludes}"
365       />
366     </propel-data-dtd>
367   </target>
368
369   <!-- ================================================================ -->
370   <!-- 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          -->
371   <!-- ================================================================ -->
372   <!-- Generate the Peer-based object model for your project.           -->
373   <!-- These are in addition to the base Propel OM!                     -->
374   <!-- ================================================================ -->
375
376   <target
377     name="om-check"
378     depends="check-run-only-on-schema-change"
379     if="propel.internal.runOnlyOnSchemaChange">
380     <uptodate
381       property="propel.internal.om.uptodate"
382       targetfile="${propel.php.dir}/report.${propel.project}.om.generation">
383       <srcfiles dir="${propel.schema.dir}" includes="**/${propel.schema.om.includes}.xml" />
384     </uptodate>
385   </target>
386
387   <target
388     name="om"
389     depends="om-check"
390     unless="propel.internal.om.uptodate"
391     description="==> generates the Peer-based object model for your project">
392
393     <echo message="+------------------------------------------+"/>
394     <echo message="|                                          |"/>
395     <echo message="| Generating Peer-based Object Model for   |"/>
396     <echo message="| YOUR Propel project! (NEW OM BUILDERS)!  |"/>
397     <echo message="|                                          |"/>
398     <echo message="+------------------------------------------+"/>
399
400     <phingcall target="om-template"/>
401     <!--<phingcall target="om-tar"/>-->
402   </target>
403
404   <target name="om-template">
405     <propel-om
406           validate="${propel.schema.validate}"
407           xsd="${propel.schema.xsd.file}"
408           xsl="${propel.schema.xsl.file}"
409       outputDirectory="${propel.php.dir}"
410       targetDatabase="${propel.database}"
411       targetPackage="${propel.targetPackage}"
412       targetPlatform="${propel.targetPlatform}"
413       packageObjectModel="${propel.packageObjectModel}"
414       >
415       <schemafileset dir="${propel.schema.dir}"
416         includes="${propel.schema.om.includes}"
417         excludes="${propel.schema.om.excludes}"
418       />
419     </propel-om>
420   </target>
421
422   <!-- ================================================================== -->
423   <!-- P R O P S   T O   P H P   A R R A Y                                -->
424   <!-- ================================================================== -->
425
426   <target
427     name="copy-runtime-conf"
428     description="==> converts properties file to PHP array">
429
430     <echo message="+------------------------------------------+"/>
431     <echo message="|                                          |"/>
432     <echo message="| Copying your runtime config file(s) to   |"/>
433     <echo message="| the output directory.                    |"/>
434     <echo message="|                                          |"/>
435     <echo message="+------------------------------------------+"/>
436
437     <copy todir="${propel.phpconf.dir}">
438         <fileset dir="${propel.conf.dir}">
439                         <include name="${propel.runtime.conf.includes}"/>
440                 </fileset>
441     </copy>
442
443   </target>
444
445   <target
446     name="graphviz"
447     depends="sql-check"
448     description="==> generates Graphviz file for your project">
449
450     <echo message="+------------------------------------------+"/>
451     <echo message="|                                          |"/>
452     <echo message="| Generating Graphiz for YOUR Propel       |"/>
453     <echo message="| project!                                 |"/>
454     <echo message="|                                          |"/>
455     <echo message="+------------------------------------------+"/>
456
457     <propel-graphviz
458       outputDirectory="${propel.graph.dir}"
459       targetDatabase="${propel.database}"
460       sqldbmap="${propel.sql.dir}/sqldb.map"
461       packageObjectModel="${propel.packageObjectModel}">
462       <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
463       <schemafileset dir="${propel.schema.dir}"
464         includes="${propel.schema.sql.includes}"
465         excludes="${propel.schema.sql.excludes}"
466       />
467     </propel-graphviz>
468   </target>
469
470
471 </project>
Note: See TracBrowser for help on using the browser.