Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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