Skip to content
This repository
tag: 1.6.0
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 623 lines (538 sloc) 24.733 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
<project name="propel" default="main">

  <!--
Note - You should not have to edit this file.

Instead, if calling build-propel.xml directly, edit the build.properties
that is in the same directory. If calling build-propel.xml via another
build file, you can also use the build.properties in the same directory,
or set the property propel.contextProperties to the file
to use in place of build.properties (e.g. project.properties).
-->

  <property name="build.properties" value="build.properties"/>
  <property name="propel.contextProperties" value="./${build.properties}"/>
  <property name="propel.home" value="."/>

  <available file="${propel.home}/build.properties" property="globalBuildPopertiesExists"/>

  <if>
   <and>
   <isset property="globalBuildPopertiesExists"/>
   </and>
   <then>
<property file="${propel.home}/build.properties"/>
    </then>
  </if>

  <!--
The default.properties file will map old properties to the new ones along
with setting the corret defaults.
-->
  <property file="${propel.home}/default.properties"/>

  <!--
Do forward declarations of all of our tasks to
centralize them and clean up the targets.
-->

  <path id="propelclasses">
    <pathelement dir="${propel.home}/lib/"/>
    <pathelement dir="${propel.project.dir}/"/>
  </path>

  <taskdef
    name="propel-om"
    classname="task.PropelOMTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-data-dump"
    classname="task.PropelDataDumpTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-data-sql"
    classname="task.PropelDataSQLTask" classpathRef="propelclasses"/>
   <taskdef
    name="propel-schema-reverse"
    classname="task.PropelSchemaReverseTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-sql"
    classname="task.PropelSQLTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-sql-diff"
    classname="task.PropelSQLDiffTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-migration-status"
    classname="task.PropelMigrationStatusTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-migration-up"
    classname="task.PropelMigrationUpTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-migration-down"
    classname="task.PropelMigrationDownTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-migration"
    classname="task.PropelMigrationTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-sql-exec"
    classname="task.PropelSQLExec" classpathRef="propelclasses"/>
  <taskdef
    name="propel-graphviz"
    classname="task.PropelGraphvizTask" classpathRef="propelclasses"/>
  <taskdef
    name="propel-convert-conf"
    classname="task.PropelConvertConfTask" classpathRef="propelclasses"/>

  <!-- ================================================================ -->
  <!-- M A I N T A R G E T -->
  <!-- ================================================================ -->
  <!-- This default target will run all the targets that generate -->
  <!-- source. You will probably only run this target once then -->
  <!-- call individual targets as necessary to update your sources -->
  <!-- when you change your XML schema. -->
  <!-- ================================================================ -->

  <target
    name="main"
   depends="mysqli-check"
    description="==> generates sql + om classes">

    <phingcall target="sql"/>
    <phingcall target="om"/>
    <phingcall target="convert-conf"/>
  </target>

  <!-- ================================================================ -->
  <!-- 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 -->
  <!-- ================================================================ -->
  <!-- Maps the propel.runOnlyOnSchemaChange to -->
  <!-- propel.internal.runOnlyOnSchemaChange -->
  <!-- ================================================================ -->

  <target name="check-run-only-on-schema-change">
    <condition property="propel.internal.runOnlyOnSchemaChange">
      <equals arg1="${propel.runOnlyOnSchemaChange}" arg2="true"/>
    </condition>
  </target>

  <!-- ================================================================ -->
  <!-- G E N E R A T E P R O J E C T S Q L -->
  <!-- ================================================================ -->
  <!-- Generate the SQL for your project, These are in addition -->
  <!-- to the base Turbine tables! The tables you require for your -->
  <!-- project should be specified in project-schema.xml. -->
  <!-- ================================================================ -->

  <target
    name="sql-check"
    depends="check-run-only-on-schema-change"
    if="propel.internal.runOnlyOnSchemaChange">
    <uptodate
      property="propel.internal.sql.uptodate"
      targetfile="${propel.sql.dir}/${propel.schema.default.basename}.sql">
      <srcfiles dir="${propel.schema.dir}" includes="**/${propel.schema.default.basename}.xml" />
    </uptodate>
  </target>

  <!-- temporary target to check whether postgres is being used with identifier quoting ON.
If so, a warning is issued, since identifier quoting is only paritally implemented & this point. -->
  <target name="pgsql-quoting-check">
   <if>
   <and>
<equals arg1="${propel.database}" arg2="pgsql"/>
<equals arg1="${propel.disableIdentifierQuoting}" arg2=""/>
</and>
<then>
<warn>ATTENTION: It appears you are using PostgreSQL and you have identifier-quoting turned on.</warn>
<warn>It is suggested that you disable identifier quoting when using PostgreSQL -- especially if you</warn>
<warn>have case-sensitive columns in your database.</warn>
<warn></warn>
<warn>To disable identifier quoting, add the following property to your build.properties (or specify</warn>
<warn>it using -D on commandline):</warn>
<warn></warn>
<warn>propel.disableIdentifierQuoting=true</warn>
<warn></warn>
<warn>You can ignore this warning if you understand the issues related to case-sensitivity and Propel's</warn>
<warn>DDL-only implementation of identifier quoting.</warn>
</then>
</if>
  </target>

<!-- temporary target to check whether mysqli is being used
If so, a warning is issued, since this is deprecated -->
<target name="mysqli-check">
<if>
<and>
<equals arg1="${propel.database}" arg2="mysqli"/>
</and>
<then>
<warn>ATTENTION: It appears you are using the mysqli driver.</warn>
<warn></warn>
<warn>This driver is no longer supported by Propel because Propel now uses PDO for database connections.</warn>
<warn>Please use mysqli driver instead.</warn>
<fail>Use 'mysql' instead of 'mysqli' for your propel.database property.</fail>
</then>
</if>
</target>

  <target
    name="sql"
    depends="sql-check,pgsql-quoting-check,mysqli-check"
    unless="propel.internal.sql.uptodate"
    description="==> generates the SQL for your project">

    <echo message="+------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Generating SQL for YOUR Propel project! |"/>
    <echo message="| |"/>
    <echo message="+------------------------------------------+"/>

    <phingcall target="sql-template"/>

  </target>

  <target name="sql-template">
    <propel-sql
      validate="${propel.schema.validate}"
      xsd="${propel.schema.xsd.file}"
      xsl="${propel.schema.xsl.file}"
      outputDirectory="${propel.sql.dir}"
      sqldbmap="${propel.sql.dir}/sqldb.map"
      targetDatabase="${propel.database}"
      packageObjectModel="${propel.packageObjectModel}"
      url="${propel.database.url}"
      userId="${propel.database.user}"
      password="${propel.database.password}">
      <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
      <schemafileset dir="${propel.schema.dir}"
        includes="${propel.schema.sql.includes}"
        excludes="${propel.schema.sql.excludes}"
      />
    </propel-sql>
  </target>

  <!-- ================================================================ -->
  <!-- C R E A T E T A R G E T D A T A B A S E -->
  <!-- ================================================================ -->
  <!-- Create the target database by executing a generated script -->
  <!-- that is capable of performing the task. -->
  <!-- ================================================================ -->

  <target name="create-db-check">
    <condition property="propel.internal.manualCreation">
      <equals arg1="${propel.database.manualCreation}" arg2="true"/>
    </condition>
  </target>

  <target
    name="create-db"
    unless="propel.internal.manualCreation"
    depends="create-db-check,mysqli-check"
    description="==> generates the target database">

    <fail message="create-db target temporarily disabled, while we replace creole components."/>

<!--
<echo message="Executing the create-db.sql script ..."/>

<sql
autocommit="true"
driver="${propel.database.driver}"
onerror="continue"
src="${propel.sql.dir}/create-db.sql"
url="${propel.database.createUrl}"
/>
-->
  </target>

  <!-- ================================================================ -->
  <!-- I N S E R T S I N G L E S Q L F I L E S -->
  <!-- ================================================================ -->

  <target
    name="insert-sql"
    description="==> inserts the generated sql ">

    <propel-sql-exec
      autocommit="true"
      onerror="continue"
      sqldbmap="${propel.sql.dir}/sqldb.map"
      srcDir="${propel.sql.dir}"
      url="${propel.database.buildUrl}"
      userId="${propel.database.user}"
      password="${propel.database.password}"
    />
  </target>
  
  <!-- ================================================================ -->
  <!-- N E W R E V E R S E T O X M L -->
  <!-- ================================================================ -->

  <target
    name="reverse"
    description="==> generate xml schema from reverse-engineered database (new)">

    <echo message="+-----------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Generating XML from PDO connection ! |"/>
    <echo message="| |"/>
    <echo message="+-----------------------------------------------+"/>

    <propel-schema-reverse
      databaseName="${propel.project}"
      dbSchema="${propel.database.schema}"
      dbEncoding="${propel.database.encoding}"
      url="${propel.database.buildUrl}"
      userId="${propel.database.user}"
      password="${propel.database.password}"
      outputFile="${propel.schema.dir}/${propel.default.schema.basename}.xml"
      samePhpName="${propel.samePhpName}"
      addVendorInfo="${propel.addVendorInfo}"
      addValidators="${propel.addValidators}"
    />

  </target>

  <!-- ================================================================ -->
  <!-- M I G R A T I O N T A S K S -->
  <!-- ================================================================ -->
  
  <target
    name="sql-diff"
    depends="sql-check,pgsql-quoting-check,mysqli-check"
    unless="propel.internal.sql.uptodate"
    description="==> generates a SQL diff for your project">

    <echo message="+----------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Generating SQL diff between the XML schemas |"/>
    <echo message="| and the current database structure. |"/>
    <echo message="| |"/>
    <echo message="+----------------------------------------------+"/>

    <phingcall target="sql-diff-template"/>
  </target>

  <target name="sql-diff-template">
    <propel-sql-diff
      validate="${propel.schema.validate}"
      xsd="${propel.schema.xsd.file}"
      xsl="${propel.schema.xsl.file}"
      outputDirectory="${propel.migration.dir}"
      targetDatabase="${propel.database}"
      packageObjectModel="${propel.packageObjectModel}"
      databaseName="${propel.project}"
      url="${propel.database.url}"
      userId="${propel.database.user}"
      password="${propel.database.password}"
      editorCmd="${propel.migration.editor}"
      caseInsensitive="${propel.migration.caseInsensitive}">
      <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
      <schemafileset dir="${propel.schema.dir}"
        includes="${propel.schema.sql.includes}"
        excludes="${propel.schema.sql.excludes}"
      />
    </propel-sql-diff>
  </target>

  <target
    name="migration-status"
    depends="sql-check,pgsql-quoting-check,mysqli-check"
    unless="propel.internal.sql.uptodate"
    description="Lists the migrations left to be executed">

    <echo message="+----------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Look for Migration classes and lists |"/>
    <echo message="| the ones not yet executed. |"/>
    <echo message="| |"/>
    <echo message="+----------------------------------------------+"/>

    <phingcall target="migration-status-template"/>
  </target>

  <target name="migration-status-template">
    <propel-migration-status
      migrationTable="${propel.migration.table}"
      outputDirectory="${propel.migration.dir}">
    </propel-migration-status>
  </target>

  <target
    name="migration-up"
    depends="sql-check,pgsql-quoting-check,mysqli-check"
    unless="propel.internal.sql.uptodate"
    description="Execute the next migration">

    <echo message="+----------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Look for next Migration class |"/>
    <echo message="| and execute it |"/>
    <echo message="| |"/>
    <echo message="+----------------------------------------------+"/>

    <phingcall target="migration-up-template"/>
  </target>

  <target name="migration-up-template">
    <propel-migration-up
      migrationTable="${propel.migration.table}"
      outputDirectory="${propel.migration.dir}">
    </propel-migration-up>
  </target>

  <target
    name="migration-down"
    depends="sql-check,pgsql-quoting-check,mysqli-check"
    unless="propel.internal.sql.uptodate"
    description="Execute the next migration">

    <echo message="+----------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Look for previous Migration class |"/>
    <echo message="| and execute it |"/>
    <echo message="| |"/>
    <echo message="+----------------------------------------------+"/>

    <phingcall target="migration-down-template"/>
  </target>

  <target name="migration-down-template">
    <propel-migration-down
      migrationTable="${propel.migration.table}"
      outputDirectory="${propel.migration.dir}">
    </propel-migration-down>
  </target>

  <target
    name="migration"
    depends="sql-check,pgsql-quoting-check,mysqli-check"
    unless="propel.internal.sql.uptodate"
    description="Execute the next migration">

    <echo message="+----------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Look for next Migration class |"/>
    <echo message="| and execute it |"/>
    <echo message="| |"/>
    <echo message="+----------------------------------------------+"/>

    <phingcall target="migration-template"/>
  </target>

  <target name="migration-template">
    <propel-migration
      migrationTable="${propel.migration.table}"
      outputDirectory="${propel.migration.dir}">
    </propel-migration>
  </target>
  
  <!-- ================================================================ -->
  <!-- Generate SQL from XML data file -->
  <!-- ================================================================ -->

  <target
    name="datasql"
    description="==> generates sql from data xml">

    <echo message="+-----------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Generating SQL from data XML ! |"/>
    <echo message="| |"/>
    <echo message="+-----------------------------------------------+"/>

    <propel-data-sql
      validate="${propel.schema.validate}"
      xsd="${propel.schema.xsd.file}"
      xsl="${propel.schema.xsl.file}"
      outputDirectory="${propel.sql.dir}"
      sqldbmap="${propel.sql.dir}/sqldb.map"
      dbEncoding="${propel.database.encoding}"
      targetDatabase="${propel.database}"
      datadbmap="${propel.schema.dir}/datadb.map"
      srcDir="${propel.schema.dir}">
      <mapper type="glob" from="${propel.datasql.mapper.from}" to="${propel.datasql.mapper.to}"/>
      <schemafileset dir="${propel.schema.dir}"
        includes="${propel.schema.datadtd.includes}"
        excludes="${propel.schema.datadtd.excludes}"
      />
    </propel-data-sql>
  </target>

  <!-- ================================================================ -->
  <!-- Dump data from database into xml file -->
  <!-- ================================================================ -->

  <target
    name="datadump"
    description="==> dump data from database into xml file">

    <echo message="+-----------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Dumping the data from database into XML |"/>
    <echo message="| |"/>
    <echo message="+-----------------------------------------------+"/>

    <propel-data-dump
      validate="${propel.schema.validate}"
      xsd="${propel.schema.xsd.file}"
      xsl="${propel.schema.xsl.file}"
      targetDatabase="${propel.database}"
      datadbmap="${propel.schema.dir}/datadb.map"
      databaseDriver="${propel.database.driver}"
      dbEncoding="${propel.database.encoding}"
      databaseUrl="${propel.database.url}"
      databaseUser="${propel.database.user}"
      databasePassword="${propel.database.password}"
      outputDirectory="${propel.schema.dir}">
      <mapper type="glob" from="${propel.datadump.mapper.from}" to="${propel.datadump.mapper.to}"/>
      <schemafileset dir="${propel.schema.dir}"
        includes="${propel.schema.datadtd.includes}"
        excludes="${propel.schema.datadtd.excludes}"
      />
     </propel-data-dump>
  </target>

  <!-- ================================================================ -->
  <!-- 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 -->
  <!-- ================================================================ -->
  <!-- Generate the Peer-based object model for your project. -->
  <!-- These are in addition to the base Propel OM! -->
  <!-- ================================================================ -->

  <target
    name="om-check"
    depends="check-run-only-on-schema-change"
    if="propel.internal.runOnlyOnSchemaChange">
    <uptodate
      property="propel.internal.om.uptodate"
      targetfile="${propel.php.dir}/report.${propel.project}.om.generation">
      <srcfiles dir="${propel.schema.dir}" includes="**/${propel.schema.om.includes}.xml" />
    </uptodate>
  </target>

  <target
    name="om"
    depends="om-check,mysqli-check"
    unless="propel.internal.om.uptodate"
    description="==> generates the Peer-based object model for your project">

    <echo message="+------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Generating Peer-based Object Model for |"/>
    <echo message="| YOUR Propel project! |"/>
    <echo message="| |"/>
    <echo message="+------------------------------------------+"/>

    <phingcall target="om-template"/>
    <!--<phingcall target="om-tar"/>-->
  </target>

  <target name="om-template">
    <propel-om
      validate="${propel.schema.validate}"
      xsd="${propel.schema.xsd.file}"
      xsl="${propel.schema.xsl.file}"
      outputDirectory="${propel.php.dir}"
      targetDatabase="${propel.database}"
      targetPackage="${propel.targetPackage}"
      targetPlatform="${propel.targetPlatform}"
      packageObjectModel="${propel.packageObjectModel}">
      <schemafileset dir="${propel.schema.dir}"
        includes="${propel.schema.om.includes}"
        excludes="${propel.schema.om.excludes}"
      />
    </propel-om>
  </target>

  <!-- ================================================================== -->
  <!-- X M L R U N T I M E C O N F T O P H P A R R A Y -->
  <!-- ================================================================== -->

  <target
    name="convert-conf"
    description="==> converts properties file to PHP array">

    <echo message="+------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Converting runtime config file to an |"/>
    <echo message="| array dump for improved performance. |"/>
    <echo message="| |"/>
    <echo message="+------------------------------------------+"/>

    <propel-convert-conf
      targetDatabase="${propel.database}"
      xsd="${propel.schema.xsd.file}"
      xsl="${propel.schema.xsl.file}"
      xmlConfFile="${propel.conf.dir}/${propel.runtime.conf.file}"
      outputDirectory="${propel.phpconf.dir}"
      outputFile="${propel.runtime.phpconf.file}"
      outputClassmapFile="${propel.runtime.phpconf-classmap.file}"
      packageObjectModel="${propel.packageObjectModel}">
      <schemafileset dir="${propel.schema.dir}"
        includes="${propel.schema.sql.includes}"
        excludes="${propel.schema.sql.excludes}"
      />
     </propel-convert-conf>

  </target>

  <target
    name="dbd2propel"
    description="==> generates a Propel XML schema from a DBDesigner 4 XML schema">

    <echo message="+------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Generating Propel XML Schema |"/>
    <echo message="| Based on DB4Designer export |"/>
    <echo message="| |"/>
    <echo message="+------------------------------------------+"/>

    <xslt todir="${propel.schema.dir}" style="${propel.dbd2propel.xsl.file}" >
      <fileset dir="${propel.dbd2propel.dir}">
        <include name="${propel.dbd2propel.includes}" />
      </fileset>
      <mapper type="regexp" from="^(.*)\.xml$" to="\1.schema.xml"/>
    </xslt>
  </target>
  
  <target
    name="graphviz"
    depends="sql-check"
    description="==> generates Graphviz file for your project">

    <echo message="+------------------------------------------+"/>
    <echo message="| |"/>
    <echo message="| Generating Graphiz for YOUR Propel |"/>
    <echo message="| project! |"/>
    <echo message="| |"/>
    <echo message="+------------------------------------------+"/>

    <propel-graphviz
      outputDirectory="${propel.graph.dir}"
      targetDatabase="${propel.database}"
      sqldbmap="${propel.sql.dir}/sqldb.map"
      packageObjectModel="${propel.packageObjectModel}">
      <mapper type="glob" from="${propel.sql.mapper.from}" to="${propel.sql.mapper.to}"/>
      <schemafileset dir="${propel.schema.dir}"
        includes="${propel.schema.sql.includes}"
        excludes="${propel.schema.sql.excludes}"
      />
    </propel-graphviz>
  </target>


</project>
Something went wrong with that request. Please try again.